| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 "vm/globals.h" | 5 #include "vm/globals.h" |
| 6 #if defined(TARGET_ARCH_IA32) | 6 #if defined(TARGET_ARCH_IA32) |
| 7 | 7 |
| 8 #include "vm/code_generator.h" | 8 #include "vm/code_generator.h" |
| 9 | 9 |
| 10 #include "vm/ast.h" | 10 #include "vm/ast.h" |
| (...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 324 "class A {\n" | 324 "class A {\n" |
| 325 " A() {}\n" | 325 " A() {}\n" |
| 326 " int bar() { return 42; }\n" | 326 " int bar() { return 42; }\n" |
| 327 "}\n"; | 327 "}\n"; |
| 328 | 328 |
| 329 String& url = String::Handle(String::New("dart-test:CompileScript")); | 329 String& url = String::Handle(String::New("dart-test:CompileScript")); |
| 330 String& source = String::Handle(String::New(kScriptChars)); | 330 String& source = String::Handle(String::New(kScriptChars)); |
| 331 Script& script = Script::Handle(Script::New(url, source, RawScript::kSource)); | 331 Script& script = Script::Handle(Script::New(url, source, RawScript::kSource)); |
| 332 Library& lib = MakeTestLibrary("TestLib"); | 332 Library& lib = MakeTestLibrary("TestLib"); |
| 333 EXPECT(CompilerTest::TestCompileScript(lib, script)); | 333 EXPECT(CompilerTest::TestCompileScript(lib, script)); |
| 334 EXPECT(ClassFinalizer::FinalizeAllClasses()); | 334 EXPECT(ClassFinalizer::FinalizePendingClasses()); |
| 335 Class& cls = Class::ZoneHandle(LookupClass(lib, "A")); | 335 Class& cls = Class::ZoneHandle(LookupClass(lib, "A")); |
| 336 EXPECT(!cls.IsNull()); | 336 EXPECT(!cls.IsNull()); |
| 337 | 337 |
| 338 String& constructor_name = String::Handle(String::New("A.")); | 338 String& constructor_name = String::Handle(String::New("A.")); |
| 339 Function& constructor = | 339 Function& constructor = |
| 340 Function::ZoneHandle(cls.LookupConstructor(constructor_name)); | 340 Function::ZoneHandle(cls.LookupConstructor(constructor_name)); |
| 341 EXPECT(!constructor.IsNull()); | 341 EXPECT(!constructor.IsNull()); |
| 342 | 342 |
| 343 // The unit test creates an instance of class A and calls function 'bar'. | 343 // The unit test creates an instance of class A and calls function 'bar'. |
| 344 String& function_bar_name = String::ZoneHandle(String::NewSymbol("bar")); | 344 String& function_bar_name = String::ZoneHandle(String::NewSymbol("bar")); |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 460 "class A {\n" | 460 "class A {\n" |
| 461 " A() {}\n" | 461 " A() {}\n" |
| 462 " static bar() { return 42; }\n" | 462 " static bar() { return 42; }\n" |
| 463 "}\n"; | 463 "}\n"; |
| 464 | 464 |
| 465 String& url = String::Handle(String::New("dart-test:CompileScript")); | 465 String& url = String::Handle(String::New("dart-test:CompileScript")); |
| 466 String& source = String::Handle(String::New(kScriptChars)); | 466 String& source = String::Handle(String::New(kScriptChars)); |
| 467 Script& script = Script::Handle(Script::New(url, source, RawScript::kSource)); | 467 Script& script = Script::Handle(Script::New(url, source, RawScript::kSource)); |
| 468 Library& lib = MakeTestLibrary("TestLib"); | 468 Library& lib = MakeTestLibrary("TestLib"); |
| 469 EXPECT(CompilerTest::TestCompileScript(lib, script)); | 469 EXPECT(CompilerTest::TestCompileScript(lib, script)); |
| 470 EXPECT(ClassFinalizer::FinalizeAllClasses()); | 470 EXPECT(ClassFinalizer::FinalizePendingClasses()); |
| 471 Class& cls = Class::ZoneHandle(LookupClass(lib, "A")); | 471 Class& cls = Class::ZoneHandle(LookupClass(lib, "A")); |
| 472 EXPECT(!cls.IsNull()); | 472 EXPECT(!cls.IsNull()); |
| 473 | 473 |
| 474 String& constructor_name = String::Handle(String::New("A.")); | 474 String& constructor_name = String::Handle(String::New("A.")); |
| 475 Function& constructor = | 475 Function& constructor = |
| 476 Function::ZoneHandle(cls.LookupConstructor(constructor_name)); | 476 Function::ZoneHandle(cls.LookupConstructor(constructor_name)); |
| 477 EXPECT(!constructor.IsNull()); | 477 EXPECT(!constructor.IsNull()); |
| 478 | 478 |
| 479 const TypeArguments& no_type_arguments = TypeArguments::ZoneHandle(); | 479 const TypeArguments& no_type_arguments = TypeArguments::ZoneHandle(); |
| 480 ArgumentListNode* no_arguments = new ArgumentListNode(kPos); | 480 ArgumentListNode* no_arguments = new ArgumentListNode(kPos); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 491 const Library& app_lib = Library::Handle( | 491 const Library& app_lib = Library::Handle( |
| 492 Isolate::Current()->object_store()->registered_libraries()); | 492 Isolate::Current()->object_store()->registered_libraries()); |
| 493 const Class& cls = Class::Handle( | 493 const Class& cls = Class::Handle( |
| 494 app_lib.LookupClass(String::Handle(String::NewSymbol("A")))); | 494 app_lib.LookupClass(String::Handle(String::NewSymbol("A")))); |
| 495 EXPECT_EQ(cls.raw(), result.clazz()); | 495 EXPECT_EQ(cls.raw(), result.clazz()); |
| 496 } | 496 } |
| 497 | 497 |
| 498 } // namespace dart | 498 } // namespace dart |
| 499 | 499 |
| 500 #endif // defined TARGET_ARCH_IA32 | 500 #endif // defined TARGET_ARCH_IA32 |
| OLD | NEW |