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

Unified Diff: src/parsing/preparser.h

Issue 1964603002: [es8] Throw SyntaxError when trying to tail call a direct eval. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@stc-strict-mode
Patch Set: Created 4 years, 7 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') | test/message/syntactic-tail-call-of-eval.js » ('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 9e57442daf750fed05f09dc2e70c0993b84ebb4e..92b02071add0747ea5d76853fb2108b15ccf9edd 100644
--- a/src/parsing/preparser.h
+++ b/src/parsing/preparser.h
@@ -175,6 +175,12 @@ class PreParserExpression {
ExpressionTypeField::encode(kCallExpression));
}
+ static PreParserExpression CallEval() {
+ return PreParserExpression(
+ TypeField::encode(kExpression) |
+ ExpressionTypeField::encode(kCallEvalExpression));
+ }
+
static PreParserExpression SuperCallReference() {
return PreParserExpression(
TypeField::encode(kExpression) |
@@ -236,7 +242,13 @@ class PreParserExpression {
bool IsCall() const {
return TypeField::decode(code_) == kExpression &&
- ExpressionTypeField::decode(code_) == kCallExpression;
+ (ExpressionTypeField::decode(code_) == kCallExpression ||
+ ExpressionTypeField::decode(code_) == kCallEvalExpression);
+ }
+
+ bool IsDirectEvalCall() const {
+ return TypeField::decode(code_) == kExpression &&
+ ExpressionTypeField::decode(code_) == kCallEvalExpression;
}
bool IsSuperCallReference() const {
@@ -294,6 +306,7 @@ class PreParserExpression {
kThisPropertyExpression,
kPropertyExpression,
kCallExpression,
+ kCallEvalExpression,
kSuperCallReference,
kNoTemplateTagExpression,
kAssignment
@@ -503,6 +516,9 @@ class PreParserFactory {
PreParserExpression NewCall(PreParserExpression expression,
PreParserExpressionList arguments,
int pos) {
+ if (expression.IsIdentifier() && expression.AsIdentifier().IsEval()) {
+ return PreParserExpression::CallEval();
+ }
return PreParserExpression::Call();
}
PreParserExpression NewCallNew(PreParserExpression expression,
@@ -635,6 +651,14 @@ class PreParserTraits {
return expression.AsIdentifier();
}
+ static bool IsEvalIdentifier(PreParserExpression expression) {
+ return IsIdentifier(expression) && IsEval(AsIdentifier(expression));
+ }
+
+ static bool IsDirectEvalCall(PreParserExpression expression) {
+ return expression.IsDirectEvalCall();
+ }
+
static bool IsFutureStrictReserved(PreParserIdentifier identifier) {
return identifier.IsFutureStrictReserved();
}
« no previous file with comments | « src/parsing/parser-base.h ('k') | test/message/syntactic-tail-call-of-eval.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698