[parser] Refactor of (Parse|Desugar)*(Async|Arrow)*

This patch moves the following parsing method to ParserBase:

- DesugarAsyncFunctionBody, renamed to ParseAsyncFunctionBody
- ParseAsyncFunctionExpression, renamed to ParseAsyncFunctionLiteral
- ParseAsyncFunctionDeclaration

It renames the parser implementation methods:

- ParseArrowFunctionFormalParameterList -> DeclareArrowFunctionFormalParameters
- ParseArrowFunctionFormalParameters -> AddArrowFunctionFormalParameters

It also eliminates method ParseAsyncArrowSingleExpressionBody.

R=adamk@chromium.org, marja@chromium.org
BUG=
LOG=N

Review-Url: https://codereview.chromium.org/2372733002
Cr-Commit-Position: refs/heads/master@{#39788}
This commit is contained in:
nikolaos 2016-09-27 11:01:58 -07:00 committed by Commit bot
parent b7913f33a3
commit dfb90f7c62
5 changed files with 170 additions and 187 deletions

View File

@ -250,6 +250,11 @@ class ParserBase {
kStatement,
kForStatement
};
enum class FunctionBodyType {
kNormal,
kSingleExpression
};
// clang-format on
class Checkpoint;
@ -1191,6 +1196,10 @@ class ParserBase {
ExpressionT ParseArrowFunctionLiteral(bool accept_IN,
const FormalParametersT& parameters,
bool* ok);
void ParseAsyncFunctionBody(Scope* scope, StatementListT body,
FunctionKind kind, FunctionBodyType type,
bool accept_IN, int pos, bool* ok);
ExpressionT ParseAsyncFunctionLiteral(bool* ok);
ExpressionT ParseTemplateLiteral(ExpressionT tag, int start, bool* ok);
ExpressionT ParseSuperExpression(bool is_new, bool* ok);
ExpressionT ParseNewTargetExpression(bool* ok);
@ -1205,6 +1214,8 @@ class ParserBase {
DeclarationParsingResult* parsing_result,
ZoneList<const AstRawString*>* names,
bool* ok);
StatementT ParseAsyncFunctionDeclaration(ZoneList<const AstRawString*>* names,
bool default_export, bool* ok);
StatementT ParseHoistableDeclaration(ZoneList<const AstRawString*>* names,
bool default_export, bool* ok);
StatementT ParseHoistableDeclaration(int pos, ParseFunctionFlags flags,
@ -1707,7 +1718,7 @@ typename ParserBase<Impl>::ExpressionT ParserBase<Impl>::ParsePrimaryExpression(
// '(' Expression ')'
// TemplateLiteral
// do Block
// AsyncFunctionExpression
// AsyncFunctionLiteral
int beg_pos = peek_position();
switch (peek()) {
@ -1730,7 +1741,7 @@ typename ParserBase<Impl>::ExpressionT ParserBase<Impl>::ParsePrimaryExpression(
!scanner()->HasAnyLineTerminatorAfterNext() &&
PeekAhead() == Token::FUNCTION) {
Consume(Token::ASYNC);
return impl()->ParseAsyncFunctionExpression(CHECK_OK);
return ParseAsyncFunctionLiteral(CHECK_OK);
}
// CoverCallExpressionAndAsyncArrowHead
*is_async = true;
@ -2667,6 +2678,9 @@ ParserBase<Impl>::ParseAssignmentExpression(bool accept_IN, bool* ok) {
// usage flags that might have been triggered there need to be copied
// to the arrow scope.
this->scope()->PropagateUsageFlagsToScope(scope);
scope_snapshot.Reparent(scope);
FormalParametersT parameters(scope);
if (!classifier()->is_simple_parameter_list()) {
scope->SetHasNonSimpleParameters();
@ -2677,8 +2691,8 @@ ParserBase<Impl>::ParseAssignmentExpression(bool accept_IN, bool* ok) {
scope->set_start_position(lhs_beg_pos);
Scanner::Location duplicate_loc = Scanner::Location::invalid();
impl()->ParseArrowFunctionFormalParameterList(
&parameters, expression, loc, &duplicate_loc, scope_snapshot, CHECK_OK);
impl()->DeclareArrowFunctionFormalParameters(&parameters, expression, loc,
&duplicate_loc, CHECK_OK);
if (duplicate_loc.IsValid()) {
classifier()->RecordDuplicateFormalParameterError(duplicate_loc);
}
@ -3805,6 +3819,25 @@ ParserBase<Impl>::ParseHoistableDeclaration(
is_async, names, ok);
}
template <typename Impl>
typename ParserBase<Impl>::StatementT
ParserBase<Impl>::ParseAsyncFunctionDeclaration(
ZoneList<const AstRawString*>* names, bool default_export, bool* ok) {
// AsyncFunctionDeclaration ::
// async [no LineTerminator here] function BindingIdentifier[Await]
// ( FormalParameters[Await] ) { AsyncFunctionBody }
DCHECK_EQ(scanner()->current_token(), Token::ASYNC);
int pos = position();
if (scanner()->HasAnyLineTerminatorBeforeNext()) {
*ok = false;
impl()->ReportUnexpectedToken(scanner()->current_token());
return impl()->NullStatement();
}
Expect(Token::FUNCTION, CHECK_OK_CUSTOM(NullStatement));
ParseFunctionFlags flags = ParseFunctionFlags::kIsAsync;
return ParseHoistableDeclaration(pos, flags, names, default_export, ok);
}
template <typename Impl>
void ParserBase<Impl>::CheckArityRestrictions(int param_count,
FunctionKind function_kind,
@ -3964,8 +3997,9 @@ ParserBase<Impl>::ParseArrowFunctionLiteral(
formal_parameters, body, kind == kAsyncArrowFunction, CHECK_OK);
ExpressionClassifier classifier(this);
if (kind == kAsyncArrowFunction) {
impl()->ParseAsyncArrowSingleExpressionBody(body, accept_IN, pos,
CHECK_OK);
ParseAsyncFunctionBody(scope(), body, kAsyncArrowFunction,
FunctionBodyType::kSingleExpression, accept_IN,
pos, CHECK_OK);
impl()->RewriteNonPattern(CHECK_OK);
} else {
ExpressionT expression = ParseAssignmentExpression(accept_IN, CHECK_OK);
@ -4019,6 +4053,61 @@ ParserBase<Impl>::ParseArrowFunctionLiteral(
return function_literal;
}
template <typename Impl>
void ParserBase<Impl>::ParseAsyncFunctionBody(Scope* scope, StatementListT body,
FunctionKind kind,
FunctionBodyType body_type,
bool accept_IN, int pos,
bool* ok) {
scope->ForceContextAllocation();
impl()->PrepareAsyncFunctionBody(body, kind, pos);
BlockT block = factory()->NewBlock(nullptr, 8, true, kNoSourcePosition);
ExpressionT return_value = impl()->EmptyExpression();
if (body_type == FunctionBodyType::kNormal) {
ParseStatementList(block->statements(), Token::RBRACE,
CHECK_OK_CUSTOM(Void));
return_value = factory()->NewUndefinedLiteral(kNoSourcePosition);
} else {
return_value = ParseAssignmentExpression(accept_IN, CHECK_OK_CUSTOM(Void));
impl()->RewriteNonPattern(CHECK_OK_CUSTOM(Void));
}
impl()->RewriteAsyncFunctionBody(body, block, return_value,
CHECK_OK_CUSTOM(Void));
scope->set_end_position(scanner()->location().end_pos);
}
template <typename Impl>
typename ParserBase<Impl>::ExpressionT
ParserBase<Impl>::ParseAsyncFunctionLiteral(bool* ok) {
// AsyncFunctionLiteral ::
// async [no LineTerminator here] function ( FormalParameters[Await] )
// { AsyncFunctionBody }
//
// async [no LineTerminator here] function BindingIdentifier[Await]
// ( FormalParameters[Await] ) { AsyncFunctionBody }
DCHECK_EQ(scanner()->current_token(), Token::ASYNC);
int pos = position();
Expect(Token::FUNCTION, CHECK_OK);
bool is_strict_reserved = false;
IdentifierT name = impl()->EmptyIdentifier();
FunctionLiteral::FunctionType type = FunctionLiteral::kAnonymousExpression;
if (peek_any_identifier()) {
type = FunctionLiteral::kNamedExpression;
name = ParseIdentifierOrStrictReservedWord(FunctionKind::kAsyncFunction,
&is_strict_reserved, CHECK_OK);
}
return impl()->ParseFunctionLiteral(
name, scanner()->location(),
is_strict_reserved ? kFunctionNameIsStrictReserved
: kFunctionNameValidityUnknown,
FunctionKind::kAsyncFunction, pos, type, language_mode(), CHECK_OK);
}
template <typename Impl>
typename ParserBase<Impl>::ExpressionT ParserBase<Impl>::ParseTemplateLiteral(
ExpressionT tag, int start, bool* ok) {
@ -4329,7 +4418,7 @@ typename ParserBase<Impl>::StatementT ParserBase<Impl>::ParseStatementListItem(
if (allow_harmony_async_await() && PeekAhead() == Token::FUNCTION &&
!scanner()->HasAnyLineTerminatorAfterNext()) {
Consume(Token::ASYNC);
return impl()->ParseAsyncFunctionDeclaration(nullptr, false, ok);
return ParseAsyncFunctionDeclaration(nullptr, false, ok);
}
/* falls through */
default:

View File

@ -1572,20 +1572,6 @@ Statement* Parser::ParseNativeDeclaration(bool* ok) {
pos);
}
Statement* Parser::ParseAsyncFunctionDeclaration(
ZoneList<const AstRawString*>* names, bool default_export, bool* ok) {
DCHECK_EQ(scanner()->current_token(), Token::ASYNC);
int pos = position();
if (scanner()->HasAnyLineTerminatorBeforeNext()) {
*ok = false;
ReportUnexpectedToken(scanner()->current_token());
return nullptr;
}
Expect(Token::FUNCTION, CHECK_OK);
ParseFunctionFlags flags = ParseFunctionFlags::kIsAsync;
return ParseHoistableDeclaration(pos, flags, names, default_export, ok);
}
Statement* Parser::ParseClassDeclaration(ZoneList<const AstRawString*>* names,
bool default_export, bool* ok) {
// ClassDeclaration ::
@ -2500,7 +2486,7 @@ Statement* Parser::DesugarLexicalBindingsInForStatement(
return outer_block;
}
void Parser::ParseArrowFunctionFormalParameters(
void Parser::AddArrowFunctionFormalParameters(
ParserFormalParameters* parameters, Expression* expr, int end_pos,
bool* ok) {
// ArrowFunctionFormals ::
@ -2524,8 +2510,8 @@ void Parser::ParseArrowFunctionFormalParameters(
Expression* left = binop->left();
Expression* right = binop->right();
int comma_pos = binop->position();
ParseArrowFunctionFormalParameters(parameters, left, comma_pos,
CHECK_OK_VOID);
AddArrowFunctionFormalParameters(parameters, left, comma_pos,
CHECK_OK_VOID);
// LHS of comma expression should be unparenthesized.
expr = right;
}
@ -2553,59 +2539,14 @@ void Parser::ParseArrowFunctionFormalParameters(
AddFormalParameter(parameters, expr, initializer, end_pos, is_rest);
}
void Parser::DesugarAsyncFunctionBody(Scope* scope, ZoneList<Statement*>* body,
FunctionKind kind,
FunctionBodyType body_type,
bool accept_IN, int pos, bool* ok) {
// function async_function() {
// .generator_object = %CreateGeneratorObject();
// BuildRejectPromiseOnException({
// ... function body ...
// return %ResolvePromise(.promise, expr), .promise;
// })
// }
scope->ForceContextAllocation();
Variable* temp =
NewTemporary(ast_value_factory()->dot_generator_object_string());
function_state_->set_generator_object_variable(temp);
Expression* init_generator_variable = factory()->NewAssignment(
Token::INIT, factory()->NewVariableProxy(temp),
BuildCreateJSGeneratorObject(pos, kind), kNoSourcePosition);
body->Add(factory()->NewExpressionStatement(init_generator_variable,
kNoSourcePosition),
zone());
Block* block = factory()->NewBlock(NULL, 8, true, kNoSourcePosition);
Expression* return_value = nullptr;
if (body_type == FunctionBodyType::kNormal) {
ParseStatementList(block->statements(), Token::RBRACE, CHECK_OK_VOID);
return_value = factory()->NewUndefinedLiteral(kNoSourcePosition);
} else {
return_value = ParseAssignmentExpression(accept_IN, CHECK_OK_VOID);
RewriteNonPattern(CHECK_OK_VOID);
}
return_value = BuildResolvePromise(return_value, return_value->position());
block->statements()->Add(
factory()->NewReturnStatement(return_value, return_value->position()),
zone());
block = BuildRejectPromiseOnException(block, CHECK_OK_VOID);
body->Add(block, zone());
scope->set_end_position(scanner()->location().end_pos);
}
void Parser::ParseArrowFunctionFormalParameterList(
void Parser::DeclareArrowFunctionFormalParameters(
ParserFormalParameters* parameters, Expression* expr,
const Scanner::Location& params_loc, Scanner::Location* duplicate_loc,
const Scope::Snapshot& scope_snapshot, bool* ok) {
bool* ok) {
if (expr->IsEmptyParentheses()) return;
ParseArrowFunctionFormalParameters(parameters, expr, params_loc.end_pos,
CHECK_OK_VOID);
scope_snapshot.Reparent(parameters->scope);
AddArrowFunctionFormalParameters(parameters, expr, params_loc.end_pos,
CHECK_OK_VOID);
if (parameters->Arity() > Code::kMaxArguments) {
ReportMessageAt(params_loc, MessageTemplate::kMalformedArrowFunParamList);
@ -2913,32 +2854,6 @@ FunctionLiteral* Parser::ParseFunctionLiteral(
return function_literal;
}
Expression* Parser::ParseAsyncFunctionExpression(bool* ok) {
// AsyncFunctionDeclaration ::
// async [no LineTerminator here] function ( FormalParameters[Await] )
// { AsyncFunctionBody }
//
// async [no LineTerminator here] function BindingIdentifier[Await]
// ( FormalParameters[Await] ) { AsyncFunctionBody }
DCHECK_EQ(scanner()->current_token(), Token::ASYNC);
int pos = position();
Expect(Token::FUNCTION, CHECK_OK);
bool is_strict_reserved = false;
const AstRawString* name = nullptr;
FunctionLiteral::FunctionType type = FunctionLiteral::kAnonymousExpression;
if (peek_any_identifier()) {
type = FunctionLiteral::kNamedExpression;
name = ParseIdentifierOrStrictReservedWord(FunctionKind::kAsyncFunction,
&is_strict_reserved, CHECK_OK);
}
return ParseFunctionLiteral(name, scanner()->location(),
is_strict_reserved ? kFunctionNameIsStrictReserved
: kFunctionNameValidityUnknown,
FunctionKind::kAsyncFunction, pos, type,
language_mode(), CHECK_OK);
}
Parser::LazyParsingResult Parser::SkipLazyFunctionBody(
int* materialized_literal_count, int* expected_property_count,
bool is_inner_function, bool may_abort, bool* ok) {
@ -3368,9 +3283,8 @@ ZoneList<Statement*>* Parser::ParseEagerFunctionBody(
zone());
} else if (IsAsyncFunction(kind)) {
const bool accept_IN = true;
DesugarAsyncFunctionBody(inner_scope, body, kind,
FunctionBodyType::kNormal, accept_IN, pos,
CHECK_OK);
ParseAsyncFunctionBody(inner_scope, body, kind, FunctionBodyType::kNormal,
accept_IN, pos, CHECK_OK);
} else {
ParseStatementList(body, Token::RBRACE, CHECK_OK);
}
@ -4345,6 +4259,49 @@ Expression* Parser::ExpressionListToExpression(ZoneList<Expression*>* args) {
return expr;
}
// This method intoduces the line initializing the generator object
// when desugaring the body of async_function.
void Parser::PrepareAsyncFunctionBody(ZoneList<Statement*>* body,
FunctionKind kind, int pos) {
// function async_function() {
// .generator_object = %CreateGeneratorObject();
// BuildRejectPromiseOnException({
// ... block ...
// return %ResolvePromise(.promise, expr), .promise;
// })
// }
Variable* temp =
NewTemporary(ast_value_factory()->dot_generator_object_string());
function_state_->set_generator_object_variable(temp);
Expression* init_generator_variable = factory()->NewAssignment(
Token::INIT, factory()->NewVariableProxy(temp),
BuildCreateJSGeneratorObject(pos, kind), kNoSourcePosition);
body->Add(factory()->NewExpressionStatement(init_generator_variable,
kNoSourcePosition),
zone());
}
// This method completes the desugaring of the body of async_function.
void Parser::RewriteAsyncFunctionBody(ZoneList<Statement*>* body, Block* block,
Expression* return_value, bool* ok) {
// function async_function() {
// .generator_object = %CreateGeneratorObject();
// BuildRejectPromiseOnException({
// ... block ...
// return %ResolvePromise(.promise, expr), .promise;
// })
// }
return_value = BuildResolvePromise(return_value, return_value->position());
block->statements()->Add(
factory()->NewReturnStatement(return_value, return_value->position()),
zone());
block = BuildRejectPromiseOnException(block, CHECK_OK_VOID);
body->Add(block, zone());
}
Expression* Parser::RewriteAwaitExpression(Expression* value, int await_pos) {
// yield do {
// tmp = <operand>;

View File

@ -211,8 +211,6 @@ class Parser : public ParserBase<Parser> {
kAbruptCompletion
};
enum class FunctionBodyType { kNormal, kSingleExpression };
Variable* NewTemporary(const AstRawString* name) {
return scope()->NewTemporary(name);
}
@ -271,9 +269,6 @@ class Parser : public ParserBase<Parser> {
};
ZoneList<const NamedImport*>* ParseNamedImports(int pos, bool* ok);
Statement* ParseFunctionDeclaration(bool* ok);
Statement* ParseAsyncFunctionDeclaration(ZoneList<const AstRawString*>* names,
bool default_export, bool* ok);
Expression* ParseAsyncFunctionExpression(bool* ok);
Statement* ParseClassDeclaration(ZoneList<const AstRawString*>* names,
bool default_export, bool* ok);
Statement* ParseNativeDeclaration(bool* ok);
@ -411,10 +406,6 @@ class Parser : public ParserBase<Parser> {
ForStatement* loop, Statement* init, Expression* cond, Statement* next,
Statement* body, Scope* inner_scope, const ForInfo& for_info, bool* ok);
void DesugarAsyncFunctionBody(Scope* scope, ZoneList<Statement*>* body,
FunctionKind kind, FunctionBodyType type,
bool accept_IN, int pos, bool* ok);
Expression* RewriteDoExpression(Block* body, int pos, bool* ok);
FunctionLiteral* ParseFunctionLiteral(
@ -541,14 +532,6 @@ class Parser : public ParserBase<Parser> {
Expression* tag);
uint32_t ComputeTemplateLiteralHash(const TemplateLiteral* lit);
void ParseAsyncArrowSingleExpressionBody(ZoneList<Statement*>* body,
bool accept_IN,
int pos, bool* ok) {
DesugarAsyncFunctionBody(scope(), body, kAsyncArrowFunction,
FunctionBodyType::kSingleExpression, accept_IN,
pos, ok);
}
ZoneList<Expression*>* PrepareSpreadArguments(ZoneList<Expression*>* list);
Expression* SpreadCall(Expression* function, ZoneList<Expression*>* args,
int pos);
@ -607,13 +590,18 @@ class Parser : public ParserBase<Parser> {
Statement* CheckCallable(Variable* var, Expression* error, int pos);
V8_INLINE Expression* RewriteAwaitExpression(Expression* value, int pos);
V8_INLINE void PrepareAsyncFunctionBody(ZoneList<Statement*>* body,
FunctionKind kind, int pos);
V8_INLINE void RewriteAsyncFunctionBody(ZoneList<Statement*>* body,
Block* block,
Expression* return_value, bool* ok);
Expression* RewriteYieldStar(Expression* generator, Expression* expression,
int pos);
void ParseArrowFunctionFormalParameters(ParserFormalParameters* parameters,
Expression* params, int end_pos,
bool* ok);
void AddArrowFunctionFormalParameters(ParserFormalParameters* parameters,
Expression* params, int end_pos,
bool* ok);
void SetFunctionName(Expression* value, const AstRawString* name);
// Helper functions for recursive descent.
@ -1025,10 +1013,11 @@ class Parser : public ParserBase<Parser> {
}
}
void ParseArrowFunctionFormalParameterList(
ParserFormalParameters* parameters, Expression* params,
const Scanner::Location& params_loc, Scanner::Location* duplicate_loc,
const Scope::Snapshot& scope_snapshot, bool* ok);
void DeclareArrowFunctionFormalParameters(ParserFormalParameters* parameters,
Expression* params,
const Scanner::Location& params_loc,
Scanner::Location* duplicate_loc,
bool* ok);
void ReindexLiterals(const ParserFormalParameters& parameters);

View File

@ -135,18 +135,6 @@ PreParser::PreParseResult PreParser::PreParseLazyFunction(
// That means that contextual checks (like a label being declared where
// it is used) are generally omitted.
PreParser::Statement PreParser::ParseAsyncFunctionDeclaration(
ZoneList<const AstRawString*>* names, bool default_export, bool* ok) {
// AsyncFunctionDeclaration ::
// async [no LineTerminator here] function BindingIdentifier[Await]
// ( FormalParameters[Await] ) { AsyncFunctionBody }
DCHECK_EQ(scanner()->current_token(), Token::ASYNC);
int pos = position();
Expect(Token::FUNCTION, CHECK_OK);
ParseFunctionFlags flags = ParseFunctionFlags::kIsAsync;
return ParseHoistableDeclaration(pos, flags, names, default_export, ok);
}
PreParser::Statement PreParser::ParseClassDeclaration(
ZoneList<const AstRawString*>* names, bool default_export, bool* ok) {
int pos = position();
@ -243,33 +231,6 @@ PreParser::Expression PreParser::ParseFunctionLiteral(
return Expression::Default();
}
PreParser::Expression PreParser::ParseAsyncFunctionExpression(bool* ok) {
// AsyncFunctionDeclaration ::
// async [no LineTerminator here] function ( FormalParameters[Await] )
// { AsyncFunctionBody }
//
// async [no LineTerminator here] function BindingIdentifier[Await]
// ( FormalParameters[Await] ) { AsyncFunctionBody }
int pos = position();
Expect(Token::FUNCTION, CHECK_OK);
bool is_strict_reserved = false;
Identifier name;
FunctionLiteral::FunctionType type = FunctionLiteral::kAnonymousExpression;
if (peek_any_identifier()) {
type = FunctionLiteral::kNamedExpression;
name = ParseIdentifierOrStrictReservedWord(FunctionKind::kAsyncFunction,
&is_strict_reserved, CHECK_OK);
}
ParseFunctionLiteral(name, scanner()->location(),
is_strict_reserved ? kFunctionNameIsStrictReserved
: kFunctionNameValidityUnknown,
FunctionKind::kAsyncFunction, pos, type, language_mode(),
CHECK_OK);
return Expression::Default();
}
PreParser::LazyParsingResult PreParser::ParseLazyFunctionLiteralBody(
bool may_abort, bool* ok) {
int body_start = position();
@ -342,17 +303,6 @@ PreParserExpression PreParser::ParseClassLiteral(
return Expression::Default();
}
void PreParser::ParseAsyncArrowSingleExpressionBody(PreParserStatementList body,
bool accept_IN, int pos,
bool* ok) {
scope()->ForceContextAllocation();
PreParserExpression return_value =
ParseAssignmentExpression(accept_IN, CHECK_OK_VOID);
body->Add(PreParserStatement::ExpressionStatement(return_value), zone());
}
PreParserExpression PreParser::ExpressionFromIdentifier(
PreParserIdentifier name, int start_position, int end_position,
InferName infer) {

View File

@ -838,9 +838,6 @@ class PreParser : public ParserBase<PreParser> {
// By making the 'exception handling' explicit, we are forced to check
// for failure at the call sites.
Statement ParseFunctionDeclaration(bool* ok);
Statement ParseAsyncFunctionDeclaration(ZoneList<const AstRawString*>* names,
bool default_export, bool* ok);
Expression ParseAsyncFunctionExpression(bool* ok);
Statement ParseClassDeclaration(ZoneList<const AstRawString*>* names,
bool default_export, bool* ok);
Expression ParseConditionalExpression(bool accept_IN, bool* ok);
@ -889,10 +886,6 @@ class PreParser : public ParserBase<PreParser> {
V8_INLINE void MarkCollectedTailCallExpressions() {}
V8_INLINE void MarkTailPosition(PreParserExpression expression) {}
void ParseAsyncArrowSingleExpressionBody(PreParserStatementList body,
bool accept_IN,
int pos, bool* ok);
V8_INLINE PreParserExpressionList
PrepareSpreadArguments(PreParserExpressionList list) {
return list;
@ -926,6 +919,12 @@ class PreParser : public ParserBase<PreParser> {
RewriteAwaitExpression(PreParserExpression value, int pos) {
return value;
}
V8_INLINE void PrepareAsyncFunctionBody(PreParserStatementList body,
FunctionKind kind, int pos) {}
V8_INLINE void RewriteAsyncFunctionBody(PreParserStatementList body,
PreParserStatement block,
PreParserExpression return_value,
bool* ok) {}
V8_INLINE PreParserExpression RewriteYieldStar(PreParserExpression generator,
PreParserExpression expression,
int pos) {
@ -1362,13 +1361,12 @@ class PreParser : public ParserBase<PreParser> {
}
}
V8_INLINE void ParseArrowFunctionFormalParameterList(
V8_INLINE void DeclareArrowFunctionFormalParameters(
PreParserFormalParameters* parameters, PreParserExpression params,
const Scanner::Location& params_loc, Scanner::Location* duplicate_loc,
const Scope::Snapshot& scope_snapshot, bool* ok) {
bool* ok) {
// TODO(wingo): Detect duplicated identifiers in paramlists. Detect
// parameter
// lists that are too long.
// parameter lists that are too long.
}
V8_INLINE void ReindexLiterals(const PreParserFormalParameters& parameters) {}