[parser] Simplify PreParser::ExpressionFromIdentifier

Change-Id: I2abd9ef9591a5e65dcb3fd0231c8d7467296b576
Reviewed-on: https://chromium-review.googlesource.com/c/1426127
Reviewed-by: Camillo Bruni <cbruni@chromium.org>
Commit-Queue: Toon Verwaest <verwaest@chromium.org>
Cr-Commit-Position: refs/heads/master@{#58990}
This commit is contained in:
Toon Verwaest 2019-01-22 12:31:36 +01:00 committed by Commit Bot
parent d7ad2e583b
commit e5b773888e
2 changed files with 7 additions and 13 deletions

View File

@ -410,14 +410,5 @@ bool PreParser::IdentifierEquals(const PreParserIdentifier& identifier,
return identifier.string_ == other;
}
PreParserExpression PreParser::ExpressionFromIdentifier(
const PreParserIdentifier& name, int start_position, InferName infer) {
DCHECK_IMPLIES(name.string_ == nullptr, has_error());
if (name.string_ == nullptr) return PreParserExpression::Default();
VariableProxy* proxy =
expression_scope()->NewVariable(name.string_, start_position);
return PreParserExpression::FromIdentifier(name, proxy, zone());
}
} // namespace internal
} // namespace v8

View File

@ -111,9 +111,7 @@ class PreParserExpression {
return PreParserExpression(TypeField::encode(kSpreadExpression));
}
static PreParserExpression FromIdentifier(const PreParserIdentifier& id,
VariableProxy* variable,
Zone* zone) {
static PreParserExpression FromIdentifier(const PreParserIdentifier& id) {
return PreParserExpression(TypeField::encode(kIdentifierExpression) |
IdentifierTypeField::encode(id.type_));
}
@ -1567,7 +1565,12 @@ class PreParser : public ParserBase<PreParser> {
PreParserExpression ExpressionFromIdentifier(
const PreParserIdentifier& name, int start_position,
InferName infer = InferName::kYes);
InferName infer = InferName::kYes) {
if (name.string_ != nullptr) {
expression_scope()->NewVariable(name.string_, start_position);
}
return PreParserExpression::FromIdentifier(name);
}
V8_INLINE Variable* DeclareCatchVariableName(
Scope* scope, const PreParserIdentifier& identifier) {