| 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/code_patcher.h" | 7 #include "vm/code_patcher.h" |
| 8 #include "vm/compiler.h" | 8 #include "vm/compiler.h" |
| 9 #include "vm/dart_api_impl.h" | 9 #include "vm/dart_api_impl.h" |
| 10 #include "vm/object.h" | 10 #include "vm/object.h" |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 EXPECT(!Dart_IsNull(obj_handle)); | 167 EXPECT(!Dart_IsNull(obj_handle)); |
| 168 EXPECT(!Dart_IsError(obj_handle)); | 168 EXPECT(!Dart_IsError(obj_handle)); |
| 169 TransitionNativeToVM transition(thread); | 169 TransitionNativeToVM transition(thread); |
| 170 const Object& obj = Object::Handle(Api::UnwrapHandle(obj_handle)); | 170 const Object& obj = Object::Handle(Api::UnwrapHandle(obj_handle)); |
| 171 EXPECT(!obj.IsNull()); | 171 EXPECT(!obj.IsNull()); |
| 172 EXPECT(obj.IsInstance()); | 172 EXPECT(obj.IsInstance()); |
| 173 | 173 |
| 174 String& expr_text = String::Handle(); | 174 String& expr_text = String::Handle(); |
| 175 expr_text = String::New("apa + ' ${calc(10)}' + dot"); | 175 expr_text = String::New("apa + ' ${calc(10)}' + dot"); |
| 176 Object& val = Object::Handle(); | 176 Object& val = Object::Handle(); |
| 177 val = Instance::Cast(obj).Evaluate(expr_text, | 177 const Class& receiver_cls = Class::Handle(obj.clazz()); |
| 178 val = Instance::Cast(obj).Evaluate(receiver_cls, |
| 179 expr_text, |
| 178 Array::empty_array(), | 180 Array::empty_array(), |
| 179 Array::empty_array()); | 181 Array::empty_array()); |
| 180 EXPECT(!val.IsNull()); | 182 EXPECT(!val.IsNull()); |
| 181 EXPECT(!val.IsError()); | 183 EXPECT(!val.IsError()); |
| 182 EXPECT(val.IsString()); | 184 EXPECT(val.IsString()); |
| 183 EXPECT_STREQ("Herr Nilsson 100.", val.ToCString()); | 185 EXPECT_STREQ("Herr Nilsson 100.", val.ToCString()); |
| 184 } | 186 } |
| 185 | 187 |
| 186 | 188 |
| 187 VM_TEST_CASE(EvalExpressionWithLazyCompile) { | 189 VM_TEST_CASE(EvalExpressionWithLazyCompile) { |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 EXPECT(val.IsInteger()); | 223 EXPECT(val.IsInteger()); |
| 222 EXPECT_EQ(7, Integer::Cast(val).AsInt64Value()); | 224 EXPECT_EQ(7, Integer::Cast(val).AsInt64Value()); |
| 223 | 225 |
| 224 intptr_t final_class_table_size = | 226 intptr_t final_class_table_size = |
| 225 Isolate::Current()->class_table()->NumCids(); | 227 Isolate::Current()->class_table()->NumCids(); |
| 226 // Eval should not eat into this non-renewable resource. | 228 // Eval should not eat into this non-renewable resource. |
| 227 EXPECT_EQ(initial_class_table_size, final_class_table_size); | 229 EXPECT_EQ(initial_class_table_size, final_class_table_size); |
| 228 } | 230 } |
| 229 | 231 |
| 230 } // namespace dart | 232 } // namespace dart |
| OLD | NEW |