| OLD | NEW |
| 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 9625 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9636 } | 9636 } |
| 9637 | 9637 |
| 9638 | 9638 |
| 9639 RawObject* Library::Evaluate(const String& expr, | 9639 RawObject* Library::Evaluate(const String& expr, |
| 9640 const Array& param_names, | 9640 const Array& param_names, |
| 9641 const Array& param_values) const { | 9641 const Array& param_values) const { |
| 9642 // Take or make a fake top-level class and evaluate the expression | 9642 // Take or make a fake top-level class and evaluate the expression |
| 9643 // as a static function of the class. | 9643 // as a static function of the class. |
| 9644 Class& top_level_class = Class::Handle(); | 9644 Class& top_level_class = Class::Handle(); |
| 9645 Array& top_level_classes = Array::Handle(anonymous_classes()); | 9645 Array& top_level_classes = Array::Handle(anonymous_classes()); |
| 9646 if (top_level_classes.Length() > 0) { | 9646 ASSERT(top_level_classes.Length() > 0); |
| 9647 top_level_class ^= top_level_classes.At(0); | 9647 top_level_class ^= top_level_classes.At(0); |
| 9648 } else { | |
| 9649 // A library may have no top-level classes if it has no top-level | |
| 9650 // variables or methods. | |
| 9651 Script& script = Script::Handle(Script::New(Symbols::Empty(), | |
| 9652 Symbols::Empty(), | |
| 9653 RawScript::kSourceTag)); | |
| 9654 top_level_class = Class::New(Symbols::TopLevel(), script, 0); | |
| 9655 top_level_class.set_is_finalized(); | |
| 9656 top_level_class.set_library(*this); | |
| 9657 AddAnonymousClass(top_level_class); | |
| 9658 } | |
| 9659 ASSERT(top_level_class.is_finalized()); | 9648 ASSERT(top_level_class.is_finalized()); |
| 9660 return top_level_class.Evaluate(expr, param_names, param_values); | 9649 return top_level_class.Evaluate(expr, param_names, param_values); |
| 9661 } | 9650 } |
| 9662 | 9651 |
| 9663 | 9652 |
| 9664 void Library::InitNativeWrappersLibrary(Isolate* isolate) { | 9653 void Library::InitNativeWrappersLibrary(Isolate* isolate) { |
| 9665 static const int kNumNativeWrappersClasses = 4; | 9654 static const int kNumNativeWrappersClasses = 4; |
| 9666 ASSERT(kNumNativeWrappersClasses > 0 && kNumNativeWrappersClasses < 10); | 9655 ASSERT(kNumNativeWrappersClasses > 0 && kNumNativeWrappersClasses < 10); |
| 9667 const String& native_flds_lib_url = Symbols::DartNativeWrappers(); | 9656 const String& native_flds_lib_url = Symbols::DartNativeWrappers(); |
| 9668 const Library& native_flds_lib = Library::Handle( | 9657 const Library& native_flds_lib = Library::Handle( |
| (...skipping 11072 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 20741 return tag_label.ToCString(); | 20730 return tag_label.ToCString(); |
| 20742 } | 20731 } |
| 20743 | 20732 |
| 20744 | 20733 |
| 20745 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { | 20734 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { |
| 20746 Instance::PrintJSONImpl(stream, ref); | 20735 Instance::PrintJSONImpl(stream, ref); |
| 20747 } | 20736 } |
| 20748 | 20737 |
| 20749 | 20738 |
| 20750 } // namespace dart | 20739 } // namespace dart |
| OLD | NEW |