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

Unified Diff: runtime/vm/object.cc

Issue 23514020: Evaluation of expression in context of library top-level (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 4 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.h ('k') | tools/ddbg.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/object.cc
===================================================================
--- runtime/vm/object.cc (revision 26897)
+++ runtime/vm/object.cc (working copy)
@@ -7242,6 +7242,20 @@
}
+RawObject* Library::Evaluate(const String& expr) const {
+ // Make a fake top-level class and evaluate the expression
+ // as a static function of the class.
+ Script& script = Script::Handle();
+ script = Script::New(Symbols::Empty(),
+ Symbols::Empty(),
+ RawScript::kSourceTag);
+ Class& temp_class =
+ Class::Handle(Class::New(Symbols::TopLevel(), script, 0));
+ temp_class.set_library(*this);
+ return temp_class.Evaluate(expr);
+}
+
+
void Library::InitNativeWrappersLibrary(Isolate* isolate) {
static const int kNumNativeWrappersClasses = 4;
ASSERT(kNumNativeWrappersClasses > 0 && kNumNativeWrappersClasses < 10);
« no previous file with comments | « runtime/vm/object.h ('k') | tools/ddbg.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698