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

Unified Diff: runtime/vm/ast.h

Issue 15935005: Remove pseudo-node from LoadLocalNode and replace it with a proper AST node. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 7 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 23217)
+++ runtime/vm/ast.h (working copy)
@@ -55,6 +55,7 @@
V(LoadIndexedNode, "load indexed") \
V(StoreIndexedNode, "store indexed") \
V(SequenceNode, "seq") \
+ V(CommaNode, "comma") \
V(CatchClauseNode, "catch clause block") \
V(TryCatchNode, "try catch block") \
V(ThrowNode, "throw") \
@@ -180,6 +181,35 @@
};
+// 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,
Kevin Millikin (Google) 2013/05/28 09:13:26 As discussed offline, I think that this node shoul
Florian Schneider 2013/05/28 09:22:35 Agree. I'll do that in a separate CL.
+ 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)
@@ -962,29 +992,13 @@
class LoadLocalNode : public AstNode {
public:
LoadLocalNode(intptr_t token_pos, const LocalVariable* local)
- : AstNode(token_pos), local_(*local), pseudo_(NULL) {
+ : AstNode(token_pos), local_(*local) {
ASSERT(local != NULL);
}
- // A local variable load can optionally be a pair of an arbitrary 'pseudo'
- // AST node followed by the load. The pseudo node is evaluated for its
- // side-effects and the value of the expression is the value of the local
- // load after evaluating the pseudo node. Pseudo nodes are used, e.g., in
- // the desugaring of postincrement and cascade expressions.
- LoadLocalNode(intptr_t token_pos, const LocalVariable* local, AstNode* pseudo)
- : AstNode(token_pos), local_(*local), pseudo_(pseudo) {
- ASSERT(local != NULL);
- }
-
const LocalVariable& local() const { return local_; }
- AstNode* pseudo() const { return pseudo_; } // Can be NULL.
- bool HasPseudo() const { return pseudo_ != NULL; }
- virtual void VisitChildren(AstNodeVisitor* visitor) const {
- if (HasPseudo()) {
- pseudo()->Visit(visitor);
- }
- }
+ virtual void VisitChildren(AstNodeVisitor* visitor) const { }
virtual const Instance* EvalConstExpr() const;
virtual AstNode* MakeAssignmentNode(AstNode* rhs);
@@ -993,7 +1007,6 @@
private:
const LocalVariable& local_;
- AstNode* pseudo_;
DISALLOW_IMPLICIT_CONSTRUCTORS(LoadLocalNode);
};
« 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