Commit e5b77388 authored by Toon Verwaest's avatar Toon Verwaest Committed by Commit Bot

[parser] Simplify PreParser::ExpressionFromIdentifier

Change-Id: I2abd9ef9591a5e65dcb3fd0231c8d7467296b576
Reviewed-on: https://chromium-review.googlesource.com/c/1426127Reviewed-by: 's avatarCamillo Bruni <cbruni@chromium.org>
Commit-Queue: Toon Verwaest <verwaest@chromium.org>
Cr-Commit-Position: refs/heads/master@{#58990}
parent d7ad2e58
......@@ -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
......@@ -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) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment