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

Unified Diff: src/ast.h

Issue 1399893002: [es7] implement |do| expressions proposal (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Some cleanup Created 5 years, 2 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 | src/ast-expression-visitor.cc » ('j') | src/preparser.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ast.h
diff --git a/src/ast.h b/src/ast.h
index af6ecb8d10647d27faf9d01f5dc37928b30b77aa..66979eb0657a5fd2a4e2c89f76886bf4e984853a 100644
--- a/src/ast.h
+++ b/src/ast.h
@@ -90,7 +90,8 @@ namespace internal {
V(SuperPropertyReference) \
V(SuperCallReference) \
V(CaseClause) \
- V(EmptyParentheses)
+ V(EmptyParentheses) \
+ V(DoExpression)
#define AST_NODE_LIST(V) \
DECLARATION_NODE_LIST(V) \
@@ -490,6 +491,29 @@ class Block final : public BreakableStatement {
};
+class DoExpression final : public Expression {
+ public:
+ DECLARE_NODE_TYPE(DoExpression)
+
+ Block* block() { return block_; }
+ VariableProxy* result() { return result_; }
+
+ protected:
+ DoExpression(Zone* zone, Block* block, VariableProxy* result, int pos)
+ : Expression(zone, pos), block_(block), result_(result) {
+ DCHECK_NOT_NULL(block_);
+ DCHECK_NOT_NULL(result_);
+ }
+ static int parent_num_ids() { return Expression::num_ids(); }
+
+ private:
+ int local_id(int n) const { return base_id() + parent_num_ids() + n; }
+
+ Block* block_;
+ VariableProxy* result_;
+};
+
+
class Declaration : public AstNode {
public:
VariableProxy* proxy() const { return proxy_; }
@@ -3558,6 +3582,11 @@ class AstNodeFactory final BASE_EMBEDDED {
NativeFunctionLiteral(parser_zone_, name, extension, pos);
}
+ DoExpression* NewDoExpression(Block* block, Variable* result_var, int pos) {
+ VariableProxy* result = NewVariableProxy(result_var, pos);
+ return new (parser_zone_) DoExpression(parser_zone_, block, result, pos);
+ }
+
ThisFunction* NewThisFunction(int pos) {
return new (local_zone_) ThisFunction(local_zone_, pos);
}
« no previous file with comments | « no previous file | src/ast-expression-visitor.cc » ('j') | src/preparser.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698