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/dart_api_impl.h" | 8 #include "vm/dart_api_impl.h" |
9 #include "vm/object.h" | 9 #include "vm/object.h" |
10 #include "vm/symbols.h" | 10 #include "vm/symbols.h" |
(...skipping 24 matching lines...) Expand all Loading... |
35 " // A.foo();\n" | 35 " // A.foo();\n" |
36 " }\n" | 36 " }\n" |
37 "}\n"; | 37 "}\n"; |
38 String& url = String::Handle(String::New("dart-test:CompileFunction")); | 38 String& url = String::Handle(String::New("dart-test:CompileFunction")); |
39 String& source = String::Handle(String::New(kScriptChars)); | 39 String& source = String::Handle(String::New(kScriptChars)); |
40 Script& script = Script::Handle(Script::New(url, | 40 Script& script = Script::Handle(Script::New(url, |
41 source, | 41 source, |
42 RawScript::kScriptTag)); | 42 RawScript::kScriptTag)); |
43 Library& lib = Library::Handle(Library::CoreLibrary()); | 43 Library& lib = Library::Handle(Library::CoreLibrary()); |
44 EXPECT(CompilerTest::TestCompileScript(lib, script)); | 44 EXPECT(CompilerTest::TestCompileScript(lib, script)); |
45 EXPECT(ClassFinalizer::FinalizeTypeHierarchy()); | 45 EXPECT(ClassFinalizer::ProcessPendingClasses()); |
46 Class& cls = Class::Handle( | 46 Class& cls = Class::Handle( |
47 lib.LookupClass(String::Handle(Symbols::New("A")))); | 47 lib.LookupClass(String::Handle(Symbols::New("A")))); |
48 EXPECT(!cls.IsNull()); | 48 EXPECT(!cls.IsNull()); |
49 String& function_foo_name = String::Handle(String::New("foo")); | 49 String& function_foo_name = String::Handle(String::New("foo")); |
50 Function& function_foo = | 50 Function& function_foo = |
51 Function::Handle(cls.LookupStaticFunction(function_foo_name)); | 51 Function::Handle(cls.LookupStaticFunction(function_foo_name)); |
52 EXPECT(!function_foo.IsNull()); | 52 EXPECT(!function_foo.IsNull()); |
53 String& function_source = String::Handle(function_foo.GetSource()); | 53 String& function_source = String::Handle(function_foo.GetSource()); |
54 EXPECT_STREQ("static foo() { return 42; }\n ", function_source.ToCString()); | 54 EXPECT_STREQ("static foo() { return 42; }\n ", function_source.ToCString()); |
55 EXPECT(CompilerTest::TestCompileFunction(function_foo)); | 55 EXPECT(CompilerTest::TestCompileFunction(function_foo)); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 expr_text = String::New("apa + ' ${calc(10)}' + dot"); | 91 expr_text = String::New("apa + ' ${calc(10)}' + dot"); |
92 Object& val = Object::Handle(); | 92 Object& val = Object::Handle(); |
93 val = Instance::Cast(obj).Evaluate(expr_text); | 93 val = Instance::Cast(obj).Evaluate(expr_text); |
94 EXPECT(!val.IsNull()); | 94 EXPECT(!val.IsNull()); |
95 EXPECT(!val.IsError()); | 95 EXPECT(!val.IsError()); |
96 EXPECT(val.IsString()); | 96 EXPECT(val.IsString()); |
97 EXPECT_STREQ("Herr Nilsson 100.", val.ToCString()); | 97 EXPECT_STREQ("Herr Nilsson 100.", val.ToCString()); |
98 } | 98 } |
99 | 99 |
100 } // namespace dart | 100 } // namespace dart |
OLD | NEW |