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

Unified Diff: src/parser.h

Issue 1411203002: [es6] implement destructuring assignment [clean diff] (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 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/parser.cc » ('j') | src/parser.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_;
};
« no previous file with comments | « no previous file | src/parser.cc » ('j') | src/parser.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698