| Index: src/parser.h
|
| diff --git a/src/parser.h b/src/parser.h
|
| index 0ddd6000222a7b587d583d88761a14f6dd89ce5a..399c1b029a6fa1ea9c69c3dce101a2a037f8c2e1 100644
|
| --- a/src/parser.h
|
| +++ b/src/parser.h
|
| @@ -1027,6 +1027,12 @@ class Parser : public ParserBase<ParserTraits> {
|
| const DeclarationParsingResult::Declaration* declaration,
|
| ZoneList<const AstRawString*>* names, bool* ok);
|
|
|
| + static Variable* RewriteDestructuringAssignment(Parser* parser,
|
| + Block* block,
|
| + Expression* pattern,
|
| + Expression* value,
|
| + Variable* result, bool* ok);
|
| +
|
| void set_initializer_position(int pos) { initializer_position_ = pos; }
|
|
|
| private:
|
| @@ -1038,6 +1044,11 @@ class Parser : public ParserBase<ParserTraits> {
|
| #undef DECLARE_VISIT
|
| virtual void Visit(AstNode* node) override;
|
|
|
| + enum PatternContext { BINDING = 0, INITIALIZER, ASSIGNMENT };
|
| +
|
| + PatternContext context() const { return context_; }
|
| + void set_context(PatternContext ctx) { context_ = ctx; }
|
| +
|
| void RecurseIntoSubpattern(AstNode* pattern, Expression* value) {
|
| Expression* old_value = current_value_;
|
| current_value_ = value;
|
| @@ -1047,13 +1058,17 @@ class Parser : public ParserBase<ParserTraits> {
|
|
|
| Variable* CreateTempVar(Expression* value = nullptr);
|
|
|
| - AstNodeFactory* factory() const { return descriptor_->parser->factory(); }
|
| + AstNodeFactory* factory() const { return parser_->factory(); }
|
| + Parser* parser() const { return parser_; }
|
| + Scope* parser_scope() const { return parser_->scope_; }
|
| AstValueFactory* ast_value_factory() const {
|
| - return descriptor_->parser->ast_value_factory();
|
| + return parser_->ast_value_factory();
|
| }
|
| - bool inside_with() const { return descriptor_->parser->inside_with(); }
|
| - Zone* zone() const { return descriptor_->parser->zone(); }
|
| + bool inside_with() const { return parser_->inside_with(); }
|
| + Zone* zone() const { return parser_->zone(); }
|
|
|
| + Parser* parser_;
|
| + PatternContext context_;
|
| Expression* pattern_;
|
| int initializer_position_;
|
| Block* block_;
|
| @@ -1061,6 +1076,7 @@ class Parser : public ParserBase<ParserTraits> {
|
| ZoneList<const AstRawString*>* names_;
|
| Expression* current_value_;
|
| bool* ok_;
|
| + Variable* rhs_;
|
| };
|
|
|
|
|
|
|