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/class_finalizer.h" | 6 #include "vm/class_finalizer.h" |
7 #include "vm/compiler.h" | 7 #include "vm/compiler.h" |
8 #include "vm/object.h" | 8 #include "vm/object.h" |
9 #include "vm/symbols.h" | 9 #include "vm/symbols.h" |
10 #include "vm/unit_test.h" | 10 #include "vm/unit_test.h" |
(...skipping 26 matching lines...) Expand all Loading... |
37 " // A.foo();\n" | 37 " // A.foo();\n" |
38 " }\n" | 38 " }\n" |
39 "}\n"; | 39 "}\n"; |
40 String& url = String::Handle(String::New("dart-test:CompileFunction")); | 40 String& url = String::Handle(String::New("dart-test:CompileFunction")); |
41 String& source = String::Handle(String::New(kScriptChars)); | 41 String& source = String::Handle(String::New(kScriptChars)); |
42 Script& script = Script::Handle(Script::New(url, | 42 Script& script = Script::Handle(Script::New(url, |
43 source, | 43 source, |
44 RawScript::kSourceTag)); | 44 RawScript::kSourceTag)); |
45 Library& lib = Library::Handle(Library::CoreLibrary()); | 45 Library& lib = Library::Handle(Library::CoreLibrary()); |
46 EXPECT(CompilerTest::TestCompileScript(lib, script)); | 46 EXPECT(CompilerTest::TestCompileScript(lib, script)); |
47 EXPECT(ClassFinalizer::FinalizePendingClasses()); | 47 EXPECT(ClassFinalizer::FinalizeAllClasses()); |
48 Class& cls = Class::Handle( | 48 Class& cls = Class::Handle( |
49 lib.LookupClass(String::Handle(Symbols::New("A")))); | 49 lib.LookupClass(String::Handle(Symbols::New("A")))); |
50 EXPECT(!cls.IsNull()); | 50 EXPECT(!cls.IsNull()); |
51 String& function_foo_name = String::Handle(String::New("foo")); | 51 String& function_foo_name = String::Handle(String::New("foo")); |
52 Function& function_foo = | 52 Function& function_foo = |
53 Function::Handle(cls.LookupStaticFunction(function_foo_name)); | 53 Function::Handle(cls.LookupStaticFunction(function_foo_name)); |
54 EXPECT(!function_foo.IsNull()); | 54 EXPECT(!function_foo.IsNull()); |
55 | 55 |
56 EXPECT(CompilerTest::TestCompileFunction(function_foo)); | 56 EXPECT(CompilerTest::TestCompileFunction(function_foo)); |
57 EXPECT(function_foo.HasCode()); | 57 EXPECT(function_foo.HasCode()); |
58 | 58 |
59 String& function_moo_name = String::Handle(String::New("moo")); | 59 String& function_moo_name = String::Handle(String::New("moo")); |
60 Function& function_moo = | 60 Function& function_moo = |
61 Function::Handle(cls.LookupStaticFunction(function_moo_name)); | 61 Function::Handle(cls.LookupStaticFunction(function_moo_name)); |
62 EXPECT(!function_moo.IsNull()); | 62 EXPECT(!function_moo.IsNull()); |
63 | 63 |
64 EXPECT(CompilerTest::TestCompileFunction(function_moo)); | 64 EXPECT(CompilerTest::TestCompileFunction(function_moo)); |
65 EXPECT(function_moo.HasCode()); | 65 EXPECT(function_moo.HasCode()); |
66 } | 66 } |
67 | 67 |
68 #endif // TARGET_ARCH_IA32 || TARGET_ARCH_X64 | 68 #endif // TARGET_ARCH_IA32 || TARGET_ARCH_X64 |
69 | 69 |
70 } // namespace dart | 70 } // namespace dart |
OLD | NEW |