Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(131)

Unified Diff: runtime/vm/parser.cc

Issue 1131793012: Ensure libraries always have at least one top-level class and therefore at least one script. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/object.cc ('k') | tests/lib/lib.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/parser.cc
diff --git a/runtime/vm/parser.cc b/runtime/vm/parser.cc
index 3dc9370481d463c84d6f8361e2968c63e84f7bcb..aa8bc9796e83ee11e29544e19250c95c56dd320d 100644
--- a/runtime/vm/parser.cc
+++ b/runtime/vm/parser.cc
@@ -5970,16 +5970,14 @@ void Parser::ParseTopLevel() {
}
}
}
- if ((top_level.fields.Length() > 0) || (top_level.functions.Length() > 0)) {
- toplevel_class.AddFields(top_level.fields);
- const Array& array = Array::Handle(Z,
- Array::MakeArray(top_level.functions));
- toplevel_class.SetFunctions(array);
+ toplevel_class.AddFields(top_level.fields);
- library_.AddAnonymousClass(toplevel_class);
- pending_classes.Add(toplevel_class, Heap::kOld);
- }
+ const Array& array = Array::Handle(Z, Array::MakeArray(top_level.functions));
+ toplevel_class.SetFunctions(array);
+
+ library_.AddAnonymousClass(toplevel_class);
hausner 2015/05/19 05:43:03 A library with 100 part files will now have 100 to
rmacnak 2015/05/19 15:57:41 Done.
+ pending_classes.Add(toplevel_class, Heap::kOld);
}
« no previous file with comments | « runtime/vm/object.cc ('k') | tests/lib/lib.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698