| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 "vm/ast.h" | 5 #include "vm/ast.h" |
| 6 #include "vm/compiler.h" | 6 #include "vm/compiler.h" |
| 7 #include "vm/dart_entry.h" | 7 #include "vm/dart_entry.h" |
| 8 #include "vm/isolate.h" | 8 #include "vm/isolate.h" |
| 9 #include "vm/object_store.h" | 9 #include "vm/object_store.h" |
| 10 | 10 |
| (...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 431 const Instance* StaticGetterNode::EvalConstExpr() const { | 431 const Instance* StaticGetterNode::EvalConstExpr() const { |
| 432 const String& getter_name = | 432 const String& getter_name = |
| 433 String::Handle(Field::GetterName(this->field_name())); | 433 String::Handle(Field::GetterName(this->field_name())); |
| 434 const Function& getter_func = | 434 const Function& getter_func = |
| 435 Function::Handle(this->cls().LookupStaticFunction(getter_name)); | 435 Function::Handle(this->cls().LookupStaticFunction(getter_name)); |
| 436 if (getter_func.IsNull() || !getter_func.is_const()) { | 436 if (getter_func.IsNull() || !getter_func.is_const()) { |
| 437 return NULL; | 437 return NULL; |
| 438 } | 438 } |
| 439 GrowableArray<const Object*> arguments; | 439 GrowableArray<const Object*> arguments; |
| 440 const Array& kNoArgumentNames = Array::Handle(); | 440 const Array& kNoArgumentNames = Array::Handle(); |
| 441 const Instance& field_value = | 441 const Object& result = |
| 442 Instance::ZoneHandle(DartEntry::InvokeStatic(getter_func, | 442 Object::Handle(DartEntry::InvokeStatic(getter_func, |
| 443 arguments, | 443 arguments, |
| 444 kNoArgumentNames)); | 444 kNoArgumentNames)); |
| 445 if (field_value.IsUnhandledException()) { | 445 if (result.IsError() || result.IsNull()) { |
| 446 // TODO(turnidge): We could get better error messages by returning |
| 447 // the Error object directly to the parser. This will involve |
| 448 // replumbing all of the EvalConstExpr methods. |
| 446 return NULL; | 449 return NULL; |
| 447 } | 450 } |
| 448 if (!field_value.IsNull()) { | 451 Instance& field_value = Instance::ZoneHandle(); |
| 449 return &field_value; | 452 field_value ^= result.raw(); |
| 450 } | 453 return &field_value; |
| 451 return NULL; | |
| 452 } | 454 } |
| 453 | 455 |
| 454 } // namespace dart | 456 } // namespace dart |
| OLD | NEW |