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(Thread::Current(), |
| 15 name)); |
15 const Script& script = Script::Handle(); | 16 const Script& script = Script::Handle(); |
16 const Class& cls = Class::Handle( | 17 const Class& cls = Class::Handle( |
17 Class::New(class_name, script, TokenPosition::kNoSource)); | 18 Class::New(class_name, script, TokenPosition::kNoSource)); |
18 cls.set_interfaces(Object::empty_array()); | 19 cls.set_interfaces(Object::empty_array()); |
19 cls.SetFunctions(Object::empty_array()); | 20 cls.SetFunctions(Object::empty_array()); |
20 cls.SetFields(Object::empty_array()); | 21 cls.SetFields(Object::empty_array()); |
21 return cls.raw(); | 22 return cls.raw(); |
22 } | 23 } |
23 | 24 |
24 | 25 |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 // Create a cycle. | 68 // Create a cycle. |
68 classes[0]->set_super_type( | 69 classes[0]->set_super_type( |
69 Type::Handle(Type::NewNonParameterizedType(*classes[1]))); | 70 Type::Handle(Type::NewNonParameterizedType(*classes[1]))); |
70 classes[1]->set_super_type( | 71 classes[1]->set_super_type( |
71 Type::Handle(Type::NewNonParameterizedType(*classes[0]))); | 72 Type::Handle(Type::NewNonParameterizedType(*classes[0]))); |
72 EXPECT(!ClassFinalizer::ProcessPendingClasses()); | 73 EXPECT(!ClassFinalizer::ProcessPendingClasses()); |
73 } | 74 } |
74 | 75 |
75 | 76 |
76 static RawLibrary* NewLib(const char* url_chars) { | 77 static RawLibrary* NewLib(const char* url_chars) { |
77 String& url = String::ZoneHandle(Symbols::New(url_chars)); | 78 String& url = String::ZoneHandle(Symbols::New(Thread::Current(), url_chars)); |
78 return Library::New(url); | 79 return Library::New(url); |
79 } | 80 } |
80 | 81 |
81 | 82 |
82 TEST_CASE(ClassFinalize_Resolve) { | 83 TEST_CASE(ClassFinalize_Resolve) { |
83 Zone* zone = thread->zone(); | 84 Zone* zone = thread->zone(); |
84 Isolate* isolate = thread->isolate(); | 85 Isolate* isolate = thread->isolate(); |
85 ObjectStore* object_store = isolate->object_store(); | 86 ObjectStore* object_store = isolate->object_store(); |
86 const GrowableObjectArray& pending_classes = | 87 const GrowableObjectArray& pending_classes = |
87 GrowableObjectArray::Handle(zone, object_store->pending_classes()); | 88 GrowableObjectArray::Handle(zone, object_store->pending_classes()); |
(...skipping 11 matching lines...) Expand all Loading... |
99 TokenPosition::kNoSource)); | 100 TokenPosition::kNoSource)); |
100 const TypeArguments& type_arguments = TypeArguments::Handle(); | 101 const TypeArguments& type_arguments = TypeArguments::Handle(); |
101 rhb.set_super_type(Type::Handle( | 102 rhb.set_super_type(Type::Handle( |
102 Type::New(Object::Handle(unresolved.raw()), | 103 Type::New(Object::Handle(unresolved.raw()), |
103 type_arguments, | 104 type_arguments, |
104 TokenPosition::kNoSource))); | 105 TokenPosition::kNoSource))); |
105 EXPECT(ClassFinalizer::ProcessPendingClasses()); | 106 EXPECT(ClassFinalizer::ProcessPendingClasses()); |
106 } | 107 } |
107 | 108 |
108 } // namespace dart | 109 } // namespace dart |
OLD | NEW |