| 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 24 matching lines...) Expand all Loading... |
| 35 " }\n" | 35 " }\n" |
| 36 "}\n"; | 36 "}\n"; |
| 37 String& url = String::Handle(String::New("dart-test:CompileFunction")); | 37 String& url = String::Handle(String::New("dart-test:CompileFunction")); |
| 38 String& source = String::Handle(String::New(kScriptChars)); | 38 String& source = String::Handle(String::New(kScriptChars)); |
| 39 Script& script = Script::Handle(Script::New(url, | 39 Script& script = Script::Handle(Script::New(url, |
| 40 source, | 40 source, |
| 41 RawScript::kScriptTag)); | 41 RawScript::kScriptTag)); |
| 42 Library& lib = Library::Handle(Library::CoreLibrary()); | 42 Library& lib = Library::Handle(Library::CoreLibrary()); |
| 43 EXPECT(CompilerTest::TestCompileScript(lib, script)); | 43 EXPECT(CompilerTest::TestCompileScript(lib, script)); |
| 44 EXPECT(ClassFinalizer::FinalizePendingClasses()); | 44 EXPECT(ClassFinalizer::FinalizePendingClasses()); |
| 45 String& ambiguity_error_msg = String::Handle(); |
| 45 Class& cls = Class::Handle( | 46 Class& cls = Class::Handle( |
| 46 lib.LookupClass(String::Handle(Symbols::New("A")))); | 47 lib.LookupClass(String::Handle(Symbols::New("A")), &ambiguity_error_msg)); |
| 47 EXPECT(!cls.IsNull()); | 48 EXPECT(!cls.IsNull()); // No ambiguity error expected. |
| 48 String& function_foo_name = String::Handle(String::New("foo")); | 49 String& function_foo_name = String::Handle(String::New("foo")); |
| 49 Function& function_foo = | 50 Function& function_foo = |
| 50 Function::Handle(cls.LookupStaticFunction(function_foo_name)); | 51 Function::Handle(cls.LookupStaticFunction(function_foo_name)); |
| 51 EXPECT(!function_foo.IsNull()); | 52 EXPECT(!function_foo.IsNull()); |
| 52 | 53 |
| 53 EXPECT(CompilerTest::TestCompileFunction(function_foo)); | 54 EXPECT(CompilerTest::TestCompileFunction(function_foo)); |
| 54 EXPECT(function_foo.HasCode()); | 55 EXPECT(function_foo.HasCode()); |
| 55 | 56 |
| 56 String& function_moo_name = String::Handle(String::New("moo")); | 57 String& function_moo_name = String::Handle(String::New("moo")); |
| 57 Function& function_moo = | 58 Function& function_moo = |
| 58 Function::Handle(cls.LookupStaticFunction(function_moo_name)); | 59 Function::Handle(cls.LookupStaticFunction(function_moo_name)); |
| 59 EXPECT(!function_moo.IsNull()); | 60 EXPECT(!function_moo.IsNull()); |
| 60 | 61 |
| 61 EXPECT(CompilerTest::TestCompileFunction(function_moo)); | 62 EXPECT(CompilerTest::TestCompileFunction(function_moo)); |
| 62 EXPECT(function_moo.HasCode()); | 63 EXPECT(function_moo.HasCode()); |
| 63 } | 64 } |
| 64 | 65 |
| 65 } // namespace dart | 66 } // namespace dart |
| OLD | NEW |