Chromium Code Reviews| Index: src/ast.h |
| diff --git a/src/ast.h b/src/ast.h |
| index 0486c3ee3f4f19a17f021857f6f2344ce27a447c..48362b7c5325e75de4ee6c865527789161a6148c 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 { |
| }; |
| +class DelegateStatement final : public Statement { |
| + // Delegates to another statement, which may be overwritten. |
|
adamk
2015/09/11 15:42:56
Nit: class comments should go right above the decl
Dan Ehrenberg
2015/09/17 17:44:09
Done
|
| + // 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. |
| + public: |
| + DECLARE_NODE_TYPE(DelegateStatement) |
| + |
| + Statement* statement() { return statement_; } |
|
adamk
2015/09/11 15:42:56
Make this a const method
Dan Ehrenberg
2015/09/17 17:44:09
Done
|
| + void set_statement(Statement* statement) { statement_ = statement; } |
| + Scope* scope() { return scope_; } |
|
adamk
2015/09/11 15:42:56
ditto: const please
Dan Ehrenberg
2015/09/17 17:44:09
Done
|
| + |
| + protected: |
|
adamk
2015/09/11 15:42:56
I realize the use of "protected" here matches some
Dan Ehrenberg
2015/09/17 17:44:09
Done
|
| + explicit DelegateStatement(Zone* zone, int pos, Statement* statement, |
|
adamk
2015/09/11 15:42:56
No need for "explicit" here.
Dan Ehrenberg
2015/09/17 17:44:09
Done
|
| + Scope* scope) |
| + : Statement(zone, pos), statement_(statement), scope_(scope) {} |
|
adamk
2015/09/11 15:42:56
Could you just pass RelocInfo::kNoPosition to the
Dan Ehrenberg
2015/09/17 17:44:09
Done
|
| + |
| + private: |
| + Statement* statement_; |
| + Scope* scope_; |
| +}; |
| + |
| + |
| class Literal final : public Expression { |
| public: |
| DECLARE_NODE_TYPE(Literal) |
| @@ -3404,6 +3428,12 @@ class AstNodeFactory final BASE_EMBEDDED { |
| return new (local_zone_) EmptyStatement(local_zone_, pos); |
| } |
| + DelegateStatement* NewDelegateStatement(int pos, Statement* statement, |
| + Scope* scope) { |
| + return new (local_zone_) |
| + DelegateStatement(local_zone_, pos, statement, scope); |
| + } |
| + |
| CaseClause* NewCaseClause( |
| Expression* label, ZoneList<Statement*>* statements, int pos) { |
| return new (local_zone_) CaseClause(local_zone_, label, statements, pos); |