| Index: src/ast.h
|
| diff --git a/src/ast.h b/src/ast.h
|
| index 0486c3ee3f4f19a17f021857f6f2344ce27a447c..63eb9f1fa457d6002e36d7839abe92c4b3023332 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(SloppyBlockFunctionStatement) \
|
| + 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 SloppyBlockFunctionStatement final : public Statement {
|
| + public:
|
| + DECLARE_NODE_TYPE(SloppyBlockFunctionStatement)
|
| +
|
| + Statement* statement() const { return statement_; }
|
| + void set_statement(Statement* statement) { statement_ = statement; }
|
| + Scope* scope() const { return scope_; }
|
| +
|
| + private:
|
| + SloppyBlockFunctionStatement(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,12 @@ class AstNodeFactory final BASE_EMBEDDED {
|
| return new (local_zone_) EmptyStatement(local_zone_, pos);
|
| }
|
|
|
| + SloppyBlockFunctionStatement* NewSloppyBlockFunctionStatement(
|
| + Statement* statement, Scope* scope) {
|
| + return new (local_zone_)
|
| + SloppyBlockFunctionStatement(local_zone_, statement, scope);
|
| + }
|
| +
|
| CaseClause* NewCaseClause(
|
| Expression* label, ZoneList<Statement*>* statements, int pos) {
|
| return new (local_zone_) CaseClause(local_zone_, label, statements, pos);
|
|
|