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

Unified Diff: src/parsing/preparser.h

Issue 1723313002: [parser] Enforce module-specific identifier restriction (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Add an initializer for `parsing_module_` attribute Created 4 years, 8 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/parsing/parser-base.h ('k') | src/parsing/preparser.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/parsing/preparser.h
diff --git a/src/parsing/preparser.h b/src/parsing/preparser.h
index 07375294aa91deeab73c15095c4ce186b8406589..e22391dc8752890aa7c37445bb2056a960b383a1 100644
--- a/src/parsing/preparser.h
+++ b/src/parsing/preparser.h
@@ -55,6 +55,12 @@ class PreParserIdentifier {
static PreParserIdentifier Constructor() {
return PreParserIdentifier(kConstructorIdentifier);
}
+ static PreParserIdentifier Enum() {
+ return PreParserIdentifier(kEnumIdentifier);
+ }
+ static PreParserIdentifier Await() {
+ return PreParserIdentifier(kAwaitIdentifier);
+ }
bool IsEval() const { return type_ == kEvalIdentifier; }
bool IsArguments() const { return type_ == kArgumentsIdentifier; }
bool IsEvalOrArguments() const { return IsEval() || IsArguments(); }
@@ -64,7 +70,8 @@ class PreParserIdentifier {
bool IsYield() const { return type_ == kYieldIdentifier; }
bool IsPrototype() const { return type_ == kPrototypeIdentifier; }
bool IsConstructor() const { return type_ == kConstructorIdentifier; }
- bool IsFutureReserved() const { return type_ == kFutureReservedIdentifier; }
+ bool IsEnum() const { return type_ == kEnumIdentifier; }
+ bool IsAwait() const { return type_ == kAwaitIdentifier; }
bool IsFutureStrictReserved() const {
return type_ == kFutureStrictReservedIdentifier ||
type_ == kLetIdentifier || type_ == kStaticIdentifier ||
@@ -91,7 +98,9 @@ class PreParserIdentifier {
kArgumentsIdentifier,
kUndefinedIdentifier,
kPrototypeIdentifier,
- kConstructorIdentifier
+ kConstructorIdentifier,
+ kEnumIdentifier,
+ kAwaitIdentifier
};
explicit PreParserIdentifier(Type type) : type_(type) {}
@@ -977,6 +986,7 @@ class PreParser : public ParserBase<PreParserTraits> {
&factory);
bool ok = true;
int start_position = scanner()->peek_location().beg_pos;
+ parsing_module_ = is_module;
ParseStatementList(Token::EOS, &ok);
if (stack_overflow()) return kPreParseStackOverflow;
if (!ok) {
@@ -1001,7 +1011,8 @@ class PreParser : public ParserBase<PreParserTraits> {
// the final '}'.
PreParseResult PreParseLazyFunction(
LanguageMode language_mode, FunctionKind kind, bool has_simple_parameters,
- ParserRecorder* log, Scanner::BookmarkScope* bookmark = nullptr);
+ bool parsing_module, ParserRecorder* log,
+ Scanner::BookmarkScope* bookmark = nullptr);
private:
friend class PreParserTraits;
« no previous file with comments | « src/parsing/parser-base.h ('k') | src/parsing/preparser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698