| 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 15 matching lines...) Expand all Loading... |
| 26 " foo() { }" | 26 " foo() { }" |
| 27 " bar() { }" | 27 " bar() { }" |
| 28 "}\n"; | 28 "}\n"; |
| 29 | 29 |
| 30 TestCase::LoadTestScript(kScriptChars, NULL); | 30 TestCase::LoadTestScript(kScriptChars, NULL); |
| 31 EXPECT(ClassFinalizer::FinalizePendingClasses()); | 31 EXPECT(ClassFinalizer::FinalizePendingClasses()); |
| 32 const String& name = String::Handle(String::New(TestCase::url())); | 32 const String& name = String::Handle(String::New(TestCase::url())); |
| 33 const Library& lib = Library::Handle(Library::LookupLibrary(name)); | 33 const Library& lib = Library::Handle(Library::LookupLibrary(name)); |
| 34 EXPECT(!lib.IsNull()); | 34 EXPECT(!lib.IsNull()); |
| 35 | 35 |
| 36 String& ambiguity_error_msg = String::Handle(); | |
| 37 const Class& class_a = Class::Handle( | 36 const Class& class_a = Class::Handle( |
| 38 lib.LookupClass(String::Handle(Symbols::New("A")), &ambiguity_error_msg)); | 37 lib.LookupClass(String::Handle(Symbols::New("A")))); |
| 39 EXPECT(!class_a.IsNull()); | 38 EXPECT(!class_a.IsNull()); |
| 40 const intptr_t class_a_id = class_a.id(); | 39 const intptr_t class_a_id = class_a.id(); |
| 41 | 40 |
| 42 const Class& class_b = Class::Handle( | 41 const Class& class_b = Class::Handle( |
| 43 lib.LookupClass(String::Handle(Symbols::New("B")), &ambiguity_error_msg)); | 42 lib.LookupClass(String::Handle(Symbols::New("B")))); |
| 44 EXPECT(!class_b.IsNull()); | 43 EXPECT(!class_b.IsNull()); |
| 45 const intptr_t class_b_id = class_b.id(); | 44 const intptr_t class_b_id = class_b.id(); |
| 46 | 45 |
| 47 const Class& class_c = Class::Handle( | 46 const Class& class_c = Class::Handle( |
| 48 lib.LookupClass(String::Handle(Symbols::New("C")), &ambiguity_error_msg)); | 47 lib.LookupClass(String::Handle(Symbols::New("C")))); |
| 49 EXPECT(!class_c.IsNull()); | 48 EXPECT(!class_c.IsNull()); |
| 50 const intptr_t class_c_id = class_c.id(); | 49 const intptr_t class_c_id = class_c.id(); |
| 51 | 50 |
| 52 const Class& class_d = Class::Handle( | 51 const Class& class_d = Class::Handle( |
| 53 lib.LookupClass(String::Handle(Symbols::New("D")), &ambiguity_error_msg)); | 52 lib.LookupClass(String::Handle(Symbols::New("D")))); |
| 54 EXPECT(!class_d.IsNull()); | 53 EXPECT(!class_d.IsNull()); |
| 55 const intptr_t class_d_id = class_d.id(); | 54 const intptr_t class_d_id = class_d.id(); |
| 56 | 55 |
| 57 const String& function_foo_name = String::Handle(String::New("foo")); | 56 const String& function_foo_name = String::Handle(String::New("foo")); |
| 58 const String& function_bar_name = String::Handle(String::New("bar")); | 57 const String& function_bar_name = String::Handle(String::New("bar")); |
| 59 | 58 |
| 60 const Function& class_a_foo = | 59 const Function& class_a_foo = |
| 61 Function::Handle(class_a.LookupDynamicFunction(function_foo_name)); | 60 Function::Handle(class_a.LookupDynamicFunction(function_foo_name)); |
| 62 EXPECT(!class_a_foo.IsNull()); | 61 EXPECT(!class_a_foo.IsNull()); |
| 63 | 62 |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 EXPECT(!CHA::HasSubclasses(kNullCid)); | 120 EXPECT(!CHA::HasSubclasses(kNullCid)); |
| 122 EXPECT(!CHA::HasSubclasses(kDynamicCid)); | 121 EXPECT(!CHA::HasSubclasses(kDynamicCid)); |
| 123 EXPECT(!CHA::HasSubclasses(kVoidCid)); | 122 EXPECT(!CHA::HasSubclasses(kVoidCid)); |
| 124 EXPECT(CHA::HasSubclasses(class_a_id)); | 123 EXPECT(CHA::HasSubclasses(class_a_id)); |
| 125 EXPECT(CHA::HasSubclasses(class_b_id)); | 124 EXPECT(CHA::HasSubclasses(class_b_id)); |
| 126 EXPECT(!CHA::HasSubclasses(class_c_id)); | 125 EXPECT(!CHA::HasSubclasses(class_c_id)); |
| 127 EXPECT(!CHA::HasSubclasses(class_d_id)); | 126 EXPECT(!CHA::HasSubclasses(class_d_id)); |
| 128 } | 127 } |
| 129 | 128 |
| 130 } // namespace dart | 129 } // namespace dart |
| OLD | NEW |