Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(726)

Side by Side Diff: runtime/vm/ast.h

Issue 63983005: Simplify the desugaring of catch clauses. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Incorporated final review comments. Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | runtime/vm/flow_graph_builder.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1654 matching lines...) Expand 10 before | Expand all | Expand 10 after
1665 const bool needs_stacktrace_; 1665 const bool needs_stacktrace_;
1666 1666
1667 DISALLOW_COPY_AND_ASSIGN(CatchClauseNode); 1667 DISALLOW_COPY_AND_ASSIGN(CatchClauseNode);
1668 }; 1668 };
1669 1669
1670 1670
1671 class TryCatchNode : public AstNode { 1671 class TryCatchNode : public AstNode {
1672 public: 1672 public:
1673 TryCatchNode(intptr_t token_pos, 1673 TryCatchNode(intptr_t token_pos,
1674 SequenceNode* try_block, 1674 SequenceNode* try_block,
1675 SourceLabel* end_catch_label,
1676 const LocalVariable* context_var, 1675 const LocalVariable* context_var,
1677 CatchClauseNode* catch_block, 1676 CatchClauseNode* catch_block,
1678 SequenceNode* finally_block, 1677 SequenceNode* finally_block,
1679 intptr_t try_index) 1678 intptr_t try_index)
1680 : AstNode(token_pos), 1679 : AstNode(token_pos),
1681 try_block_(try_block), 1680 try_block_(try_block),
1682 end_catch_label_(end_catch_label),
1683 context_var_(*context_var), 1681 context_var_(*context_var),
1684 catch_block_(catch_block), 1682 catch_block_(catch_block),
1685 finally_block_(finally_block), 1683 finally_block_(finally_block),
1686 try_index_(try_index) { 1684 try_index_(try_index) {
1687 ASSERT(try_block_ != NULL); 1685 ASSERT(try_block_ != NULL);
1688 ASSERT(context_var != NULL); 1686 ASSERT(context_var != NULL);
1689 ASSERT(catch_block_ != NULL || finally_block_ != NULL); 1687 ASSERT(catch_block_ != NULL || finally_block_ != NULL);
1690 ASSERT(end_catch_label_ != NULL);
1691 } 1688 }
1692 1689
1693 SequenceNode* try_block() const { return try_block_; } 1690 SequenceNode* try_block() const { return try_block_; }
1694 SourceLabel* end_catch_label() const { return end_catch_label_; }
1695 CatchClauseNode* catch_block() const { return catch_block_; } 1691 CatchClauseNode* catch_block() const { return catch_block_; }
1696 SequenceNode* finally_block() const { return finally_block_; } 1692 SequenceNode* finally_block() const { return finally_block_; }
1697 const LocalVariable& context_var() const { return context_var_; } 1693 const LocalVariable& context_var() const { return context_var_; }
1698 intptr_t try_index() const { return try_index_; } 1694 intptr_t try_index() const { return try_index_; }
1699 1695
1700 virtual void VisitChildren(AstNodeVisitor* visitor) const { 1696 virtual void VisitChildren(AstNodeVisitor* visitor) const {
1701 try_block_->Visit(visitor); 1697 try_block_->Visit(visitor);
1702 if (catch_block_ != NULL) { 1698 if (catch_block_ != NULL) {
1703 catch_block_->Visit(visitor); 1699 catch_block_->Visit(visitor);
1704 } 1700 }
1705 if (finally_block_ != NULL) { 1701 if (finally_block_ != NULL) {
1706 finally_block_->Visit(visitor); 1702 finally_block_->Visit(visitor);
1707 } 1703 }
1708 } 1704 }
1709 1705
1710 DECLARE_COMMON_NODE_FUNCTIONS(TryCatchNode); 1706 DECLARE_COMMON_NODE_FUNCTIONS(TryCatchNode);
1711 1707
1712 private: 1708 private:
1713 SequenceNode* try_block_; 1709 SequenceNode* try_block_;
1714 SourceLabel* end_catch_label_;
1715 const LocalVariable& context_var_; 1710 const LocalVariable& context_var_;
1716 CatchClauseNode* catch_block_; 1711 CatchClauseNode* catch_block_;
1717 SequenceNode* finally_block_; 1712 SequenceNode* finally_block_;
1718 const intptr_t try_index_; 1713 const intptr_t try_index_;
1719 1714
1720 DISALLOW_COPY_AND_ASSIGN(TryCatchNode); 1715 DISALLOW_COPY_AND_ASSIGN(TryCatchNode);
1721 }; 1716 };
1722 1717
1723 1718
1724 class ThrowNode : public AstNode { 1719 class ThrowNode : public AstNode {
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
1778 const intptr_t try_index_; 1773 const intptr_t try_index_;
1779 1774
1780 DISALLOW_IMPLICIT_CONSTRUCTORS(InlinedFinallyNode); 1775 DISALLOW_IMPLICIT_CONSTRUCTORS(InlinedFinallyNode);
1781 }; 1776 };
1782 1777
1783 } // namespace dart 1778 } // namespace dart
1784 1779
1785 #undef DECLARE_COMMON_NODE_FUNCTIONS 1780 #undef DECLARE_COMMON_NODE_FUNCTIONS
1786 1781
1787 #endif // VM_AST_H_ 1782 #endif // VM_AST_H_
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/flow_graph_builder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698