| 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 #include "vm/resolver.h" | 10 #include "vm/resolver.h" |
| (...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 406 return new StaticSetterNode(token_pos(), NULL, cls(), field_name(), rhs); | 406 return new StaticSetterNode(token_pos(), NULL, cls(), field_name(), rhs); |
| 407 } | 407 } |
| 408 | 408 |
| 409 | 409 |
| 410 AstNode* StaticCallNode::MakeAssignmentNode(AstNode* rhs) { | 410 AstNode* StaticCallNode::MakeAssignmentNode(AstNode* rhs) { |
| 411 // Return this node if it represents a 'throw NoSuchMethodError' indicating | 411 // Return this node if it represents a 'throw NoSuchMethodError' indicating |
| 412 // that a getter was not found, otherwise return null. | 412 // that a getter was not found, otherwise return null. |
| 413 const Class& cls = Class::Handle(function().Owner()); | 413 const Class& cls = Class::Handle(function().Owner()); |
| 414 const String& cls_name = String::Handle(cls.Name()); | 414 const String& cls_name = String::Handle(cls.Name()); |
| 415 const String& func_name = String::Handle(function().name()); | 415 const String& func_name = String::Handle(function().name()); |
| 416 const String& error_cls_name = String::Handle(Symbols::NoSuchMethodError()); | 416 if (cls_name.Equals(Symbols::NoSuchMethodError()) && |
| 417 const String& error_func_name = String::Handle(Symbols::ThrowNew()); | 417 func_name.StartsWith(Symbols::ThrowNew())) { |
| 418 if (cls_name.Equals(error_cls_name) && | |
| 419 func_name.StartsWith(error_func_name)) { | |
| 420 return this; | 418 return this; |
| 421 } | 419 } |
| 422 return NULL; | 420 return NULL; |
| 423 } | 421 } |
| 424 | 422 |
| 425 | 423 |
| 426 const Instance* StaticGetterNode::EvalConstExpr() const { | 424 const Instance* StaticGetterNode::EvalConstExpr() const { |
| 427 const String& getter_name = | 425 const String& getter_name = |
| 428 String::Handle(Field::GetterName(this->field_name())); | 426 String::Handle(Field::GetterName(this->field_name())); |
| 429 const Function& getter_func = | 427 const Function& getter_func = |
| 430 Function::Handle(this->cls().LookupStaticFunction(getter_name)); | 428 Function::Handle(this->cls().LookupStaticFunction(getter_name)); |
| 431 if (getter_func.IsNull() || !getter_func.is_const()) { | 429 if (getter_func.IsNull() || !getter_func.is_const()) { |
| 432 return NULL; | 430 return NULL; |
| 433 } | 431 } |
| 434 const Object& result = Object::Handle( | 432 const Object& result = Object::Handle( |
| 435 DartEntry::InvokeStatic(getter_func, Object::empty_array())); | 433 DartEntry::InvokeStatic(getter_func, Object::empty_array())); |
| 436 if (result.IsError() || result.IsNull()) { | 434 if (result.IsError() || result.IsNull()) { |
| 437 // TODO(turnidge): We could get better error messages by returning | 435 // TODO(turnidge): We could get better error messages by returning |
| 438 // the Error object directly to the parser. This will involve | 436 // the Error object directly to the parser. This will involve |
| 439 // replumbing all of the EvalConstExpr methods. | 437 // replumbing all of the EvalConstExpr methods. |
| 440 return NULL; | 438 return NULL; |
| 441 } | 439 } |
| 442 return &Instance::ZoneHandle(Instance::Cast(result).raw()); | 440 return &Instance::ZoneHandle(Instance::Cast(result).raw()); |
| 443 } | 441 } |
| 444 | 442 |
| 445 } // namespace dart | 443 } // namespace dart |
| OLD | NEW |