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