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

Unified Diff: runtime/vm/ast.h

Issue 16146008: Simplify AST by extending LetNode and replace CommaNode. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 6 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | runtime/vm/ast.cc » ('j') | runtime/vm/flow_graph_builder.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/ast.h
===================================================================
--- runtime/vm/ast.h (revision 23667)
+++ runtime/vm/ast.h (working copy)
@@ -56,7 +56,6 @@
V(StoreIndexedNode, "store indexed") \
V(SequenceNode, "seq") \
V(LetNode, "let") \
- V(CommaNode, "comma") \
V(CatchClauseNode, "catch clause block") \
V(TryCatchNode, "try catch block") \
V(ThrowNode, "throw") \
@@ -182,35 +181,6 @@
};
-// Comma node represents a pair of expressions evaluated in sequence
-// and return the value of the second expression.
-class CommaNode : public AstNode {
- public:
- CommaNode(intptr_t token_pos,
- AstNode* first,
- AstNode* second)
- : AstNode(token_pos),
- first_(first),
- second_(second) { }
-
- AstNode* first() const { return first_; }
- AstNode* second() const { return second_; }
-
- void VisitChildren(AstNodeVisitor* visitor) const {
- first_->Visit(visitor);
- second_->Visit(visitor);
- }
-
- DECLARE_COMMON_NODE_FUNCTIONS(CommaNode);
-
- private:
- AstNode* first_;
- AstNode* second_;
-
- DISALLOW_COPY_AND_ASSIGN(CommaNode);
-};
-
-
class CloneContextNode : public AstNode {
public:
explicit CloneContextNode(intptr_t token_pos)
@@ -303,13 +273,14 @@
LocalVariable* AddInitializer(AstNode* node);
+ const GrowableArray<AstNode*>& nodes() const { return nodes_; }
+
+ void AddNode(AstNode* node) { nodes_.Add(node); }
+
intptr_t num_temps() const {
return vars_.length();
}
- AstNode* body() const { return body_; }
- void set_body(AstNode* node) { body_ = node; }
-
void VisitChildren(AstNodeVisitor* visitor) const;
DECLARE_COMMON_NODE_FUNCTIONS(LetNode);
@@ -317,7 +288,7 @@
private:
GrowableArray<LocalVariable*> vars_;
GrowableArray<AstNode*> initializers_;
- AstNode* body_;
+ GrowableArray<AstNode*> nodes_;
DISALLOW_COPY_AND_ASSIGN(LetNode);
};
« no previous file with comments | « no previous file | runtime/vm/ast.cc » ('j') | runtime/vm/flow_graph_builder.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698