Index: runtime/vm/parser.cc |
diff --git a/runtime/vm/parser.cc b/runtime/vm/parser.cc |
index 868c27bf54dea1be6e5fe128767128e497a9a605..18ba08e507399bb047e2a40fca7e4b32e89111a8 100644 |
--- a/runtime/vm/parser.cc |
+++ b/runtime/vm/parser.cc |
@@ -3504,12 +3504,10 @@ SequenceNode* Parser::ParseFunc(const Function& func, bool check_semicolon) { |
ASSERT(AbstractType::Handle(Z, func.result_type()).IsResolved()); |
ASSERT(func.NumParameters() == params.parameters->length()); |
if (!Function::Handle(func.parent_function()).IsGetterFunction()) { |
- // Parse and discard any formal parameters. They are accessed as |
- // context variables. |
- ParamList discarded_params; |
- ParseFormalParameterList(allow_explicit_default_values, |
- false, |
- &discarded_params); |
+ // Skip formal parameters. They are accessed as context variables. |
+ // Parsing them again (and discarding them) does not work in case of |
+ // default values with same name as already parsed formal parameter. |
+ SkipToMatchingParenthesis(); |
} |
} else if (func.IsSyncGenClosure()) { |
AddSyncGenClosureParameters(¶ms); |
@@ -3517,12 +3515,10 @@ SequenceNode* Parser::ParseFunc(const Function& func, bool check_semicolon) { |
AddFormalParamsToScope(¶ms, current_block_->scope); |
ASSERT(AbstractType::Handle(Z, func.result_type()).IsResolved()); |
if (!Function::Handle(func.parent_function()).IsGetterFunction()) { |
- // Parse and discard any formal parameters. They are accessed as |
- // context variables. |
- ParamList discarded_params; |
- ParseFormalParameterList(allow_explicit_default_values, |
- false, |
- &discarded_params); |
+ // Skip formal parameters. They are accessed as context variables. |
+ // Parsing them again (and discarding them) does not work in case of |
+ // default values with same name as already parsed formal parameter. |
+ SkipToMatchingParenthesis(); |
} |
} else if (func.IsAsyncGenClosure()) { |
AddAsyncGenClosureParameters(¶ms); |
@@ -3531,12 +3527,10 @@ SequenceNode* Parser::ParseFunc(const Function& func, bool check_semicolon) { |
ASSERT(AbstractType::Handle(Z, func.result_type()).IsResolved()); |
ASSERT(func.NumParameters() == params.parameters->length()); |
if (!Function::Handle(func.parent_function()).IsGetterFunction()) { |
- // Parse and discard any formal parameters. They are accessed as |
- // context variables. |
- ParamList discarded_params; |
- ParseFormalParameterList(allow_explicit_default_values, |
- false, |
- &discarded_params); |
+ // Skip formal parameters. They are accessed as context variables. |
+ // Parsing them again (and discarding them) does not work in case of |
+ // default values with same name as already parsed formal parameter. |
+ SkipToMatchingParenthesis(); |
} |
} else { |
ParseFormalParameterList(allow_explicit_default_values, false, ¶ms); |
@@ -11251,6 +11245,8 @@ LiteralNode* Parser::FoldConstExpr(TokenPosition expr_pos, AstNode* expr) { |
return expr->AsLiteralNode(); |
} |
if (expr->EvalConstExpr() == NULL) { |
+ // DEBUG |
+ expr->EvalConstExpr(); |
hausner
2016/10/25 15:04:55
Why do you evaluate the expression a second time?
regis
2016/10/25 15:08:46
Oops. Let's blame it on the jetlag.
Removed. Thank
|
ReportError(expr_pos, "expression is not a valid compile-time constant"); |
} |
return new(Z) LiteralNode(expr_pos, EvaluateConstExpr(expr_pos, expr)); |
@@ -14702,10 +14698,7 @@ void Parser::SkipFunctionLiteral() { |
ExpectIdentifier("function name expected"); |
} |
if (CurrentToken() == Token::kLPAREN) { |
- const bool allow_explicit_default_values = true; |
- ParamList params; |
- params.skipped = true; |
- ParseFormalParameterList(allow_explicit_default_values, false, ¶ms); |
+ SkipToMatchingParenthesis(); |
} |
RawFunction::AsyncModifier async_modifier = ParseFunctionModifier(); |
BoolScope allow_await(&this->await_is_keyword_, |