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

Unified Diff: runtime/vm/object.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 | « no previous file | runtime/vm/parser.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/object.cc
diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc
index 4c953366950d73c613aaf23ebdc2338bb8c9eae8..4eb1acaca1679d9ba0aeb8e3917fd0f3050b1212 100644
--- a/runtime/vm/object.cc
+++ b/runtime/vm/object.cc
@@ -9643,19 +9643,8 @@ RawObject* Library::Evaluate(const String& expr,
// as a static function of the class.
Class& top_level_class = Class::Handle();
Array& top_level_classes = Array::Handle(anonymous_classes());
- if (top_level_classes.Length() > 0) {
- top_level_class ^= top_level_classes.At(0);
- } else {
- // A library may have no top-level classes if it has no top-level
- // variables or methods.
- Script& script = Script::Handle(Script::New(Symbols::Empty(),
- Symbols::Empty(),
- RawScript::kSourceTag));
- top_level_class = Class::New(Symbols::TopLevel(), script, 0);
- top_level_class.set_is_finalized();
- top_level_class.set_library(*this);
- AddAnonymousClass(top_level_class);
- }
+ ASSERT(top_level_classes.Length() > 0);
+ top_level_class ^= top_level_classes.At(0);
ASSERT(top_level_class.is_finalized());
return top_level_class.Evaluate(expr, param_names, param_values);
}
« no previous file with comments | « no previous file | runtime/vm/parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698