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::kNoSourcePos)); | 17 Class::Handle(Class::New(class_name, script, Token::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 Zone* zone = thread->zone(); | 26 Zone* zone = thread->zone(); |
27 Isolate* isolate = thread->isolate(); | 27 Isolate* isolate = thread->isolate(); |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 pending_classes.Add(rhb); | 89 pending_classes.Add(rhb); |
90 Class& sbb = Class::Handle(CreateTestClass("SBB")); | 90 Class& sbb = Class::Handle(CreateTestClass("SBB")); |
91 pending_classes.Add(sbb); | 91 pending_classes.Add(sbb); |
92 Library& lib = Library::Handle(NewLib("TestLib")); | 92 Library& lib = Library::Handle(NewLib("TestLib")); |
93 lib.AddClass(rhb); | 93 lib.AddClass(rhb); |
94 lib.AddClass(sbb); | 94 lib.AddClass(sbb); |
95 const String& superclass_name = String::Handle(sbb.Name()); | 95 const String& superclass_name = String::Handle(sbb.Name()); |
96 const UnresolvedClass& unresolved = UnresolvedClass::Handle( | 96 const UnresolvedClass& unresolved = UnresolvedClass::Handle( |
97 UnresolvedClass::New(LibraryPrefix::Handle(), | 97 UnresolvedClass::New(LibraryPrefix::Handle(), |
98 superclass_name, | 98 superclass_name, |
99 Scanner::kNoSourcePos)); | 99 Token::kNoSourcePos)); |
100 const TypeArguments& type_arguments = TypeArguments::Handle(); | 100 const TypeArguments& type_arguments = TypeArguments::Handle(); |
101 rhb.set_super_type(Type::Handle( | 101 rhb.set_super_type(Type::Handle( |
102 Type::New(Object::Handle(unresolved.raw()), | 102 Type::New(Object::Handle(unresolved.raw()), |
103 type_arguments, | 103 type_arguments, |
104 Scanner::kNoSourcePos))); | 104 Token::kNoSourcePos))); |
105 EXPECT(ClassFinalizer::ProcessPendingClasses()); | 105 EXPECT(ClassFinalizer::ProcessPendingClasses()); |
106 } | 106 } |
107 | 107 |
108 } // namespace dart | 108 } // namespace dart |
OLD | NEW |