| Index: src/preparser.h
|
| diff --git a/src/preparser.h b/src/preparser.h
|
| index 4f710fb65a7301543da44fa206300506d9afd255..69005df4954e15a2dceb8ccabd250a45fb2b081b 100644
|
| --- a/src/preparser.h
|
| +++ b/src/preparser.h
|
| @@ -30,6 +30,7 @@ struct FormalParametersBase {
|
| Scope* scope;
|
| bool has_rest = false;
|
| bool is_simple = true;
|
| + bool contains_expressions = false;
|
| int materialized_literals_count = 0;
|
| mutable int rest_array_literal_index = -1;
|
| };
|
| @@ -1788,7 +1789,8 @@ class PreParser : public ParserBase<PreParserTraits> {
|
| // the final '}'.
|
| PreParseResult PreParseLazyFunction(
|
| LanguageMode language_mode, FunctionKind kind, bool has_simple_parameters,
|
| - ParserRecorder* log, Scanner::BookmarkScope* bookmark = nullptr);
|
| + bool has_parameter_expressions, ParserRecorder* log,
|
| + Scanner::BookmarkScope* bookmark = nullptr);
|
|
|
| private:
|
| friend class PreParserTraits;
|
| @@ -2611,6 +2613,8 @@ ParserBase<Traits>::ParsePropertyDefinition(
|
| this->PushLiteralName(fni_, name);
|
| }
|
|
|
| + if (*is_computed_name) classifier->RecordContainsExpressions();
|
| +
|
| if (!in_class && !is_generator && peek() == Token::COLON) {
|
| // PropertyDefinition : PropertyName ':' AssignmentExpression
|
| if (!*is_computed_name) {
|
| @@ -2714,6 +2718,7 @@ ParserBase<Traits>::ParsePropertyDefinition(
|
| ExpressionClassifier::ExpressionProductions);
|
| value = factory()->NewAssignment(Token::ASSIGN, lhs, rhs,
|
| RelocInfo::kNoPosition);
|
| + classifier->RecordContainsExpressions();
|
| } else {
|
| value = lhs;
|
| }
|
| @@ -2904,6 +2909,11 @@ ParserBase<Traits>::ParseAssignmentExpression(bool accept_IN,
|
| if (!arrow_formals_classifier.is_simple_parameter_list()) {
|
| scope->SetHasNonSimpleParameters();
|
| parameters.is_simple = false;
|
| +
|
| + if (arrow_formals_classifier.contains_expressions()) {
|
| + parameters.contains_expressions = true;
|
| + scope->SetHasParameterExpressions();
|
| + }
|
| }
|
|
|
| Scanner::Location duplicate_loc = Scanner::Location::invalid();
|
| @@ -2948,6 +2958,8 @@ ParserBase<Traits>::ParseAssignmentExpression(bool accept_IN,
|
| classifier->RecordBindingPatternError(scanner()->location(),
|
| MessageTemplate::kUnexpectedToken,
|
| Token::String(op));
|
| + } else {
|
| + classifier->RecordContainsExpressions();
|
| }
|
| int pos = position();
|
|
|
| @@ -3743,6 +3755,7 @@ void ParserBase<Traits>::ParseFormalParameter(
|
| if (!*ok) return;
|
| parameters->is_simple = false;
|
| classifier->RecordNonSimpleParameter();
|
| + classifier->RecordContainsExpressions();
|
| }
|
|
|
| Traits::AddFormalParameter(parameters, pattern, initializer, is_rest);
|
| @@ -3793,6 +3806,11 @@ void ParserBase<Traits>::ParseFormalParameterList(
|
| }
|
| }
|
|
|
| + parameters->contains_expressions = classifier->contains_expressions();
|
| + if (parameters->contains_expressions) {
|
| + parameters->scope->SetHasParameterExpressions();
|
| + }
|
| +
|
| for (int i = 0; i < parameters->Arity(); ++i) {
|
| auto parameter = parameters->at(i);
|
| Traits::DeclareFormalParameter(parameters->scope, parameter, classifier);
|
|
|