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

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
« no previous file with comments | « runtime/vm/object.h ('k') | tools/ddbg.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 7224 matching lines...) Expand 10 before | Expand all | Expand 10 after
7235 isolate->object_store()->set_root_library(Library::Handle()); 7235 isolate->object_store()->set_root_library(Library::Handle());
7236 7236
7237 // Hook up predefined classes without setting their library pointers. These 7237 // Hook up predefined classes without setting their library pointers. These
7238 // classes are coming from the VM isolate, and are shared between multiple 7238 // classes are coming from the VM isolate, and are shared between multiple
7239 // isolates so setting their library pointers would be wrong. 7239 // isolates so setting their library pointers would be wrong.
7240 const Class& cls = Class::Handle(Object::dynamic_class()); 7240 const Class& cls = Class::Handle(Object::dynamic_class());
7241 core_lib.AddObject(cls, String::Handle(cls.Name())); 7241 core_lib.AddObject(cls, String::Handle(cls.Name()));
7242 } 7242 }
7243 7243
7244 7244
7245 RawObject* Library::Evaluate(const String& expr) const {
7246 // Make a fake top-level class and evaluate the expression
7247 // as a static function of the class.
7248 Script& script = Script::Handle();
7249 script = Script::New(Symbols::Empty(),
7250 Symbols::Empty(),
7251 RawScript::kSourceTag);
7252 Class& temp_class =
7253 Class::Handle(Class::New(Symbols::TopLevel(), script, 0));
7254 temp_class.set_library(*this);
7255 return temp_class.Evaluate(expr);
7256 }
7257
7258
7245 void Library::InitNativeWrappersLibrary(Isolate* isolate) { 7259 void Library::InitNativeWrappersLibrary(Isolate* isolate) {
7246 static const int kNumNativeWrappersClasses = 4; 7260 static const int kNumNativeWrappersClasses = 4;
7247 ASSERT(kNumNativeWrappersClasses > 0 && kNumNativeWrappersClasses < 10); 7261 ASSERT(kNumNativeWrappersClasses > 0 && kNumNativeWrappersClasses < 10);
7248 const String& native_flds_lib_url = Symbols::DartNativeWrappers(); 7262 const String& native_flds_lib_url = Symbols::DartNativeWrappers();
7249 const Library& native_flds_lib = Library::Handle( 7263 const Library& native_flds_lib = Library::Handle(
7250 Library::NewLibraryHelper(native_flds_lib_url, false)); 7264 Library::NewLibraryHelper(native_flds_lib_url, false));
7251 native_flds_lib.Register(); 7265 native_flds_lib.Register();
7252 isolate->object_store()->set_native_wrappers_library(native_flds_lib); 7266 isolate->object_store()->set_native_wrappers_library(native_flds_lib);
7253 static const char* const kNativeWrappersClass = "NativeFieldWrapperClass"; 7267 static const char* const kNativeWrappersClass = "NativeFieldWrapperClass";
7254 static const int kNameLength = 25; 7268 static const int kNameLength = 25;
(...skipping 7633 matching lines...) Expand 10 before | Expand all | Expand 10 after
14888 } 14902 }
14889 14903
14890 14904
14891 void MirrorReference::PrintToJSONStream(JSONStream* stream, bool ref) const { 14905 void MirrorReference::PrintToJSONStream(JSONStream* stream, bool ref) const {
14892 stream->OpenObject(); 14906 stream->OpenObject();
14893 stream->CloseObject(); 14907 stream->CloseObject();
14894 } 14908 }
14895 14909
14896 14910
14897 } // namespace dart 14911 } // namespace dart
OLDNEW
« 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