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 #ifndef VM_AST_H_ | 5 #ifndef VM_AST_H_ |
6 #define VM_AST_H_ | 6 #define VM_AST_H_ |
7 | 7 |
8 #include "platform/assert.h" | 8 #include "platform/assert.h" |
9 #include "vm/allocation.h" | 9 #include "vm/allocation.h" |
10 #include "vm/growable_array.h" | 10 #include "vm/growable_array.h" |
(...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
533 | 533 |
534 DISALLOW_IMPLICIT_CONSTRUCTORS(AssignableNode); | 534 DISALLOW_IMPLICIT_CONSTRUCTORS(AssignableNode); |
535 }; | 535 }; |
536 | 536 |
537 | 537 |
538 class ClosureNode : public AstNode { | 538 class ClosureNode : public AstNode { |
539 public: | 539 public: |
540 ClosureNode(TokenPosition token_pos, | 540 ClosureNode(TokenPosition token_pos, |
541 const Function& function, | 541 const Function& function, |
542 AstNode* receiver, // Non-null for implicit instance closures. | 542 AstNode* receiver, // Non-null for implicit instance closures. |
543 LocalScope* scope) // Null for implicit closures. | 543 LocalScope* scope) // Null for implicit closures or functions |
| 544 // that already have a ContextScope because |
| 545 // they were compiled before. |
544 : AstNode(token_pos), | 546 : AstNode(token_pos), |
545 function_(function), | 547 function_(function), |
546 receiver_(receiver), | 548 receiver_(receiver), |
547 scope_(scope), | 549 scope_(scope), |
548 is_deferred_reference_(false) { | 550 is_deferred_reference_(false) { |
549 ASSERT(function_.IsZoneHandle()); | 551 ASSERT(function_.IsZoneHandle()); |
550 ASSERT((function_.IsNonImplicitClosureFunction() && | 552 ASSERT((function_.IsNonImplicitClosureFunction() && (receiver_ == NULL)) || |
551 (receiver_ == NULL) && (scope_ != NULL)) || | |
552 (function_.IsImplicitInstanceClosureFunction() && | 553 (function_.IsImplicitInstanceClosureFunction() && |
553 (receiver_ != NULL) && (scope_ == NULL)) || | 554 (receiver_ != NULL) && (scope_ == NULL)) || |
554 (function_.IsImplicitStaticClosureFunction() && | 555 (function_.IsImplicitStaticClosureFunction() && |
555 (receiver_ == NULL) && (scope_ == NULL))); | 556 (receiver_ == NULL) && (scope_ == NULL))); |
556 } | 557 } |
557 | 558 |
558 const Function& function() const { return function_; } | 559 const Function& function() const { return function_; } |
559 AstNode* receiver() const { return receiver_; } | 560 AstNode* receiver() const { return receiver_; } |
560 LocalScope* scope() const { return scope_; } | 561 LocalScope* scope() const { return scope_; } |
561 | 562 |
(...skipping 1452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2014 const intptr_t try_index_; | 2015 const intptr_t try_index_; |
2015 | 2016 |
2016 DISALLOW_IMPLICIT_CONSTRUCTORS(InlinedFinallyNode); | 2017 DISALLOW_IMPLICIT_CONSTRUCTORS(InlinedFinallyNode); |
2017 }; | 2018 }; |
2018 | 2019 |
2019 } // namespace dart | 2020 } // namespace dart |
2020 | 2021 |
2021 #undef DECLARE_COMMON_NODE_FUNCTIONS | 2022 #undef DECLARE_COMMON_NODE_FUNCTIONS |
2022 | 2023 |
2023 #endif // VM_AST_H_ | 2024 #endif // VM_AST_H_ |
OLD | NEW |