Index: src/ast.h |
diff --git a/src/ast.h b/src/ast.h |
index 0486c3ee3f4f19a17f021857f6f2344ce27a447c..5fc07e699b22f7897d19a111b15e2b9c2bf161fd 100644 |
--- a/src/ast.h |
+++ b/src/ast.h |
@@ -44,23 +44,24 @@ namespace internal { |
V(ImportDeclaration) \ |
V(ExportDeclaration) |
-#define STATEMENT_NODE_LIST(V) \ |
- V(Block) \ |
- V(ExpressionStatement) \ |
- V(EmptyStatement) \ |
- V(IfStatement) \ |
- V(ContinueStatement) \ |
- V(BreakStatement) \ |
- V(ReturnStatement) \ |
- V(WithStatement) \ |
- V(SwitchStatement) \ |
- V(DoWhileStatement) \ |
- V(WhileStatement) \ |
- V(ForStatement) \ |
- V(ForInStatement) \ |
- V(ForOfStatement) \ |
- V(TryCatchStatement) \ |
- V(TryFinallyStatement) \ |
+#define STATEMENT_NODE_LIST(V) \ |
+ V(Block) \ |
+ V(ExpressionStatement) \ |
+ V(EmptyStatement) \ |
+ V(DelegateStatement) \ |
+ V(IfStatement) \ |
+ V(ContinueStatement) \ |
+ V(BreakStatement) \ |
+ V(ReturnStatement) \ |
+ V(WithStatement) \ |
+ V(SwitchStatement) \ |
+ V(DoWhileStatement) \ |
+ V(WhileStatement) \ |
+ V(ForStatement) \ |
+ V(ForInStatement) \ |
+ V(ForOfStatement) \ |
+ V(TryCatchStatement) \ |
+ V(TryFinallyStatement) \ |
V(DebuggerStatement) |
#define EXPRESSION_NODE_LIST(V) \ |
@@ -1268,6 +1269,29 @@ class EmptyStatement final : public Statement { |
}; |
+// Delegates to another statement, which may be overwritten. |
+// This was introduced to implement ES2015 Annex B3.3 for conditionally making |
+// sloppy-mode block-scoped functions have a var binding, which is changed |
+// from one statement to another during parsing. |
+class DelegateStatement final : public Statement { |
adamk
2015/09/17 18:44:36
I thought this was going to get renamed? I believe
Dan Ehrenberg
2015/09/17 19:06:03
Done
|
+ public: |
+ DECLARE_NODE_TYPE(DelegateStatement) |
+ |
+ Statement* statement() const { return statement_; } |
+ void set_statement(Statement* statement) { statement_ = statement; } |
+ Scope* scope() const { return scope_; } |
+ |
+ private: |
+ DelegateStatement(Zone* zone, Statement* statement, Scope* scope) |
+ : Statement(zone, RelocInfo::kNoPosition), |
+ statement_(statement), |
+ scope_(scope) {} |
+ |
+ Statement* statement_; |
+ Scope* const scope_; |
+}; |
+ |
+ |
class Literal final : public Expression { |
public: |
DECLARE_NODE_TYPE(Literal) |
@@ -3404,6 +3428,10 @@ class AstNodeFactory final BASE_EMBEDDED { |
return new (local_zone_) EmptyStatement(local_zone_, pos); |
} |
+ DelegateStatement* NewDelegateStatement(Statement* statement, Scope* scope) { |
+ return new (local_zone_) DelegateStatement(local_zone_, statement, scope); |
+ } |
+ |
CaseClause* NewCaseClause( |
Expression* label, ZoneList<Statement*>* statements, int pos) { |
return new (local_zone_) CaseClause(local_zone_, label, statements, pos); |