| 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 "platform/assert.h" | 5 #include "platform/assert.h" |
| 6 #include "vm/class_finalizer.h" | 6 #include "vm/class_finalizer.h" |
| 7 #include "vm/symbols.h" | 7 #include "vm/symbols.h" |
| 8 #include "vm/unit_test.h" | 8 #include "vm/unit_test.h" |
| 9 | 9 |
| 10 namespace dart { | 10 namespace dart { |
| 11 | 11 |
| 12 | 12 |
| 13 static RawClass* CreateTestClass(const char* name) { | 13 static RawClass* CreateTestClass(const char* name) { |
| 14 const String& class_name = String::Handle(Symbols::New(name)); | 14 const String& class_name = String::Handle(Symbols::New(name)); |
| 15 const Script& script = Script::Handle(); | 15 const Script& script = Script::Handle(); |
| 16 const Class& cls = | 16 const Class& cls = |
| 17 Class::Handle(Class::New(class_name, script, Scanner::kDummyTokenIndex)); | 17 Class::Handle(Class::New(class_name, script, Scanner::kNoSourcePos)); |
| 18 cls.set_interfaces(Object::empty_array()); | 18 cls.set_interfaces(Object::empty_array()); |
| 19 cls.SetFunctions(Object::empty_array()); | 19 cls.SetFunctions(Object::empty_array()); |
| 20 cls.SetFields(Object::empty_array()); | 20 cls.SetFields(Object::empty_array()); |
| 21 return cls.raw(); | 21 return cls.raw(); |
| 22 } | 22 } |
| 23 | 23 |
| 24 | 24 |
| 25 TEST_CASE(ClassFinalizer) { | 25 TEST_CASE(ClassFinalizer) { |
| 26 Isolate* isolate = Isolate::Current(); | 26 Isolate* isolate = Isolate::Current(); |
| 27 ObjectStore* object_store = isolate->object_store(); | 27 ObjectStore* object_store = isolate->object_store(); |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 pending_classes.Add(rhb); | 86 pending_classes.Add(rhb); |
| 87 Class& sbb = Class::Handle(CreateTestClass("SBB")); | 87 Class& sbb = Class::Handle(CreateTestClass("SBB")); |
| 88 pending_classes.Add(sbb); | 88 pending_classes.Add(sbb); |
| 89 Library& lib = Library::Handle(NewLib("TestLib")); | 89 Library& lib = Library::Handle(NewLib("TestLib")); |
| 90 lib.AddClass(rhb); | 90 lib.AddClass(rhb); |
| 91 lib.AddClass(sbb); | 91 lib.AddClass(sbb); |
| 92 const String& superclass_name = String::Handle(sbb.Name()); | 92 const String& superclass_name = String::Handle(sbb.Name()); |
| 93 const UnresolvedClass& unresolved = UnresolvedClass::Handle( | 93 const UnresolvedClass& unresolved = UnresolvedClass::Handle( |
| 94 UnresolvedClass::New(LibraryPrefix::Handle(), | 94 UnresolvedClass::New(LibraryPrefix::Handle(), |
| 95 superclass_name, | 95 superclass_name, |
| 96 Scanner::kDummyTokenIndex)); | 96 Scanner::kNoSourcePos)); |
| 97 const TypeArguments& type_arguments = TypeArguments::Handle(); | 97 const TypeArguments& type_arguments = TypeArguments::Handle(); |
| 98 rhb.set_super_type(Type::Handle( | 98 rhb.set_super_type(Type::Handle( |
| 99 Type::New(Object::Handle(unresolved.raw()), | 99 Type::New(Object::Handle(unresolved.raw()), |
| 100 type_arguments, | 100 type_arguments, |
| 101 Scanner::kDummyTokenIndex))); | 101 Scanner::kNoSourcePos))); |
| 102 EXPECT(ClassFinalizer::ProcessPendingClasses()); | 102 EXPECT(ClassFinalizer::ProcessPendingClasses()); |
| 103 } | 103 } |
| 104 | 104 |
| 105 } // namespace dart | 105 } // namespace dart |
| OLD | NEW |