| 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/cha.h" | 6 #include "vm/cha.h" |
| 7 #include "vm/class_finalizer.h" | 7 #include "vm/class_finalizer.h" |
| 8 #include "vm/globals.h" | 8 #include "vm/globals.h" |
| 9 #include "vm/symbols.h" | 9 #include "vm/symbols.h" |
| 10 #include "vm/unit_test.h" | 10 #include "vm/unit_test.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 " foo() { }" | 27 " foo() { }" |
| 28 " bar() { }" | 28 " bar() { }" |
| 29 "}\n"; | 29 "}\n"; |
| 30 | 30 |
| 31 TestCase::LoadTestScript(kScriptChars, NULL); | 31 TestCase::LoadTestScript(kScriptChars, NULL); |
| 32 EXPECT(ClassFinalizer::ProcessPendingClasses()); | 32 EXPECT(ClassFinalizer::ProcessPendingClasses()); |
| 33 const String& name = String::Handle(String::New(TestCase::url())); | 33 const String& name = String::Handle(String::New(TestCase::url())); |
| 34 const Library& lib = Library::Handle(Library::LookupLibrary(thread, name)); | 34 const Library& lib = Library::Handle(Library::LookupLibrary(thread, name)); |
| 35 EXPECT(!lib.IsNull()); | 35 EXPECT(!lib.IsNull()); |
| 36 | 36 |
| 37 const Class& class_a = Class::Handle( | 37 const Class& class_a = |
| 38 lib.LookupClass(String::Handle(Symbols::New(thread, "A")))); | 38 Class::Handle(lib.LookupClass(String::Handle(Symbols::New(thread, "A")))); |
| 39 EXPECT(!class_a.IsNull()); | 39 EXPECT(!class_a.IsNull()); |
| 40 | 40 |
| 41 const Class& class_b = Class::Handle( | 41 const Class& class_b = |
| 42 lib.LookupClass(String::Handle(Symbols::New(thread, "B")))); | 42 Class::Handle(lib.LookupClass(String::Handle(Symbols::New(thread, "B")))); |
| 43 EXPECT(!class_b.IsNull()); | 43 EXPECT(!class_b.IsNull()); |
| 44 | 44 |
| 45 const Class& class_c = Class::Handle( | 45 const Class& class_c = |
| 46 lib.LookupClass(String::Handle(Symbols::New(thread, "C")))); | 46 Class::Handle(lib.LookupClass(String::Handle(Symbols::New(thread, "C")))); |
| 47 EXPECT(!class_c.IsNull()); | 47 EXPECT(!class_c.IsNull()); |
| 48 | 48 |
| 49 const Class& class_d = Class::Handle( | 49 const Class& class_d = |
| 50 lib.LookupClass(String::Handle(Symbols::New(thread, "D")))); | 50 Class::Handle(lib.LookupClass(String::Handle(Symbols::New(thread, "D")))); |
| 51 EXPECT(!class_d.IsNull()); | 51 EXPECT(!class_d.IsNull()); |
| 52 | 52 |
| 53 const String& function_foo_name = String::Handle(String::New("foo")); | 53 const String& function_foo_name = String::Handle(String::New("foo")); |
| 54 const String& function_bar_name = String::Handle(String::New("bar")); | 54 const String& function_bar_name = String::Handle(String::New("bar")); |
| 55 | 55 |
| 56 const Function& class_a_foo = | 56 const Function& class_a_foo = |
| 57 Function::Handle(class_a.LookupDynamicFunction(function_foo_name)); | 57 Function::Handle(class_a.LookupDynamicFunction(function_foo_name)); |
| 58 EXPECT(!class_a_foo.IsNull()); | 58 EXPECT(!class_a_foo.IsNull()); |
| 59 | 59 |
| 60 const Function& class_a_bar = | 60 const Function& class_a_bar = |
| (...skipping 29 matching lines...) Expand all Loading... |
| 90 EXPECT(!cha.IsGuardedClass(class_b.id())); | 90 EXPECT(!cha.IsGuardedClass(class_b.id())); |
| 91 EXPECT(cha.IsGuardedClass(class_c.id())); | 91 EXPECT(cha.IsGuardedClass(class_c.id())); |
| 92 EXPECT(cha.IsGuardedClass(class_d.id())); | 92 EXPECT(cha.IsGuardedClass(class_d.id())); |
| 93 | 93 |
| 94 const Class& closure_class = | 94 const Class& closure_class = |
| 95 Class::Handle(Isolate::Current()->object_store()->closure_class()); | 95 Class::Handle(Isolate::Current()->object_store()->closure_class()); |
| 96 EXPECT(!cha.HasSubclasses(closure_class.id())); | 96 EXPECT(!cha.HasSubclasses(closure_class.id())); |
| 97 } | 97 } |
| 98 | 98 |
| 99 } // namespace dart | 99 } // namespace dart |
| OLD | NEW |