Home | History | Annotate | Download | only in parsing

Lines Matching refs:Impl

95   if (!*ok) return impl()->x(__VA_ARGS__); \
104 // The Impl parameter is the actual class of the parser/pre-parser,
110 // template <typename Impl>
114 // // parser behavior. The Impl parameter is the actual derived
117 // template <typename Impl>
136 // implementation class Impl, it is expected to contain the following typedefs:
139 // struct ParserTypes<Impl> {
140 // // Synonyms for ParserBase<Impl> and Impl, respectively.
142 // typedef Impl;
168 template <typename Impl>
171 template <typename Impl>
174 // Shorten type names defined by ParserTypes<Impl>.
175 typedef ParserTypes<Impl> Types;
190 Impl* impl() { return static_cast<Impl*>(this); }
191 const Impl* impl() const { return static_cast<const Impl*>(this); }
252 friend class v8::internal::ExpressionClassifier<ParserTypes<Impl>>;
519 friend Impl;
630 : name(parser->impl()->EmptyIdentifier()),
632 pattern(parser->impl()->EmptyExpression()),
634 init_block(parser->impl()->NullBlock()),
635 inner_block(parser->impl()->NullBlock()),
667 extends(parser->impl()->EmptyExpression()),
668 properties(parser->impl()->NewClassPropertyList(4)),
669 instance_field_initializers(parser->impl()->NewExpressionList(0)),
670 constructor(parser->impl()->EmptyFunctionLiteral()),
864 impl()->ReportMessageAt(octal, message);
876 impl()->CountUsage(v8::Isolate::kDecimalWithLeadingZeroInStrictMode);
901 if (impl()->IsEvalOrArguments(function_name)) {
902 impl()->ReportMessageAt(function_name_loc,
908 impl()->ReportMessageAt(function_name_loc,
930 impl()->SetLanguageMode(scope(), old > mode ? old : mode);
945 impl()->ReportMessageAt(source_location, message,
953 impl()->ReportMessageAt(source_location, message, arg, error_type);
959 impl()->ReportMessageAt(location, message,
975 impl()->ReportMessageAt(error.location, error.message, error.arg,
1029 if (!impl()->IsIdentifier(expr)) {
1030 impl()->ReportMessageAt(scanner()->location(),
1300 if (!impl()->IsIdentifier(expression)) return false;
1302 impl()->IsEvalOrArguments(impl()->AsIdentifier(expression))) {
1317 if (impl()->IsIdentifier(expression) &&
1318 impl()->IsEval(impl()->AsIdentifier(expression))) {
1453 template <typename Impl>
1454 ParserBase<Impl>::FunctionState::FunctionState(
1479 template <typename Impl>
1480 ParserBase<Impl>::FunctionState::~FunctionState() {
1484 template <typename Impl>
1485 void ParserBase<Impl>::GetUnexpectedTokenMessage(
1543 template <typename Impl>
1544 void ParserBase<Impl>::ReportUnexpectedToken(Token::Value token) {
1548 template <typename Impl>
1549 void ParserBase<Impl>::ReportUnexpectedTokenAt(
1554 impl()->ReportMessageAt(source_location, message, arg);
1557 template <typename Impl>
1558 typename ParserBase<Impl>::IdentifierT ParserBase<Impl>::ParseIdentifier(
1571 template <typename Impl>
1572 typename ParserBase<Impl>::IdentifierT
1573 ParserBase<Impl>::ParseAndClassifyIdentifier(bool* ok) {
1577 IdentifierT name = impl()->GetSymbol();
1584 if (impl()->IsEvalOrArguments(name)) {
1612 return impl()->EmptyIdentifier();
1620 return impl()->GetSymbol();
1624 return impl()->EmptyIdentifier();
1628 template <class Impl>
1629 typename ParserBase<Impl>::IdentifierT
1630 ParserBase<Impl>::ParseIdentifierOrStrictReservedWord(
1644 return impl()->EmptyIdentifier();
1647 return impl()->GetSymbol();
1650 template <typename Impl>
1651 typename ParserBase<Impl>::IdentifierT ParserBase<Impl>::ParseIdentifierName(
1662 return impl()->EmptyIdentifier();
1665 return impl()->GetSymbol();
1668 template <typename Impl>
1669 typename ParserBase<Impl>::ExpressionT ParserBase<Impl>::ParseRegExpLiteral(
1676 return impl()->EmptyExpression();
1681 IdentifierT js_pattern = impl()->GetNextSymbol();
1687 return impl()->EmptyExpression();
1694 template <typename Impl>
1695 typename ParserBase<Impl>::ExpressionT ParserBase<Impl>::ParsePrimaryExpression(
1719 return impl()->ThisExpression(beg_pos);
1728 return impl()->ExpressionFromLiteral(Next(), beg_pos);
1749 return impl()->ExpressionFromIdentifier(name, beg_pos);
1755 return impl()->ExpressionFromString(beg_pos);
1803 IdentifierT name = impl()->EmptyIdentifier();
1818 return ParseTemplateLiteral(impl()->NoTemplateTag(), beg_pos, ok);
1840 return impl()->EmptyExpression();
1843 template <typename Impl>
1844 typename ParserBase<Impl>::ExpressionT ParserBase<Impl>::ParseExpression(
1848 impl()->RewriteNonPattern(CHECK_OK);
1852 template <typename Impl>
1853 typename ParserBase<Impl>::ExpressionT
1854 ParserBase<Impl>::ParseExpressionCoverGrammar(bool accept_IN, bool* ok) {
1859 ExpressionT result = impl()->EmptyExpression();
1881 impl()->Accumulate(ExpressionClassifier::AllProductions &
1884 if (!impl()->IsIdentifier(right)) classifier()->RecordNonSimpleParameter();
1885 if (impl()->IsEmptyExpression(result)) {
1910 template <typename Impl>
1911 typename ParserBase<Impl>::ExpressionT ParserBase<Impl>::ParseArrayLiteral(
1917 ExpressionListT values = impl()->NewExpressionList(4);
1923 elem = impl()->GetLiteralTheHole(peek_position());
1968 impl()->QueueNonPatternForRewriting(result, ok);
1975 return impl()->EmptyExpression();
1981 template <class Impl>
1982 bool ParserBase<Impl>::SetPropertyKindFromToken(Token::Value token,
2009 template <class Impl>
2010 typename ParserBase<Impl>::ExpressionT ParserBase<Impl>::ParsePropertyName(
2033 *name = impl()->GetSymbol(); // TODO(bakkot) specialize on 'async'
2034 impl()->PushLiteralName(*name);
2048 *name = impl()->GetSymbol();
2049 impl()->PushLiteralName(*name);
2065 ExpressionT expression = impl()->EmptyExpression();
2069 *name = impl()->GetSymbol();
2074 *name = impl()->GetNumberAsSymbol();
2079 *name = impl()->GetNumberAsSymbol();
2083 *name = impl()->EmptyIdentifier();
2088 impl()->RewriteNonPattern(CHECK_OK);
2089 impl()->AccumulateFormalParameterContainmentErrors();
2107 impl()->PushLiteralName(*name);
2110 return impl()->IsArrayIndex(*name, &index)
2115 template <typename Impl>
2116 typename ParserBase<Impl>::ClassLiteralPropertyT
2117 ParserBase<Impl>::ParseClassPropertyDefinition(ClassLiteralChecker* checker,
2132 IdentifierT name = impl()->EmptyIdentifier();
2138 name = impl()->GetSymbol(); // TODO(bakkot) specialize on 'static'
2142 name = impl()->GetSymbol(); // TODO(bakkot) specialize on 'static'
2178 return impl()->EmptyClassLiteralProperty();
2199 if (!is_static && impl()->IsConstructor(name)) {
2205 ExpressionT value = impl()->ParseFunctionLiteral(
2232 FunctionLiteralT value = impl()->ParseFunctionLiteral(
2238 impl()->AddAccessorPrefixToFunctionName(is_get, value, name);
2248 return impl()->EmptyClassLiteralProperty();
2251 template <typename Impl>
2252 typename ParserBase<Impl>::FunctionLiteralT
2253 ParserBase<Impl>::ParseClassFieldForInitializer(bool has_initializer,
2269 impl()->RewriteNonPattern(CHECK_OK_CUSTOM(EmptyFunctionLiteral));
2274 typename Types::StatementList body = impl()->NewStatementList(1);
2277 impl()->EmptyIdentifierString(), initializer_scope, body,
2287 template <typename Impl>
2288 typename ParserBase<Impl>::ObjectLiteralPropertyT
2289 ParserBase<Impl>::ParseObjectPropertyDefinition(ObjectLiteralChecker* checker,
2298 IdentifierT name = impl()->EmptyIdentifier();
2324 impl()->SetFunctionNameFromPropertyName(result, name);
2344 return impl()->EmptyObjectLiteralProperty();
2355 if (impl()->IsEvalOrArguments(name) && is_strict(language_mode())) {
2370 ExpressionT lhs = impl()->ExpressionFromIdentifier(name, next_beg_pos);
2379 impl()->RewriteNonPattern(CHECK_OK_CUSTOM(EmptyObjectLiteralProperty));
2380 impl()->AccumulateFormalParameterContainmentErrors();
2387 impl()->SetFunctionNameFromIdentifierRef(rhs, lhs);
2412 ExpressionT value = impl()->ParseFunctionLiteral(
2441 FunctionLiteralT value = impl()->ParseFunctionLiteral(
2447 impl()->AddAccessorPrefixToFunctionName(is_get, value, name);
2460 return impl()->EmptyObjectLiteralProperty();
2463 return impl()->EmptyObjectLiteralProperty();
2466 template <typename Impl>
2467 typename ParserBase<Impl>::ExpressionT ParserBase<Impl>::ParseObjectLiteral(
2474 impl()->NewObjectPropertyList(4);
2493 if (!has_computed_names && impl()->IsBoilerplateProperty(property)) {
2516 template <typename Impl>
2517 typename ParserBase<Impl>::ExpressionListT ParserBase<Impl>::ParseArguments(
2523 ExpressionListT result = impl()->NewExpressionList(4);
2536 impl()->RewriteNonPattern(CHECK_OK_CUSTOM(NullExpressionList));
2559 return impl()->NullExpressionList();
2572 impl()->ReportMessageAt(location, MessageTemplate::kUnterminatedArgList);
2574 return impl()->NullExpressionList();
2580 impl()->RewriteNonPattern(CHECK_OK_CUSTOM(NullExpressionList));
2586 impl()->MaterializeUnspreadArgumentsLiterals(unspread_sequences_count);
2594 template <typename Impl>
2595 typename ParserBase<Impl>::ExpressionT
2596 ParserBase<Impl>::ParseAssignmentExpression(bool accept_IN, bool* ok) {
2633 if (is_async && impl()->IsIdentifier(expression) && peek_any_identifier() &&
2638 impl()->ExpressionFromIdentifier(name, position(), InferName::kNo);
2678 impl()->DeclareArrowFunctionFormalParameters(&parameters, expression, loc,
2684 impl()->Discard();
2720 impl()->Accumulate(productions);
2724 impl()->Accumulate(productions, false);
2735 expression = impl()->MarkExpressionAsAssigned(expression);
2748 impl()->RewriteNonPattern(CHECK_OK);
2749 impl()->AccumulateFormalParameterContainmentErrors();
2756 if (op == Token::ASSIGN && impl()->IsThisProperty(expression)) {
2760 impl()->CheckAssigningFunctionLiteralToProperty(expression, right);
2775 impl()->SetFunctionNameFromIdentifierRef(right, expression);
2780 return impl()->RewriteAssignExponentiation(expression, right, pos);
2787 impl()->QueueDestructuringAssignmentForRewriting(result);
2793 template <typename Impl>
2794 typename ParserBase<Impl>::ExpressionT ParserBase<Impl>::ParseYieldExpression(
2807 ExpressionT expression = impl()->EmptyExpression();
2827 impl()->RewriteNonPattern(CHECK_OK);
2833 return impl()->RewriteYieldStar(generator_object, expression, pos);
2836 expression = impl()->BuildIteratorResult(expression, false);
2845 template <typename Impl>
2846 typename ParserBase<Impl>::ExpressionT
2847 ParserBase<Impl>::ParseConditionalExpression(bool accept_IN,
2857 impl()->RewriteNonPattern(CHECK_OK);
2865 impl()->RewriteNonPattern(CHECK_OK);
2868 impl()->RewriteNonPattern(CHECK_OK);
2874 template <typename Impl>
2875 typename ParserBase<Impl>::ExpressionT ParserBase<Impl>::ParseBinaryExpression(
2882 impl()->RewriteNonPattern(CHECK_OK);
2891 impl()->RewriteNonPattern(CHECK_OK);
2893 if (impl()->ShortcutNumericLiteralBinaryExpression(&x, y, op, pos)) {
2914 x = impl()->RewriteExponentiation(x, y, pos);
2924 template <typename Impl>
2925 typename ParserBase<Impl>::ExpressionT ParserBase<Impl>::ParseUnaryExpression(
2948 impl()->RewriteNonPattern(CHECK_OK);
2951 if (impl()->IsIdentifier(expression)) {
2955 return impl()->EmptyExpression();
2962 return impl()->EmptyExpression();
2966 return impl()->BuildUnaryExpression(expression, op, pos);
2976 expression = impl()->MarkExpressionAsAssigned(expression);
2977 impl()->RewriteNonPattern(CHECK_OK);
2994 return impl()->RewriteAwaitExpression(value, await_pos);
3000 template <typename Impl>
3001 typename ParserBase<Impl>::ExpressionT ParserBase<Impl>::ParsePostfixExpression(
3016 expression = impl()->MarkExpressionAsAssigned(expression);
3017 impl()->RewriteNonPattern(CHECK_OK);
3029 template <typename Impl>
3030 typename ParserBase<Impl>::ExpressionT
3031 ParserBase<Impl>::ParseLeftHandSideExpression(bool* ok) {
3042 impl()->RewriteNonPattern(CHECK_OK);
3048 impl()->RewriteNonPattern(CHECK_OK);
3056 impl()->RewriteNonPattern(CHECK_OK);
3080 if (V8_UNLIKELY(is_async && impl()->IsIdentifier(result))) {
3093 return impl()->EmptyExpression();
3097 return impl()->ExpressionListToExpression(args);
3102 impl()->AccumulateFormalParameterContainmentErrors();
3122 args = impl()->PrepareSpreadArguments(args);
3123 result = impl()->SpreadCall(result, args, pos);
3131 result = impl()->RewriteSuperCall(result);
3132 ExpressionT this_expr = impl()->ThisExpression(pos);
3142 impl()->RewriteNonPattern(CHECK_OK);
3150 impl()->PushLiteralName(name);
3156 impl()->RewriteNonPattern(CHECK_OK);
3169 template <typename Impl>
3170 typename ParserBase<Impl>::ExpressionT
3171 ParserBase<Impl>::ParseMemberWithNewPrefixesExpression(bool* is_async,
3207 impl()->RewriteNonPattern(CHECK_OK);
3214 args = impl()->PrepareSpreadArguments(args);
3215 result = impl()->SpreadCallNew(result, args, new_pos);
3224 return factory()->NewCallNew(result, impl()->NewExpressionList(0), new_pos);
3230 template <typename Impl>
3231 typename ParserBase<Impl>::ExpressionT ParserBase<Impl>::ParseMemberExpression(
3257 impl()->ReportMessageAt(scanner()->location(),
3260 return impl()->EmptyExpression();
3263 return impl()->FunctionSentExpression(pos);
3269 IdentifierT name = impl()->EmptyIdentifier();
3280 result = impl()->ParseFunctionLiteral(
3297 template <typename Impl>
3298 typename ParserBase<Impl>::ExpressionT ParserBase<Impl>::ParseSuperExpression(
3309 return impl()->NewSuperPropertyReference(pos);
3316 return impl()->NewSuperCallReference(pos);
3320 impl()->ReportMessageAt(scanner()->location(),
3323 return impl()->EmptyExpression();
3326 template <typename Impl>
3327 void ParserBase<Impl>::ExpectMetaProperty(Vector<const char> property_name,
3333 impl()->ReportMessageAt(
3340 template <typename Impl>
3341 typename ParserBase<Impl>::ExpressionT
3342 ParserBase<Impl>::ParseNewTargetExpression(bool* ok) {
3347 impl()->ReportMessageAt(scanner()->location(),
3350 return impl()->EmptyExpression();
3353 return impl()->NewTargetExpression(pos);
3356 template <typename Impl>
3357 typename ParserBase<Impl>::ExpressionT
3358 ParserBase<Impl>::ParseMemberExpressionContinuation(ExpressionT expression,
3366 impl()->RewriteNonPattern(CHECK_OK);
3373 impl()->RewriteNonPattern(CHECK_OK);
3375 impl()->PushPropertyName(index);
3381 impl()->RewriteNonPattern(CHECK_OK);
3390 impl()->PushLiteralName(name);
3396 impl()->RewriteNonPattern(CHECK_OK);
3416 return impl()->EmptyExpression();
3423 return impl()->EmptyExpression();
3426 template <typename Impl>
3427 void ParserBase<Impl>::ParseFormalParameter(FormalParametersT* parameters,
3436 if (!impl()->IsIdentifier(pattern)) {
3442 ExpressionT initializer = impl()->EmptyExpression();
3446 impl()->RewriteNonPattern(CHECK_OK_CUSTOM(Void));
3449 impl()->Discard();
3452 impl()->SetFunctionNameFromIdentifierRef(initializer, pattern);
3455 impl()->AddFormalParameter(parameters, pattern, initializer,
3459 template <typename Impl>
3460 void ParserBase<Impl>::ParseFormalParameterList(FormalParametersT* parameters,
3489 impl()->ReportMessageAt(scanner()->peek_location(),
3506 impl()->DeclareFormalParameter(parameters->scope, parameter);
3510 template <typename Impl>
3511 typename ParserBase<Impl>::BlockT ParserBase<Impl>::ParseVariableDeclarations(
3527 BlockT init_block = impl()->NullBlock();
3565 ExpressionT pattern = impl()->EmptyExpression();
3578 bool single_name = impl()->IsIdentifier(pattern);
3581 impl()->PushVariableName(impl()->AsIdentifier(pattern));
3584 ExpressionT value = impl()->EmptyExpression();
3590 impl()->RewriteNonPattern(CHECK_OK_CUSTOM(NullBlock));
3606 impl()->SetFunctionNameFromIdentifierRef(value, pattern);
3614 !impl()->IsIdentifier(pattern)) {
3615 impl()->ReportMessageAt(
3618 !impl()->IsIdentifier(pattern) ? "destructuring" : "const");
3620 return impl()->NullBlock();
3624 value = impl()->GetLiteralUndefined(position());
3642 impl()->DeclareAndInitializeVariables(init_block,
3655 template <typename Impl>
3656 typename ParserBase<Impl>::StatementT
3657 ParserBase<Impl>::ParseFunctionDeclaration(bool* ok) {
3662 impl()->ReportMessageAt(scanner()->location(),
3665 return impl()->NullStatement();
3670 template <typename Impl>
3671 typename ParserBase<Impl>::StatementT
3672 ParserBase<Impl>::ParseHoistableDeclaration(
3683 template <typename Impl>
3684 typename ParserBase<Impl>::StatementT
3685 ParserBase<Impl>::ParseHoistableDeclaration(
3707 impl()->GetDefaultStrings(&name, &variable_name);
3719 impl()->PushEnclosingName(name);
3720 FunctionLiteralT function = impl()->ParseFunctionLiteral(
3728 return impl()->DeclareFunction(variable_name, function, pos, is_generator,
3732 template <typename Impl>
3733 typename ParserBase<Impl>::StatementT ParserBase<Impl>::ParseClassDeclaration(
3754 IdentifierT name = impl()->EmptyIdentifier();
3756 IdentifierT variable_name = impl()->EmptyIdentifier();
3758 impl()->GetDefaultStrings(&name, &variable_name);
3770 return impl()->DeclareClass(variable_name, value, names, class_token_pos,
3778 template <typename Impl>
3779 typename ParserBase<Impl>::StatementT ParserBase<Impl>::ParseNativeDeclaration(
3795 return impl()->DeclareNative(name, pos, ok);
3798 template <typename Impl>
3799 typename ParserBase<Impl>::StatementT
3800 ParserBase<Impl>::ParseAsyncFunctionDeclaration(
3809 impl()->ReportUnexpectedToken(scanner()->current_token());
3810 return impl()->NullStatement();
3817 template <typename Impl>
3818 void ParserBase<Impl>::CheckArityRestrictions(int param_count,
3825 impl()->ReportMessageAt(
3832 impl()->ReportMessageAt(
3838 impl()->ReportMessageAt(
3846 template <typename Impl>
3847 bool ParserBase<Impl>::IsNextLetKeyword() {
3871 template <typename Impl>
3872 bool ParserBase<Impl>::IsTrivialExpression() {
3889 template <typename Impl>
3890 typename ParserBase<Impl>::ExpressionT
3891 ParserBase<Impl>::ParseArrowFunctionLiteral(
3895 Impl::IsPreParser() ? &RuntimeCallStats::ParseArrowFunctionLiteral
3904 return impl()->EmptyExpression();
3907 StatementListT body = impl()->NullStatementList();
3914 bool can_preparse = impl()->parse_lazily() &&
3919 can_preparse && impl()->AllowsLazyParsingWithoutUnresolvedVariables();
3929 impl()->ReindexLiterals(formal_parameters);
3948 LazyParsingResult result = impl()->SkipFunction(
3975 body = impl()->ParseEagerFunctionBody(
3976 impl()->EmptyIdentifier(), kNoSourcePosition, formal_parameters,
3990 body = impl()->NewStatementList(1);
3991 impl()->AddParameterInitializationBlock(
3998 impl()->RewriteNonPattern(CHECK_OK);
4001 impl()->RewriteNonPattern(CHECK_OK);
4007 impl()->MarkTailPosition(expression);
4012 impl()->MarkCollectedTailCallExpressions();
4030 impl()->CheckConflictingVarDeclarations(formal_parameters.scope, CHECK_OK);
4032 impl()->RewriteDestructuringAssignments();
4042 impl()->EmptyIdentifierString(), formal_parameters.scope, body,
4055 impl()->AddFunctionForNameInference(function_literal);
4060 template <typename Impl>
4061 typename ParserBase<Impl>::ExpressionT ParserBase<Impl>::ParseClassLiteral(
4066 impl()->ReportMessageAt(class_name_location,
4069 return impl()->EmptyExpression();
4071 if (impl()->IsEvalOrArguments(name)) {
4072 impl()->ReportMessageAt(class_name_location,
4075 return impl()->EmptyExpression();
4082 impl()->DeclareClassVariable(name, block_state.scope(), &class_info,
4089 impl()->RewriteNonPattern(CHECK_OK);
4090 impl()->AccumulateFormalParameterContainmentErrors();
4099 const bool has_extends = !impl()->IsEmptyExpression(class_info.extends);
4109 impl()->RewriteNonPattern(CHECK_OK);
4110 impl()->AccumulateFormalParameterContainmentErrors();
4112 impl()->DeclareClassProperty(name, property, &class_info, CHECK_OK);
4113 impl()->InferFunctionName();
4117 return impl()->RewriteClassLiteral(name, &class_info, class_token_pos, ok);
4120 template <typename Impl>
4121 void ParserBase<Impl>::ParseAsyncFunctionBody(Scope* scope, StatementListT body,
4128 impl()->PrepareAsyncFunctionBody(body, kind, pos);
4132 ExpressionT return_value = impl()->EmptyExpression();
4139 impl()->RewriteNonPattern(CHECK_OK_CUSTOM(Void));
4142 impl()->RewriteAsyncFunctionBody(body, block, return_value,
4147 template <typename Impl>
4148 typename ParserBase<Impl>::ExpressionT
4149 ParserBase<Impl>::ParseAsyncFunctionLiteral(bool* ok) {
4160 IdentifierT name = impl()->EmptyIdentifier();
4168 return impl()->ParseFunctionLiteral(
4175 template <typename Impl>
4176 typename ParserBase<Impl>::ExpressionT ParserBase<Impl>::ParseTemplateLiteral(
4197 typename Impl::TemplateLiteralState ts = impl()->OpenTemplateLiteral(pos);
4198 impl()->AddTemplateSpan(&ts, true);
4199 return impl()->CloseTemplateLiteral(&ts, start, tag);
4204 typename Impl::TemplateLiteralState ts = impl()->OpenTemplateLiteral(pos);
4205 impl()->AddTemplateSpan(&ts, false);
4216 impl()->ReportMessageAt(Scanner::Location(start, peek_position()),
4219 return impl()->EmptyExpression();
4221 impl()->ReportMessageAt(
4225 return impl()->EmptyExpression();
4230 impl()->RewriteNonPattern(CHECK_OK);
4231 impl()->AddTemplateExpression(&ts, expression);
4234 impl()->ReportMessageAt(Scanner::Location(expr_pos, peek_position()),
4237 return impl()->EmptyExpression();
4247 impl()->ReportMessageAt(Scanner::Location(start, pos),
4250 return impl()->EmptyExpression();
4252 impl()->ReportMessageAt(
4256 return impl()->EmptyExpression();
4259 impl()->AddTemplateSpan(&ts, next == Token::TEMPLATE_TAIL);
4265 return impl()->CloseTemplateLiteral(&ts, start, tag);
4268 template <typename Impl>
4269 typename ParserBase<Impl>::ExpressionT
4270 ParserBase<Impl>::CheckAndRewriteReferenceExpression(
4277 template <typename Impl>
4278 typename ParserBase<Impl>::ExpressionT
4279 ParserBase<Impl>::CheckAndRewriteReferenceExpression(
4282 if (impl()->IsIdentifier(expression) && is_strict(language_mode()) &&
4283 impl()->IsEvalOrArguments(impl()->AsIdentifier(expression))) {
4287 return impl()->EmptyExpression();
4295 ExpressionT error = impl()->NewThrowReferenceError(message, beg_pos);
4300 return impl()->EmptyExpression();
4303 template <typename Impl>
4304 bool ParserBase<Impl>::IsValidReferenceExpression(ExpressionT expression) {
4308 template <typename Impl>
4309 void ParserBase<Impl>::CheckDestructuringElement(ExpressionT expression,
4319 template <typename Impl>
4320 typename ParserBase<Impl>::ExpressionT ParserBase<Impl>::ParseV8Intrinsic(
4335 return impl()->NewV8Intrinsic(name, args, pos, ok);
4338 template <typename Impl>
4339 typename ParserBase<Impl>::ExpressionT ParserBase<Impl>::ParseDoExpression(
4347 return impl()->RewriteDoExpression(block, pos, ok);
4354 template <typename Impl>
4355 typename ParserBase<Impl>::LazyParsingResult
4356 ParserBase<Impl>::ParseStatementList(StatementListT body, int end_token,
4368 DCHECK(!impl()->IsNullStatementList(body));
4381 if (impl()->IsNullStatement(stat) || impl()->IsEmptyStatement(stat)) {
4391 if (impl()->IsUseStrictDirective(stat) &&
4399 impl()->ReportMessageAt(
4405 } else if (impl()->IsUseAsmDirective(stat) &&
4409 impl()->SetAsmModule();
4410 } else if (impl()->IsStringLiteral(stat)) {
4441 template <typename Impl>
4442 typename ParserBase<Impl>::StatementT ParserBase<Impl>::ParseStatementListItem(
4488 template <typename Impl>
4489 typename ParserBase<Impl>::StatementT ParserBase<Impl>::ParseStatement(
4559 impl()->ReportMessageAt(scanner()->peek_location(),
4564 return impl()->NullStatement();
4577 template <typename Impl>
4578 typename ParserBase<Impl>::StatementT
4579 ParserBase<Impl>::ParseStatementAsUnlabelled(
4594 return impl()->NullStatement();
4598 template <typename Impl>
4599 typename ParserBase<Impl>::BlockT ParserBase<Impl>::ParseBlock(
4616 if (!impl()->IsNullStatement(stat) && !impl()->IsEmptyStatement(stat)) {
4628 template <typename Impl>
4629 typename ParserBase<Impl>::StatementT ParserBase<Impl>::ParseScopedStatement(
4635 impl()->CountUsage(v8::Isolate::kLegacyFunctionDeclaration);
4650 template <typename Impl>
4651 typename ParserBase<Impl>::StatementT ParserBase<Impl>::ParseVariableStatement(
4676 template <typename Impl>
4677 typename ParserBase<Impl>::StatementT ParserBase<Impl>::ParseDebuggerStatement(
4691 template <typename Impl>
4692 typename ParserBase<Impl>::StatementT
4693 ParserBase<Impl>::ParseExpressionOrLabelledStatement(
4712 return impl()->NullStatement();
4720 impl()->IsIdentifier(expr)) {
4723 labels = impl()->DeclareLabel(labels, impl()->AsIdentifierExpression(expr),
4741 !scanner()->HasAnyLineTerminatorBeforeNext() && impl()->IsNative(expr) &&
4751 template <typename Impl>
4752 typename ParserBase<Impl>::StatementT ParserBase<Impl>::ParseIfStatement(
4763 StatementT else_statement = impl()->NullStatement();
4773 template <typename Impl>
4774 typename ParserBase<Impl>::StatementT ParserBase<Impl>::ParseContinueStatement(
4781 IdentifierT label = impl()->EmptyIdentifier();
4789 impl()->LookupContinueTarget(label, CHECK_OK);
4790 if (impl()->IsNullStatement(target)) {
4793 if (!impl()->IsEmptyIdentifier(label)) {
4798 return impl()->NullStatement();
4804 template <typename Impl>
4805 typename ParserBase<Impl>::StatementT ParserBase<Impl>::ParseBreakStatement(
4812 IdentifierT label = impl()->EmptyIdentifier();
4821 if (!impl()->IsEmptyIdentifier(label) &&
4822 impl()->ContainsLabel(labels, label)) {
4827 impl()->LookupBreakTarget(label, CHECK_OK);
4828 if (impl()->IsNullStatement(target)) {
4831 if (!impl()->IsEmptyIdentifier(label)) {
4836 return impl()->NullStatement();
4842 template <typename Impl>
4843 typename ParserBase<Impl>::StatementT ParserBase<Impl>::ParseReturnStatement(
4858 impl()->ReportMessageAt(loc, MessageTemplate::kIllegalReturn);
4860 return impl()->NullStatement();
4866 ExpressionT return_value = impl()->EmptyExpression();
4870 return_value = impl()->ThisExpression(loc.beg_pos);
4872 return_value = impl()->GetLiteralUndefined(position());
4892 return_value = impl()->RewriteReturn(return_value, loc.beg_pos);
4896 template <typename Impl>
4897 typename ParserBase<Impl>::StatementT ParserBase<Impl>::ParseWithStatement(
4908 return impl()->NullStatement();
4916 StatementT body = impl()->NullStatement();
4926 template <typename Impl>
4927 typename ParserBase<Impl>::StatementT ParserBase<Impl>::ParseDoWhileStatement(
4953 template <typename Impl>
4954 typename ParserBase<Impl>::StatementT ParserBase<Impl>::ParseWhileStatement(
4972 template <typename Impl>
4973 typename ParserBase<Impl>::StatementT ParserBase<Impl>::ParseThrowStatement(
4983 return impl()->NullStatement();
4988 return impl()->NewThrowStatement(exception, pos);
4991 template <typename Impl>
4992 typename ParserBase<Impl>::StatementT ParserBase<Impl>::ParseSwitchStatement(
5016 auto cases = impl()->NewCaseClauseList(4);
5020 ExpressionT label = impl()->EmptyExpression();
5028 return impl()->NullStatement();
5034 StatementListT statements = impl()->NewStatementList(5);
5046 return impl()->RewriteSwitchStatement(
5051 template <typename Impl>
5052 typename ParserBase<Impl>::StatementT ParserBase<Impl>::ParseTryStatement(
5068 BlockT try_block = impl()->NullBlock();
5081 return impl()->NullStatement();
5084 BlockT catch_block = impl()->NullBlock();
5120 impl()->RewriteCatchPattern(&catch_info, CHECK_OK);
5121 if (!impl()->IsNullStatement(catch_info.init_block)) {
5127 impl()->ValidateCatchBlock(catch_info, CHECK_OK);
5138 BlockT finally_block = impl()->NullBlock();
5139 DCHECK(peek() == Token::FINALLY || !impl()->IsNullStatement(catch_block));
5144 return impl()->RewriteTryStatement(try_block, catch_block, finally_block,
5148 template <typename Impl>
5149 typename ParserBase<Impl>::StatementT ParserBase<Impl>::ParseForStatement(
5162 StatementT init = impl()->NullStatement();
5177 impl()->ReportMessageAt(
5182 return impl()->NullStatement();
5188 !impl()->IsIdentifier(
5190 impl()->ReportMessageAt(
5195 return impl()->NullStatement();
5198 BlockT init_block = impl()->RewriteForVarInLegacy(for_info);
5206 ExpressionT enumerable = impl()->EmptyExpression();
5210 impl()->RewriteNonPattern(CHECK_OK);
5217 StatementT final_loop = impl()->NullStatement();
5226 BlockT body_block = impl()->NullBlock();
5227 ExpressionT each_variable = impl()->EmptyExpression();
5228 impl()->DesugarBindingInForEachStatement(&for_info, &body_block,
5231 final_loop = impl()->InitializeForEachStatement(
5239 impl()->CreateForEachStatementTDZ(init_block, for_info, ok);
5244 if (!impl()->IsNullStatement(init_block)) {
5254 init = impl()->BuildInitializationBlock(
5273 impl()->RewriteNonPattern(CHECK_OK);
5279 expression = impl()->CheckAndRewriteReferenceExpression(
5290 ExpressionT enumerable = impl()->EmptyExpression();
5294 impl()->RewriteNonPattern(CHECK_OK);
5311 StatementT final_loop = impl()->InitializeForEachStatement(
5335 ExpressionT cond = impl()->EmptyExpression();
5336 StatementT next = impl()->NullStatement();
5337 StatementT body = impl()->NullStatement();
5365 auto result = impl()->DesugarLexicalBindingsInForStatement(
5392 if (!impl()->IsNullStatement(init)) {
5409 template <typename Impl>
5410 void ParserBase<Impl>::ObjectLiteralChecker::CheckDuplicateProto(
5424 template <typename Impl>
5425 void ParserBase<Impl>::ClassLiteralChecker::CheckClassMethodName(