Chromium Code Reviews| Index: src/parser.cc |
| diff --git a/src/parser.cc b/src/parser.cc |
| index 96c269546f755b6a706a4cc9d13b555453ad3d25..53cc0f5a1f7fbc6f823fe8c7c7ced5f3f1e1cee8 100644 |
| --- a/src/parser.cc |
| +++ b/src/parser.cc |
| @@ -1183,13 +1183,16 @@ FunctionLiteral* Parser::ParseLazy(Isolate* isolate, ParseInfo* info, |
| scope->set_start_position(shared_info->start_position()); |
| ExpressionClassifier formals_classifier; |
| bool has_rest = false; |
| - if (Check(Token::LPAREN)) { |
| - // '(' StrictFormalParameters ')' |
| - ParseFormalParameterList(scope, &has_rest, &formals_classifier, &ok); |
| - if (ok) ok = Check(Token::RPAREN); |
| - } else { |
| - // BindingIdentifier |
| - ParseFormalParameter(scope, has_rest, &formals_classifier, &ok); |
| + { |
| + BlockState block_state(&scope_, scope); |
|
arv (Not doing code reviews)
2015/06/15 15:21:59
Why was this block state added? It does not seem l
Dmitry Lomov (no reviews)
2015/06/15 16:12:51
Ah, this is a tricky bit. Parsing patterns as vari
|
| + if (Check(Token::LPAREN)) { |
| + // '(' StrictFormalParameters ')' |
| + ParseFormalParameterList(scope, &has_rest, &formals_classifier, &ok); |
| + if (ok) ok = Check(Token::RPAREN); |
| + } else { |
| + // BindingIdentifier |
| + ParseFormalParameter(scope, has_rest, &formals_classifier, &ok); |
| + } |
| } |
| if (ok) { |
| @@ -3803,7 +3806,11 @@ void ParserTraits::ParseArrowFunctionFormalParameters( |
| expr = expr->AsSpread()->expression(); |
| } |
| - DCHECK(expr->IsVariableProxy()); |
| + if (!expr->IsVariableProxy()) { |
| + // TODO(dslomov): support pattern desugaring |
| + return; |
| + } |
| + // TODO(wingo): Support rest parameters. |
|
arv (Not doing code reviews)
2015/06/15 15:21:59
Andy implemented this last week.
Dmitry Lomov (no reviews)
2015/06/15 16:12:51
Removed.
|
| DCHECK(!expr->AsVariableProxy()->is_this()); |
| const AstRawString* raw_name = expr->AsVariableProxy()->raw_name(); |
| @@ -3816,7 +3823,7 @@ void ParserTraits::ParseArrowFunctionFormalParameters( |
| parser_->scope_->RemoveUnresolved(expr->AsVariableProxy()); |
| ExpressionClassifier classifier; |
| - DeclareFormalParameter(scope, raw_name, &classifier, *has_rest); |
| + DeclareFormalParameter(scope, expr, &classifier, *has_rest); |
| if (!duplicate_loc->IsValid()) { |
| *duplicate_loc = classifier.duplicate_formal_parameter_error().location; |
| } |