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/assembler.h" | 6 #include "vm/assembler.h" |
7 #include "vm/class_finalizer.h" | 7 #include "vm/class_finalizer.h" |
8 #include "vm/compiler.h" | 8 #include "vm/compiler.h" |
9 #include "vm/dart_entry.h" | 9 #include "vm/dart_entry.h" |
10 #include "vm/object.h" | 10 #include "vm/object.h" |
11 #include "vm/resolver.h" | 11 #include "vm/resolver.h" |
| 12 #include "vm/symbols.h" |
12 #include "vm/unit_test.h" | 13 #include "vm/unit_test.h" |
13 | 14 |
14 namespace dart { | 15 namespace dart { |
15 | 16 |
16 // Only ia32 and x64 can run execution tests. | 17 // Only ia32 and x64 can run execution tests. |
17 #if defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64) | 18 #if defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64) |
18 | 19 |
19 // Setup function for invocation. | 20 // Setup function for invocation. |
20 static void SetupFunction(const char* test_library_name, | 21 static void SetupFunction(const char* test_library_name, |
21 const char* test_class_name, | 22 const char* test_class_name, |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 SetupInstanceFunction(test_library_name, | 160 SetupInstanceFunction(test_library_name, |
160 test_class_name, | 161 test_class_name, |
161 test_function_name); | 162 test_function_name); |
162 | 163 |
163 // Now create an instance object of the class and try to | 164 // Now create an instance object of the class and try to |
164 // resolve a function in it. | 165 // resolve a function in it. |
165 const String& lib_name = String::Handle(String::New(test_library_name)); | 166 const String& lib_name = String::Handle(String::New(test_library_name)); |
166 const Library& lib = Library::Handle(Library::LookupLibrary(lib_name)); | 167 const Library& lib = Library::Handle(Library::LookupLibrary(lib_name)); |
167 ASSERT(!lib.IsNull()); | 168 ASSERT(!lib.IsNull()); |
168 const Class& cls = Class::Handle(lib.LookupClass( | 169 const Class& cls = Class::Handle(lib.LookupClass( |
169 String::Handle(String::NewSymbol(test_class_name)))); | 170 String::Handle(Symbols::New(test_class_name)))); |
170 EXPECT(!cls.IsNull()); | 171 EXPECT(!cls.IsNull()); |
171 | 172 |
172 Instance& receiver = Instance::Handle(Instance::New(cls)); | 173 Instance& receiver = Instance::Handle(Instance::New(cls)); |
173 const String& function_name = String::Handle(String::New(test_function_name)); | 174 const String& function_name = String::Handle(String::New(test_function_name)); |
174 | 175 |
175 // Now try to resolve and invoke the instance function in this class. | 176 // Now try to resolve and invoke the instance function in this class. |
176 { | 177 { |
177 const int kNumPositionalArguments = 3; | 178 const int kNumPositionalArguments = 3; |
178 const int kNumNamedArguments = 0; | 179 const int kNumNamedArguments = 0; |
179 const Function& function = Function::Handle( | 180 const Function& function = Function::Handle( |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 super_function_name, | 220 super_function_name, |
220 kNumPositionalArguments, | 221 kNumPositionalArguments, |
221 kNumNamedArguments)); | 222 kNumNamedArguments)); |
222 EXPECT(!super_function.IsNull()); | 223 EXPECT(!super_function.IsNull()); |
223 } | 224 } |
224 } | 225 } |
225 | 226 |
226 #endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64). | 227 #endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64). |
227 | 228 |
228 } // namespace dart | 229 } // namespace dart |
OLD | NEW |