[parser] Remove RETURN_IF* part 16
Bug: v8:8363, v8:7926 Change-Id: I9f0b9e25cf6b47c8ff32451880e348b92ab3cfaa Reviewed-on: https://chromium-review.googlesource.com/c/1309760 Commit-Queue: Toon Verwaest <verwaest@chromium.org> Reviewed-by: Igor Sheludko <ishell@chromium.org> Cr-Commit-Position: refs/heads/master@{#57172}
This commit is contained in:
parent
517331c56e
commit
fd22cfc8a4
@ -449,9 +449,7 @@ class FunctionDeclaration final : public Declaration {
|
||||
friend class AstNodeFactory;
|
||||
|
||||
FunctionDeclaration(VariableProxy* proxy, FunctionLiteral* fun, int pos)
|
||||
: Declaration(proxy, pos, kFunctionDeclaration), fun_(fun) {
|
||||
DCHECK_NOT_NULL(fun);
|
||||
}
|
||||
: Declaration(proxy, pos, kFunctionDeclaration), fun_(fun) {}
|
||||
|
||||
FunctionLiteral* fun_;
|
||||
};
|
||||
|
@ -1547,7 +1547,7 @@ ParserBase<Impl>::ParseAndClassifyIdentifier() {
|
||||
if (impl()->IsEvalOrArguments(name)) {
|
||||
if (impl()->IsArguments(name) && scope()->ShouldBanArguments()) {
|
||||
ReportMessage(MessageTemplate::kArgumentsDisallowedInInitializer);
|
||||
return impl()->NullIdentifier();
|
||||
return impl()->EmptyIdentifierString();
|
||||
}
|
||||
|
||||
classifier()->RecordStrictModeFormalParameterError(
|
||||
@ -1575,7 +1575,7 @@ ParserBase<Impl>::ParseAndClassifyIdentifier() {
|
||||
return impl()->GetSymbol();
|
||||
} else {
|
||||
ReportUnexpectedToken(next);
|
||||
return impl()->NullIdentifier();
|
||||
return impl()->EmptyIdentifierString();
|
||||
}
|
||||
}
|
||||
|
||||
@ -1594,7 +1594,7 @@ ParserBase<Impl>::ParseIdentifierOrStrictReservedWord(
|
||||
*is_strict_reserved = true;
|
||||
} else {
|
||||
ReportUnexpectedToken(next);
|
||||
return impl()->NullIdentifier();
|
||||
return impl()->EmptyIdentifierString();
|
||||
}
|
||||
|
||||
return impl()->GetSymbol();
|
||||
@ -1606,7 +1606,7 @@ typename ParserBase<Impl>::IdentifierT ParserBase<Impl>::ParseIdentifierName() {
|
||||
if (!Token::IsAnyIdentifier(next) && next != Token::ESCAPED_KEYWORD &&
|
||||
!Token::IsKeyword(next)) {
|
||||
ReportUnexpectedToken(next);
|
||||
return impl()->NullIdentifier();
|
||||
return impl()->EmptyIdentifierString();
|
||||
}
|
||||
|
||||
return impl()->GetSymbol();
|
||||
@ -1628,7 +1628,6 @@ ParserBase<Impl>::ParseIdentifierNameOrPrivateName() {
|
||||
name = ParseIdentifierName();
|
||||
key = factory()->NewStringLiteral(name, pos);
|
||||
}
|
||||
RETURN_IF_PARSE_ERROR;
|
||||
impl()->PushLiteralName(name);
|
||||
return key;
|
||||
}
|
||||
@ -2131,7 +2130,6 @@ typename ParserBase<Impl>::ExpressionT ParserBase<Impl>::ParsePropertyName(
|
||||
if (*kind == ParsePropertyKind::kNotSet) {
|
||||
ParsePropertyKindFromToken(peek(), kind);
|
||||
}
|
||||
RETURN_IF_PARSE_ERROR;
|
||||
impl()->PushLiteralName(*name);
|
||||
return is_array_index ? factory()->NewNumberLiteral(index, pos)
|
||||
: factory()->NewStringLiteral(*name, pos);
|
||||
@ -2705,8 +2703,6 @@ ParserBase<Impl>::ParseAssignmentExpression(bool accept_IN) {
|
||||
}
|
||||
|
||||
scope->set_start_position(lhs_beg_pos);
|
||||
// TODO(verwaest): Disable DCHECKs in failure mode?
|
||||
RETURN_IF_PARSE_ERROR;
|
||||
impl()->DeclareArrowFunctionFormalParameters(¶meters, expression, loc);
|
||||
|
||||
expression =
|
||||
@ -3837,8 +3833,6 @@ ParserBase<Impl>::ParseHoistableDeclaration(
|
||||
}
|
||||
|
||||
FuncNameInferrerState fni_state(&fni_);
|
||||
// TODO(verwaest): Remove once we have FailureIdentifier.
|
||||
RETURN_IF_PARSE_ERROR_CUSTOM(NullStatement);
|
||||
impl()->PushEnclosingName(name);
|
||||
|
||||
FunctionKind kind = FunctionKindFor(flags);
|
||||
@ -3862,7 +3856,6 @@ ParserBase<Impl>::ParseHoistableDeclaration(
|
||||
!scope()->is_declaration_scope() &&
|
||||
flags == ParseFunctionFlag::kIsNormal;
|
||||
|
||||
RETURN_IF_PARSE_ERROR_CUSTOM(NullStatement);
|
||||
return impl()->DeclareFunction(variable_name, function, mode, pos,
|
||||
is_sloppy_block_function, names);
|
||||
}
|
||||
@ -3904,7 +3897,6 @@ typename ParserBase<Impl>::StatementT ParserBase<Impl>::ParseClassDeclaration(
|
||||
ExpressionT value = ParseClassLiteral(name, scanner()->location(),
|
||||
is_strict_reserved, class_token_pos);
|
||||
int end_pos = position();
|
||||
RETURN_IF_PARSE_ERROR_CUSTOM(NullStatement);
|
||||
return impl()->DeclareClass(variable_name, value, names, class_token_pos,
|
||||
end_pos);
|
||||
}
|
||||
@ -4138,7 +4130,7 @@ ParserBase<Impl>::ParseArrowFunctionLiteral(
|
||||
base::ElapsedTimer timer;
|
||||
if (V8_UNLIKELY(FLAG_log_function_events)) timer.Start();
|
||||
|
||||
DCHECK_EQ(Token::ARROW, peek());
|
||||
DCHECK_IMPLIES(!has_error(), peek() == Token::ARROW);
|
||||
if (scanner_->HasLineTerminatorBeforeNext()) {
|
||||
// ASI inserts `;` after arrow parameters if a line terminator is found.
|
||||
// `=> ...` is never a valid expression, so report as syntax error.
|
||||
|
@ -2436,7 +2436,7 @@ void Parser::AddArrowFunctionFormalParameters(
|
||||
void Parser::DeclareArrowFunctionFormalParameters(
|
||||
ParserFormalParameters* parameters, Expression* expr,
|
||||
const Scanner::Location& params_loc) {
|
||||
if (expr->IsEmptyParentheses()) return;
|
||||
if (expr->IsEmptyParentheses() || has_error()) return;
|
||||
|
||||
AddArrowFunctionFormalParameters(parameters, expr, params_loc.end_pos);
|
||||
|
||||
@ -2446,7 +2446,8 @@ void Parser::DeclareArrowFunctionFormalParameters(
|
||||
}
|
||||
|
||||
DeclareFormalParameters(parameters);
|
||||
DCHECK_EQ(parameters->is_simple, parameters->scope->has_simple_parameters());
|
||||
DCHECK_IMPLIES(parameters->is_simple,
|
||||
parameters->scope->has_simple_parameters());
|
||||
}
|
||||
|
||||
void Parser::PrepareGeneratorVariables() {
|
||||
|
@ -862,7 +862,6 @@ class V8_EXPORT_PRIVATE Parser : public NON_EXPORTED_BASE(ParserBase<Parser>) {
|
||||
V8_INLINE VariableProxy* ExpressionFromIdentifier(
|
||||
const AstRawString* name, int start_position,
|
||||
InferName infer = InferName::kYes) {
|
||||
if (has_error()) return nullptr;
|
||||
if (infer == InferName::kYes) {
|
||||
fni_.PushVariableName(name);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user