| 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 { |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 pending_classes.Add(*classes_2[1]); | 41 pending_classes.Add(*classes_2[1]); |
| 42 classes_2.Add(&Class::ZoneHandle(CreateTestClass("Alfa"))); | 42 classes_2.Add(&Class::ZoneHandle(CreateTestClass("Alfa"))); |
| 43 pending_classes.Add(*classes_2[2]); | 43 pending_classes.Add(*classes_2[2]); |
| 44 EXPECT(ClassFinalizer::FinalizePendingClasses()); | 44 EXPECT(ClassFinalizer::FinalizePendingClasses()); |
| 45 for (int i = 0; i < classes_1.length(); i++) { | 45 for (int i = 0; i < classes_1.length(); i++) { |
| 46 EXPECT(classes_1[i]->is_finalized()); | 46 EXPECT(classes_1[i]->is_finalized()); |
| 47 } | 47 } |
| 48 for (int i = 0; i < classes_2.length(); i++) { | 48 for (int i = 0; i < classes_2.length(); i++) { |
| 49 EXPECT(classes_2[i]->is_finalized()); | 49 EXPECT(classes_2[i]->is_finalized()); |
| 50 } | 50 } |
| 51 EXPECT(ClassFinalizer::AllClassesFinalized()); |
| 51 EXPECT(ClassFinalizer::FinalizePendingClasses()); | 52 EXPECT(ClassFinalizer::FinalizePendingClasses()); |
| 52 } | 53 } |
| 53 | 54 |
| 54 | 55 |
| 55 TEST_CASE(ClassFinalize_Cycles) { | 56 TEST_CASE(ClassFinalize_Cycles) { |
| 56 Isolate* isolate = Isolate::Current(); | 57 Isolate* isolate = Isolate::Current(); |
| 57 ObjectStore* object_store = isolate->object_store(); | 58 ObjectStore* object_store = isolate->object_store(); |
| 58 const GrowableObjectArray& pending_classes = | 59 const GrowableObjectArray& pending_classes = |
| 59 GrowableObjectArray::Handle(isolate, object_store->pending_classes()); | 60 GrowableObjectArray::Handle(isolate, object_store->pending_classes()); |
| 60 GrowableArray<const Class*> classes; | 61 GrowableArray<const Class*> classes; |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 Scanner::kDummyTokenIndex)); | 97 Scanner::kDummyTokenIndex)); |
| 97 const TypeArguments& type_arguments = TypeArguments::Handle(); | 98 const TypeArguments& type_arguments = TypeArguments::Handle(); |
| 98 rhb.set_super_type(Type::Handle( | 99 rhb.set_super_type(Type::Handle( |
| 99 Type::New(Object::Handle(unresolved.raw()), | 100 Type::New(Object::Handle(unresolved.raw()), |
| 100 type_arguments, | 101 type_arguments, |
| 101 Scanner::kDummyTokenIndex))); | 102 Scanner::kDummyTokenIndex))); |
| 102 EXPECT(ClassFinalizer::FinalizePendingClasses()); | 103 EXPECT(ClassFinalizer::FinalizePendingClasses()); |
| 103 } | 104 } |
| 104 | 105 |
| 105 } // namespace dart | 106 } // namespace dart |
| OLD | NEW |