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 Array& empty_array = Array::Handle(Object::empty_array()); | |
15 const String& class_name = String::Handle(Symbols::New(name)); | 14 const String& class_name = String::Handle(Symbols::New(name)); |
16 const Script& script = Script::Handle(); | 15 const Script& script = Script::Handle(); |
17 const Class& cls = | 16 const Class& cls = |
18 Class::Handle(Class::New(class_name, script, Scanner::kDummyTokenIndex)); | 17 Class::Handle(Class::New(class_name, script, Scanner::kDummyTokenIndex)); |
19 cls.set_interfaces(empty_array); | 18 cls.set_interfaces(Object::empty_array()); |
20 cls.SetFunctions(empty_array); | 19 cls.SetFunctions(Object::empty_array()); |
21 cls.SetFields(empty_array); | 20 cls.SetFields(Object::empty_array()); |
22 return cls.raw(); | 21 return cls.raw(); |
23 } | 22 } |
24 | 23 |
25 | 24 |
26 TEST_CASE(ClassFinalizer) { | 25 TEST_CASE(ClassFinalizer) { |
27 Isolate* isolate = Isolate::Current(); | 26 Isolate* isolate = Isolate::Current(); |
28 ObjectStore* object_store = isolate->object_store(); | 27 ObjectStore* object_store = isolate->object_store(); |
29 const GrowableObjectArray& pending_classes = | 28 const GrowableObjectArray& pending_classes = |
30 GrowableObjectArray::Handle(isolate, object_store->pending_classes()); | 29 GrowableObjectArray::Handle(isolate, object_store->pending_classes()); |
31 GrowableArray<const Class*> classes_1; | 30 GrowableArray<const Class*> classes_1; |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 Scanner::kDummyTokenIndex)); | 96 Scanner::kDummyTokenIndex)); |
98 const TypeArguments& type_arguments = TypeArguments::Handle(); | 97 const TypeArguments& type_arguments = TypeArguments::Handle(); |
99 rhb.set_super_type(Type::Handle( | 98 rhb.set_super_type(Type::Handle( |
100 Type::New(Object::Handle(unresolved.raw()), | 99 Type::New(Object::Handle(unresolved.raw()), |
101 type_arguments, | 100 type_arguments, |
102 Scanner::kDummyTokenIndex))); | 101 Scanner::kDummyTokenIndex))); |
103 EXPECT(ClassFinalizer::FinalizePendingClasses()); | 102 EXPECT(ClassFinalizer::FinalizePendingClasses()); |
104 } | 103 } |
105 | 104 |
106 } // namespace dart | 105 } // namespace dart |
OLD | NEW |