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 497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
508 return NULL; | 508 return NULL; |
509 } | 509 } |
510 return new StoreLocalNode(token_pos(), &local(), rhs); | 510 return new StoreLocalNode(token_pos(), &local(), rhs); |
511 } | 511 } |
512 | 512 |
513 | 513 |
514 AstNode* LoadStaticFieldNode::MakeAssignmentNode(AstNode* rhs) { | 514 AstNode* LoadStaticFieldNode::MakeAssignmentNode(AstNode* rhs) { |
515 if (field().is_final()) { | 515 if (field().is_final()) { |
516 return NULL; | 516 return NULL; |
517 } | 517 } |
518 if (FLAG_enable_type_checks) { | 518 if (Isolate::Current()->TypeChecksEnabled()) { |
519 rhs = new AssignableNode( | 519 rhs = new AssignableNode( |
520 field().token_pos(), | 520 field().token_pos(), |
521 rhs, | 521 rhs, |
522 AbstractType::ZoneHandle(field().type()), | 522 AbstractType::ZoneHandle(field().type()), |
523 String::ZoneHandle(field().name())); | 523 String::ZoneHandle(field().name())); |
524 } | 524 } |
525 return new StoreStaticFieldNode(token_pos(), field(), rhs); | 525 return new StoreStaticFieldNode(token_pos(), field(), rhs); |
526 } | 526 } |
527 | 527 |
528 | 528 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
567 // order to trigger the throw at runtime. | 567 // order to trigger the throw at runtime. |
568 return new StaticSetterNode(token_pos(), NULL, cls(), field_name(), rhs); | 568 return new StaticSetterNode(token_pos(), NULL, cls(), field_name(), rhs); |
569 } | 569 } |
570 #if defined(DEBUG) | 570 #if defined(DEBUG) |
571 const String& getter_name = String::Handle(Field::GetterName(field_name())); | 571 const String& getter_name = String::Handle(Field::GetterName(field_name())); |
572 const Function& getter = | 572 const Function& getter = |
573 Function::Handle(cls().LookupStaticFunction(getter_name)); | 573 Function::Handle(cls().LookupStaticFunction(getter_name)); |
574 ASSERT(!getter.IsNull() && | 574 ASSERT(!getter.IsNull() && |
575 (getter.kind() == RawFunction::kImplicitStaticFinalGetter)); | 575 (getter.kind() == RawFunction::kImplicitStaticFinalGetter)); |
576 #endif | 576 #endif |
577 if (FLAG_enable_type_checks) { | 577 if (Isolate::Current()->TypeChecksEnabled()) { |
578 rhs = new AssignableNode( | 578 rhs = new AssignableNode( |
579 field.token_pos(), | 579 field.token_pos(), |
580 rhs, | 580 rhs, |
581 AbstractType::ZoneHandle(field.type()), | 581 AbstractType::ZoneHandle(field.type()), |
582 String::ZoneHandle(field.name())); | 582 String::ZoneHandle(field.name())); |
583 } | 583 } |
584 return new StoreStaticFieldNode(token_pos(), field, rhs); | 584 return new StoreStaticFieldNode(token_pos(), field, rhs); |
585 } | 585 } |
586 // Didn't find a static setter or a static field. | 586 // Didn't find a static setter or a static field. |
587 // If this static getter is in an instance function where | 587 // If this static getter is in an instance function where |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
640 if (result.IsError() || result.IsNull()) { | 640 if (result.IsError() || result.IsNull()) { |
641 // TODO(turnidge): We could get better error messages by returning | 641 // TODO(turnidge): We could get better error messages by returning |
642 // the Error object directly to the parser. This will involve | 642 // the Error object directly to the parser. This will involve |
643 // replumbing all of the EvalConstExpr methods. | 643 // replumbing all of the EvalConstExpr methods. |
644 return NULL; | 644 return NULL; |
645 } | 645 } |
646 return &Instance::ZoneHandle(Instance::Cast(result).raw()); | 646 return &Instance::ZoneHandle(Instance::Cast(result).raw()); |
647 } | 647 } |
648 | 648 |
649 } // namespace dart | 649 } // namespace dart |
OLD | NEW |