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

Unified Diff: src/parser.cc

Issue 1107053002: Parsing binding patterns. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: CR feedback Created 5 years, 8 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/preparser.h » ('j') | src/preparser.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/parser.cc
diff --git a/src/parser.cc b/src/parser.cc
index fe9ed1040a83a206a1e379803178f203b38202eb..6124f58e845ebb7e82608ff385ce2e4d7c2d80c8 100644
--- a/src/parser.cc
+++ b/src/parser.cc
@@ -872,6 +872,7 @@ Parser::Parser(ParseInfo* info)
FLAG_harmony_computed_property_names);
set_allow_harmony_rest_params(FLAG_harmony_rest_parameters);
set_allow_harmony_spreadcalls(FLAG_harmony_spreadcalls);
+ set_allow_harmony_destructuring(FLAG_harmony_destructuring);
set_allow_strong_mode(FLAG_strong_mode);
for (int feature = 0; feature < v8::Isolate::kUseCounterFeatureCount;
++feature) {
@@ -2387,6 +2388,9 @@ Block* Parser::ParseVariableDeclarations(
pattern->AsVariableProxy()->IsValidReferenceExpression()) {
scope_->RemoveUnresolved(pattern->AsVariableProxy());
name = pattern->AsVariableProxy()->raw_name();
+ } else if (allow_harmony_destructuring()) {
+ // TODO(dslomov): really destructure.
+ name = ast_value_factory()->GetOneByteString(".temp.variable");
} else {
ReportUnexpectedToken(next);
*ok = false;
@@ -4335,6 +4339,8 @@ PreParser::PreParseResult Parser::ParseLazyFunctionBodyWithPreParser(
allow_harmony_rest_params());
reusable_preparser_->set_allow_harmony_spreadcalls(
allow_harmony_spreadcalls());
+ reusable_preparser_->set_allow_harmony_destructuring(
+ allow_harmony_destructuring());
reusable_preparser_->set_allow_strong_mode(allow_strong_mode());
}
PreParser::PreParseResult result = reusable_preparser_->PreParseLazyFunction(
« no previous file with comments | « no previous file | src/preparser.h » ('j') | src/preparser.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698