| 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 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 SetupInstanceFunction(test_library_name, | 162 SetupInstanceFunction(test_library_name, |
| 162 test_class_name, | 163 test_class_name, |
| 163 test_function_name); | 164 test_function_name); |
| 164 | 165 |
| 165 // Now create an instance object of the class and try to | 166 // Now create an instance object of the class and try to |
| 166 // resolve a function in it. | 167 // resolve a function in it. |
| 167 const String& lib_name = String::Handle(String::New(test_library_name)); | 168 const String& lib_name = String::Handle(String::New(test_library_name)); |
| 168 const Library& lib = Library::Handle(Library::LookupLibrary(lib_name)); | 169 const Library& lib = Library::Handle(Library::LookupLibrary(lib_name)); |
| 169 ASSERT(!lib.IsNull()); | 170 ASSERT(!lib.IsNull()); |
| 170 const Class& cls = Class::Handle(lib.LookupClass( | 171 const Class& cls = Class::Handle(lib.LookupClass( |
| 171 String::Handle(String::NewSymbol(test_class_name)))); | 172 String::Handle(Symbols::New(test_class_name)))); |
| 172 EXPECT(!cls.IsNull()); | 173 EXPECT(!cls.IsNull()); |
| 173 | 174 |
| 174 Instance& receiver = Instance::Handle(Instance::New(cls)); | 175 Instance& receiver = Instance::Handle(Instance::New(cls)); |
| 175 const String& function_name = String::Handle(String::New(test_function_name)); | 176 const String& function_name = String::Handle(String::New(test_function_name)); |
| 176 | 177 |
| 177 // Now try to resolve and invoke the instance function in this class. | 178 // Now try to resolve and invoke the instance function in this class. |
| 178 { | 179 { |
| 179 const int kNumPositionalArguments = 3; | 180 const int kNumPositionalArguments = 3; |
| 180 const int kNumNamedArguments = 0; | 181 const int kNumNamedArguments = 0; |
| 181 const Function& function = Function::Handle( | 182 const Function& function = Function::Handle( |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 super_function_name, | 222 super_function_name, |
| 222 kNumPositionalArguments, | 223 kNumPositionalArguments, |
| 223 kNumNamedArguments)); | 224 kNumNamedArguments)); |
| 224 EXPECT(!super_function.IsNull()); | 225 EXPECT(!super_function.IsNull()); |
| 225 } | 226 } |
| 226 } | 227 } |
| 227 | 228 |
| 228 #endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64). | 229 #endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64). |
| 229 | 230 |
| 230 } // namespace dart | 231 } // namespace dart |
| OLD | NEW |