| 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/globals.h" | 5 #include "platform/globals.h" |
| 6 | 6 |
| 7 #include "platform/assert.h" | 7 #include "platform/assert.h" |
| 8 #include "vm/assembler.h" | 8 #include "vm/assembler.h" |
| 9 #include "vm/class_finalizer.h" | 9 #include "vm/class_finalizer.h" |
| 10 #include "vm/compiler.h" | 10 #include "vm/compiler.h" |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 RawScript::kScriptTag)); | 56 RawScript::kScriptTag)); |
| 57 Library& lib = Library::Handle(Library::CoreLibrary()); | 57 Library& lib = Library::Handle(Library::CoreLibrary()); |
| 58 EXPECT_EQ(true, CompilerTest::TestCompileScript(lib, script)); | 58 EXPECT_EQ(true, CompilerTest::TestCompileScript(lib, script)); |
| 59 EXPECT(ClassFinalizer::ProcessPendingClasses()); | 59 EXPECT(ClassFinalizer::ProcessPendingClasses()); |
| 60 Class& cls = Class::Handle( | 60 Class& cls = Class::Handle( |
| 61 lib.LookupClass(String::Handle(Symbols::New("A")))); | 61 lib.LookupClass(String::Handle(Symbols::New("A")))); |
| 62 EXPECT(!cls.IsNull()); // No ambiguity error expected. | 62 EXPECT(!cls.IsNull()); // No ambiguity error expected. |
| 63 String& name = String::Handle(String::New("foo")); | 63 String& name = String::Handle(String::New("foo")); |
| 64 Function& function = Function::Handle(cls.LookupStaticFunction(name)); | 64 Function& function = Function::Handle(cls.LookupStaticFunction(name)); |
| 65 EXPECT(!function.IsNull()); | 65 EXPECT(!function.IsNull()); |
| 66 GrowableArray<const Object*> arguments; | |
| 67 const Object& retval = Object::Handle( | 66 const Object& retval = Object::Handle( |
| 68 DartEntry::InvokeFunction(function, Object::empty_array())); | 67 DartEntry::InvokeFunction(function, Object::empty_array())); |
| 69 EXPECT(retval.IsError()); | 68 EXPECT(retval.IsError()); |
| 70 EXPECT_SUBSTRING("++++", Error::Cast(retval).ToErrorCString()); | 69 EXPECT_SUBSTRING("++++", Error::Cast(retval).ToErrorCString()); |
| 71 } | 70 } |
| 72 | 71 |
| 73 | 72 |
| 74 TEST_CASE(InvokeDynamic_CompileError) { | 73 TEST_CASE(InvokeDynamic_CompileError) { |
| 75 const char* kScriptChars = | 74 const char* kScriptChars = |
| 76 "class A {\n" | 75 "class A {\n" |
| (...skipping 29 matching lines...) Expand all Loading... |
| 106 EXPECT(!function.IsNull()); | 105 EXPECT(!function.IsNull()); |
| 107 const Array& args = Array::Handle(Array::New(1)); | 106 const Array& args = Array::Handle(Array::New(1)); |
| 108 args.SetAt(0, instance); | 107 args.SetAt(0, instance); |
| 109 const Object& retval = Object::Handle(DartEntry::InvokeFunction(function, | 108 const Object& retval = Object::Handle(DartEntry::InvokeFunction(function, |
| 110 args)); | 109 args)); |
| 111 EXPECT(retval.IsError()); | 110 EXPECT(retval.IsError()); |
| 112 EXPECT_SUBSTRING("++++", Error::Cast(retval).ToErrorCString()); | 111 EXPECT_SUBSTRING("++++", Error::Cast(retval).ToErrorCString()); |
| 113 } | 112 } |
| 114 | 113 |
| 115 } // namespace dart | 114 } // namespace dart |
| OLD | NEW |