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/unit_test.h" | 7 #include "vm/unit_test.h" |
8 | 8 |
9 namespace dart { | 9 namespace dart { |
10 | 10 |
11 | 11 |
12 static RawClass* CreateTestClass(const char* name) { | 12 static RawClass* CreateTestClass(const char* name) { |
13 const Array& empty_array = Array::Handle(Array::Empty()); | 13 const Array& empty_array = Array::Handle(Array::Empty()); |
14 const String& class_name = String::Handle(String::NewSymbol(name)); | 14 const String& class_name = String::Handle(String::NewSymbol(name)); |
15 const Script& script = Script::Handle(); | 15 const Script& script = Script::Handle(); |
16 const Class& cls = Class::Handle(Class::New(class_name, script)); | 16 const Class& cls = |
| 17 Class::Handle(Class::New(class_name, script, Scanner::kDummyTokenIndex)); |
17 cls.set_interfaces(empty_array); | 18 cls.set_interfaces(empty_array); |
18 cls.SetFunctions(empty_array); | 19 cls.SetFunctions(empty_array); |
19 cls.SetFields(empty_array); | 20 cls.SetFields(empty_array); |
20 return cls.raw(); | 21 return cls.raw(); |
21 } | 22 } |
22 | 23 |
23 | 24 |
24 TEST_CASE(ClassFinalizer) { | 25 TEST_CASE(ClassFinalizer) { |
25 GrowableArray<const Class*> classes_1; | 26 GrowableArray<const Class*> classes_1; |
26 classes_1.Add(&Class::ZoneHandle(CreateTestClass("BMW"))); | 27 classes_1.Add(&Class::ZoneHandle(CreateTestClass("BMW"))); |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 GrowableArray<const Class*> classes; | 67 GrowableArray<const Class*> classes; |
67 Class& rhb = Class::ZoneHandle(CreateTestClass("RhB")); | 68 Class& rhb = Class::ZoneHandle(CreateTestClass("RhB")); |
68 Class& sbb = Class::ZoneHandle(CreateTestClass("SBB")); | 69 Class& sbb = Class::ZoneHandle(CreateTestClass("SBB")); |
69 Library& lib = Library::Handle(NewLib("TestLib")); | 70 Library& lib = Library::Handle(NewLib("TestLib")); |
70 classes.Add(&rhb); | 71 classes.Add(&rhb); |
71 classes.Add(&sbb); | 72 classes.Add(&sbb); |
72 lib.AddClass(rhb); | 73 lib.AddClass(rhb); |
73 lib.AddClass(sbb); | 74 lib.AddClass(sbb); |
74 const String& superclass_name = String::Handle(sbb.Name()); | 75 const String& superclass_name = String::Handle(sbb.Name()); |
75 const UnresolvedClass& unresolved = UnresolvedClass::Handle( | 76 const UnresolvedClass& unresolved = UnresolvedClass::Handle( |
76 UnresolvedClass::New(0, LibraryPrefix::Handle(), superclass_name)); | 77 UnresolvedClass::New(LibraryPrefix::Handle(), |
| 78 superclass_name, |
| 79 Scanner::kDummyTokenIndex)); |
77 const TypeArguments& type_arguments = TypeArguments::Handle(); | 80 const TypeArguments& type_arguments = TypeArguments::Handle(); |
78 rhb.set_super_type(Type::Handle(Type::New( | 81 rhb.set_super_type(Type::Handle( |
79 Object::Handle(unresolved.raw()), type_arguments))); | 82 Type::New(Object::Handle(unresolved.raw()), |
| 83 type_arguments, |
| 84 Scanner::kDummyTokenIndex))); |
80 ClassFinalizer::AddPendingClasses(classes); | 85 ClassFinalizer::AddPendingClasses(classes); |
81 EXPECT(ClassFinalizer::FinalizePendingClasses()); | 86 EXPECT(ClassFinalizer::FinalizePendingClasses()); |
82 } | 87 } |
83 | 88 |
84 } // namespace dart | 89 } // namespace dart |
OLD | NEW |