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

Side by Side 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, 3 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/object.h" 5 #include "vm/object.h"
6 6
7 #include "include/dart_api.h" 7 #include "include/dart_api.h"
8 #include "platform/assert.h" 8 #include "platform/assert.h"
9 #include "vm/assembler.h" 9 #include "vm/assembler.h"
10 #include "vm/cpu.h" 10 #include "vm/cpu.h"
(...skipping 7219 matching lines...) Expand 10 before | Expand all | Expand 10 after
7230 isolate->object_store()->set_root_library(Library::Handle()); 7230 isolate->object_store()->set_root_library(Library::Handle());
7231 7231
7232 // Hook up predefined classes without setting their library pointers. These 7232 // Hook up predefined classes without setting their library pointers. These
7233 // classes are coming from the VM isolate, and are shared between multiple 7233 // classes are coming from the VM isolate, and are shared between multiple
7234 // isolates so setting their library pointers would be wrong. 7234 // isolates so setting their library pointers would be wrong.
7235 const Class& cls = Class::Handle(Object::dynamic_class()); 7235 const Class& cls = Class::Handle(Object::dynamic_class());
7236 core_lib.AddObject(cls, String::Handle(cls.Name())); 7236 core_lib.AddObject(cls, String::Handle(cls.Name()));
7237 } 7237 }
7238 7238
7239 7239
7240 RawObject* Library::Evaluate(const String& expr) const {
7241 // Make a fake top-level class and evaluate the expression
7242 // as a static function of the class.
7243 Script& script = Script::Handle();
7244 script = Script::New(Symbols::Empty(),
7245 Symbols::Empty(),
7246 RawScript::kSourceTag);
7247 Class& temp_class =
7248 Class::Handle(Class::New(Symbols::TopLevel(), script, 0));
7249 temp_class.set_library(*this);
7250 return temp_class.Evaluate(expr);
7251 }
7252
7253
7240 void Library::InitNativeWrappersLibrary(Isolate* isolate) { 7254 void Library::InitNativeWrappersLibrary(Isolate* isolate) {
7241 static const int kNumNativeWrappersClasses = 4; 7255 static const int kNumNativeWrappersClasses = 4;
7242 ASSERT(kNumNativeWrappersClasses > 0 && kNumNativeWrappersClasses < 10); 7256 ASSERT(kNumNativeWrappersClasses > 0 && kNumNativeWrappersClasses < 10);
7243 const String& native_flds_lib_url = Symbols::DartNativeWrappers(); 7257 const String& native_flds_lib_url = Symbols::DartNativeWrappers();
7244 const Library& native_flds_lib = Library::Handle( 7258 const Library& native_flds_lib = Library::Handle(
7245 Library::NewLibraryHelper(native_flds_lib_url, false)); 7259 Library::NewLibraryHelper(native_flds_lib_url, false));
7246 native_flds_lib.Register(); 7260 native_flds_lib.Register();
7247 isolate->object_store()->set_native_wrappers_library(native_flds_lib); 7261 isolate->object_store()->set_native_wrappers_library(native_flds_lib);
7248 static const char* const kNativeWrappersClass = "NativeFieldWrapperClass"; 7262 static const char* const kNativeWrappersClass = "NativeFieldWrapperClass";
7249 static const int kNameLength = 25; 7263 static const int kNameLength = 25;
(...skipping 7597 matching lines...) Expand 10 before | Expand all | Expand 10 after
14847 } 14861 }
14848 14862
14849 14863
14850 void MirrorReference::PrintToJSONStream(JSONStream* stream, bool ref) const { 14864 void MirrorReference::PrintToJSONStream(JSONStream* stream, bool ref) const {
14851 stream->OpenObject(); 14865 stream->OpenObject();
14852 stream->CloseObject(); 14866 stream->CloseObject();
14853 } 14867 }
14854 14868
14855 14869
14856 } // namespace dart 14870 } // namespace dart
OLDNEW
« runtime/bin/dbg_message.cc ('K') | « runtime/vm/object.h ('k') | tools/ddbg.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698