Commit 07eca01b authored by vogelheim's avatar vogelheim Committed by Commit bot

Remove unused code for IsFutureStrictReserved.

This apparently gradually fell out of use after the more general
Token::IsIdentifer was introduced, and whoever left last forgot to
turn out the lights.

The only remaining use was in an assertion in DeclareLabel, but
meanwhile DeclareLabel is only called if IsIdentifier. I added re-formulated assertions, just in case.

R=verwaest@chromium.org
BUG=v8:4947

Review-Url: https://codereview.chromium.org/2549493002
Cr-Commit-Position: refs/heads/master@{#41452}
parent 651c1b86
......@@ -1627,6 +1627,7 @@ Statement* Parser::DeclareNative(const AstRawString* name, int pos, bool* ok) {
ZoneList<const AstRawString*>* Parser::DeclareLabel(
ZoneList<const AstRawString*>* labels, VariableProxy* var, bool* ok) {
DCHECK(IsIdentifier(var));
const AstRawString* label = var->raw_name();
// TODO(1240780): We don't check for redeclaration of labels
// during preparsing since keeping track of the set of active
......
......@@ -688,10 +688,6 @@ class V8_EXPORT_PRIVATE Parser : public NON_EXPORTED_BASE(ParserBase<Parser>) {
return identifier == ast_value_factory()->undefined_string();
}
V8_INLINE bool IsFutureStrictReserved(const AstRawString* identifier) const {
return scanner()->IdentifierIsFutureStrictReserved(identifier);
}
// Returns true if the expression is of type "this.foo".
V8_INLINE static bool IsThisProperty(Expression* expression) {
DCHECK(expression != NULL);
......
......@@ -80,11 +80,6 @@ class PreParserIdentifier {
bool IsConstructor() const { return type_ == kConstructorIdentifier; }
bool IsEnum() const { return type_ == kEnumIdentifier; }
bool IsAwait() const { return type_ == kAwaitIdentifier; }
bool IsFutureStrictReserved() const {
return type_ == kFutureStrictReservedIdentifier ||
type_ == kLetIdentifier || type_ == kStaticIdentifier ||
type_ == kYieldIdentifier;
}
// Allow identifier->name()[->length()] to work. The preparser
// does not need the actual positions/lengths of the identifiers.
......@@ -1005,8 +1000,7 @@ class PreParser : public ParserBase<PreParser> {
bool* ok) {
DCHECK(!expr.AsIdentifier().IsEnum());
DCHECK(!parsing_module_ || !expr.AsIdentifier().IsAwait());
DCHECK(is_sloppy(language_mode()) ||
!IsFutureStrictReserved(expr.AsIdentifier()));
DCHECK(IsIdentifier(expr));
return labels;
}
......@@ -1121,10 +1115,6 @@ class PreParser : public ParserBase<PreParser> {
return identifier.IsAwait();
}
V8_INLINE bool IsFutureStrictReserved(PreParserIdentifier identifier) const {
return identifier.IsFutureStrictReserved();
}
// Returns true if the expression is of type "this.foo".
V8_INLINE static bool IsThisProperty(PreParserExpression expression) {
return expression.IsThisProperty();
......
......@@ -1340,19 +1340,6 @@ static Token::Value KeywordOrIdentifierToken(const uint8_t* input,
}
bool Scanner::IdentifierIsFutureStrictReserved(
const AstRawString* string) const {
// Keywords are always 1-byte strings.
if (!string->is_one_byte()) return false;
if (string->IsOneByteEqualTo("let") || string->IsOneByteEqualTo("static") ||
string->IsOneByteEqualTo("yield")) {
return true;
}
return Token::FUTURE_STRICT_RESERVED_WORD ==
KeywordOrIdentifierToken(string->raw_data(), string->length());
}
Token::Value Scanner::ScanIdentifierOrKeyword() {
DCHECK(unicode_cache_->IsIdentifierStart(c0_));
LiteralScope literal(this);
......
......@@ -328,8 +328,6 @@ class Scanner {
return tmp;
}
bool IdentifierIsFutureStrictReserved(const AstRawString* string) const;
bool FoundHtmlComment() const { return found_html_comment_; }
private:
......
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