Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(92)

Unified Diff: src/preparser.h

Issue 932333004: [strong] Deprecate arguments (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Comments Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/parser.cc ('k') | test/mjsunit/strong/arguments.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/preparser.h
diff --git a/src/preparser.h b/src/preparser.h
index 1cd5dadf0d13557e9e978c5a0bee07f95680c89c..422773e1cb6a67d4fa6f1b08fb3066de835c61ab 100644
--- a/src/preparser.h
+++ b/src/preparser.h
@@ -708,17 +708,13 @@ class PreParserIdentifier {
return PreParserIdentifier(kConstructorIdentifier);
}
bool IsEval() const { return type_ == kEvalIdentifier; }
- bool IsArguments(const AstValueFactory* = NULL) const {
- return type_ == kArgumentsIdentifier;
- }
+ bool IsArguments() const { return type_ == kArgumentsIdentifier; }
+ bool IsEvalOrArguments() const { return IsEval() || IsArguments(); }
bool IsLet() const { return type_ == kLetIdentifier; }
bool IsStatic() const { return type_ == kStaticIdentifier; }
bool IsYield() const { return type_ == kYieldIdentifier; }
bool IsPrototype() const { return type_ == kPrototypeIdentifier; }
bool IsConstructor() const { return type_ == kConstructorIdentifier; }
- bool IsEvalOrArguments() const {
- return type_ == kEvalIdentifier || type_ == kArgumentsIdentifier;
- }
bool IsFutureReserved() const { return type_ == kFutureReservedIdentifier; }
bool IsFutureStrictReserved() const {
return type_ == kFutureStrictReservedIdentifier ||
@@ -1219,6 +1215,14 @@ class PreParserTraits {
explicit PreParserTraits(PreParser* pre_parser) : pre_parser_(pre_parser) {}
// Helper functions for recursive descent.
+ static bool IsEval(PreParserIdentifier identifier) {
+ return identifier.IsEval();
+ }
+
+ static bool IsArguments(PreParserIdentifier identifier) {
+ return identifier.IsArguments();
+ }
+
static bool IsEvalOrArguments(PreParserIdentifier identifier) {
return identifier.IsEvalOrArguments();
}
@@ -1714,12 +1718,18 @@ typename ParserBase<Traits>::IdentifierT ParserBase<Traits>::ParseIdentifier(
Token::Value next = Next();
if (next == Token::IDENTIFIER) {
IdentifierT name = this->GetSymbol(scanner());
- if (allow_eval_or_arguments == kDontAllowEvalOrArguments &&
- is_strict(language_mode()) && this->IsEvalOrArguments(name)) {
- ReportMessage("strict_eval_arguments");
- *ok = false;
+ if (allow_eval_or_arguments == kDontAllowEvalOrArguments) {
+ if (is_strict(language_mode()) && this->IsEvalOrArguments(name)) {
+ ReportMessage("strict_eval_arguments");
+ *ok = false;
+ }
+ } else {
+ if (is_strong(language_mode()) && this->IsArguments(name)) {
+ ReportMessage("strong_arguments");
+ *ok = false;
+ }
}
- if (name->IsArguments(ast_value_factory())) scope_->RecordArgumentsUsage();
+ if (this->IsArguments(name)) scope_->RecordArgumentsUsage();
return name;
} else if (is_sloppy(language_mode()) &&
(next == Token::FUTURE_STRICT_RESERVED_WORD ||
@@ -1752,7 +1762,7 @@ typename ParserBase<Traits>::IdentifierT ParserBase<
}
IdentifierT name = this->GetSymbol(scanner());
- if (name->IsArguments(ast_value_factory())) scope_->RecordArgumentsUsage();
+ if (this->IsArguments(name)) scope_->RecordArgumentsUsage();
return name;
}
@@ -1770,7 +1780,7 @@ ParserBase<Traits>::ParseIdentifierName(bool* ok) {
}
IdentifierT name = this->GetSymbol(scanner());
- if (name->IsArguments(ast_value_factory())) scope_->RecordArgumentsUsage();
+ if (this->IsArguments(name)) scope_->RecordArgumentsUsage();
return name;
}
« no previous file with comments | « src/parser.cc ('k') | test/mjsunit/strong/arguments.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698