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

Unified Diff: src/parser.h

Issue 1167393005: [destructuring] Parse binding patterns in formal parameters. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: CR feedback + rebase Created 5 years, 6 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') | no next file with comments »
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 a9834e25d767c654a191e2e5d5599e7e877d696a..39d0d9278b132fd4dfc5a9ebd104661f1f846205 100644
--- a/src/parser.h
+++ b/src/parser.h
@@ -754,7 +754,7 @@ class ParserTraits {
V8_INLINE Scope* NewScope(Scope* parent_scope, ScopeType scope_type,
FunctionKind kind = kNormalFunction);
- V8_INLINE void DeclareFormalParameter(Scope* scope, const AstRawString* name,
+ V8_INLINE void DeclareFormalParameter(Scope* scope, Expression* name,
ExpressionClassifier* classifier,
bool is_rest);
void ParseArrowFunctionFormalParameters(Scope* scope, Expression* params,
@@ -1270,11 +1270,16 @@ Expression* ParserTraits::SpreadCallNew(
}
-void ParserTraits::DeclareFormalParameter(Scope* scope,
- const AstRawString* name,
+void ParserTraits::DeclareFormalParameter(Scope* scope, Expression* pattern,
ExpressionClassifier* classifier,
bool is_rest) {
bool is_duplicate = false;
+ if (!pattern->IsVariableProxy()) {
+ // TODO(dslomov): implement.
+ DCHECK(parser_->allow_harmony_destructuring());
+ return;
+ }
+ auto name = pattern->AsVariableProxy()->raw_name();
Variable* var = scope->DeclareParameter(name, VAR, is_rest, &is_duplicate);
if (is_sloppy(scope->language_mode())) {
// TODO(sigurds) Mark every parameter as maybe assigned. This is a
« no previous file with comments | « no previous file | src/parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698