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

Unified Diff: src/preparser.h

Issue 1416753009: [parser] early error when declaration Pattern missing Initializer (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Add a bunch of message tests + refactor a bit Created 5 years, 1 month 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
Index: src/preparser.h
diff --git a/src/preparser.h b/src/preparser.h
index 8bbd9e688ccb6adcf2b8e80a890e17fb5c4e71e8..d8f9dbdbfad06273ab8228cf9864b887f7e55d86 100644
--- a/src/preparser.h
+++ b/src/preparser.h
@@ -948,6 +948,10 @@ class PreParserExpression {
right->IsSpreadExpression()));
}
+ static PreParserExpression ObjectLiteral() {
+ return PreParserExpression(TypeField::encode(kObjectLiteralExpression));
+ }
+
static PreParserExpression StringLiteral() {
return PreParserExpression(TypeField::encode(kStringLiteralExpression));
}
@@ -1005,6 +1009,14 @@ class PreParserExpression {
return PreParserIdentifier(IdentifierTypeField::decode(code_));
}
+ bool IsObjectLiteral() const {
+ return TypeField::decode(code_) == kObjectLiteralExpression;
+ }
+
+ bool IsArrayLiteral() const {
+ return TypeField::decode(code_) == kObjectLiteralExpression;
+ }
+
bool IsStringLiteral() const {
return TypeField::decode(code_) == kStringLiteralExpression;
}
@@ -1093,7 +1105,8 @@ class PreParserExpression {
kIdentifierExpression,
kStringLiteralExpression,
kBinaryOperationExpression,
- kSpreadExpression
+ kSpreadExpression,
+ kObjectLiteralExpression
};
enum ExpressionType {
@@ -1231,12 +1244,12 @@ class PreParserFactory {
int literal_index,
bool is_strong,
int pos) {
- return PreParserExpression::Default();
+ return PreParserExpression::ObjectLiteral();
}
PreParserExpression NewArrayLiteral(PreParserExpressionList values,
int first_spread_index, int literal_index,
bool is_strong, int pos) {
- return PreParserExpression::Default();
+ return PreParserExpression::ObjectLiteral();
}
PreParserExpression NewObjectLiteralProperty(PreParserExpression key,
PreParserExpression value,
@@ -1257,7 +1270,7 @@ class PreParserFactory {
bool has_function,
bool is_strong,
int pos) {
- return PreParserExpression::Default();
+ return PreParserExpression::ObjectLiteral();
}
PreParserExpression NewVariableProxy(void* variable) {
return PreParserExpression::Default();

Powered by Google App Engine
This is Rietveld 408576698