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

Side by Side 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: comments addressed 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 unified diff | Download patch
« no previous file with comments | « src/parser.cc ('k') | src/preparser.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef V8_PREPARSER_H 5 #ifndef V8_PREPARSER_H
6 #define V8_PREPARSER_H 6 #define V8_PREPARSER_H
7 7
8 #include "src/bailout-reason.h" 8 #include "src/bailout-reason.h"
9 #include "src/expression-classifier.h" 9 #include "src/expression-classifier.h"
10 #include "src/func-name-inferrer.h" 10 #include "src/func-name-inferrer.h"
(...skipping 930 matching lines...) Expand 10 before | Expand all | Expand 10 after
941 941
942 static PreParserExpression BinaryOperation(PreParserExpression left, 942 static PreParserExpression BinaryOperation(PreParserExpression left,
943 Token::Value op, 943 Token::Value op,
944 PreParserExpression right) { 944 PreParserExpression right) {
945 return PreParserExpression( 945 return PreParserExpression(
946 TypeField::encode(kBinaryOperationExpression) | 946 TypeField::encode(kBinaryOperationExpression) |
947 HasRestField::encode(op == Token::COMMA && 947 HasRestField::encode(op == Token::COMMA &&
948 right->IsSpreadExpression())); 948 right->IsSpreadExpression()));
949 } 949 }
950 950
951 static PreParserExpression ObjectLiteral() {
952 return PreParserExpression(TypeField::encode(kObjectLiteralExpression));
953 }
954
955 static PreParserExpression ArrayLiteral() {
956 return PreParserExpression(TypeField::encode(kArrayLiteralExpression));
957 }
958
951 static PreParserExpression StringLiteral() { 959 static PreParserExpression StringLiteral() {
952 return PreParserExpression(TypeField::encode(kStringLiteralExpression)); 960 return PreParserExpression(TypeField::encode(kStringLiteralExpression));
953 } 961 }
954 962
955 static PreParserExpression UseStrictStringLiteral() { 963 static PreParserExpression UseStrictStringLiteral() {
956 return PreParserExpression(TypeField::encode(kStringLiteralExpression) | 964 return PreParserExpression(TypeField::encode(kStringLiteralExpression) |
957 IsUseStrictField::encode(true)); 965 IsUseStrictField::encode(true));
958 } 966 }
959 967
960 static PreParserExpression UseStrongStringLiteral() { 968 static PreParserExpression UseStrongStringLiteral() {
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
998 1006
999 bool IsIdentifier() const { 1007 bool IsIdentifier() const {
1000 return TypeField::decode(code_) == kIdentifierExpression; 1008 return TypeField::decode(code_) == kIdentifierExpression;
1001 } 1009 }
1002 1010
1003 PreParserIdentifier AsIdentifier() const { 1011 PreParserIdentifier AsIdentifier() const {
1004 DCHECK(IsIdentifier()); 1012 DCHECK(IsIdentifier());
1005 return PreParserIdentifier(IdentifierTypeField::decode(code_)); 1013 return PreParserIdentifier(IdentifierTypeField::decode(code_));
1006 } 1014 }
1007 1015
1016 bool IsObjectLiteral() const {
1017 return TypeField::decode(code_) == kObjectLiteralExpression;
1018 }
1019
1020 bool IsArrayLiteral() const {
1021 return TypeField::decode(code_) == kArrayLiteralExpression;
1022 }
1023
1008 bool IsStringLiteral() const { 1024 bool IsStringLiteral() const {
1009 return TypeField::decode(code_) == kStringLiteralExpression; 1025 return TypeField::decode(code_) == kStringLiteralExpression;
1010 } 1026 }
1011 1027
1012 bool IsUseStrictLiteral() const { 1028 bool IsUseStrictLiteral() const {
1013 return TypeField::decode(code_) == kStringLiteralExpression && 1029 return TypeField::decode(code_) == kStringLiteralExpression &&
1014 IsUseStrictField::decode(code_); 1030 IsUseStrictField::decode(code_);
1015 } 1031 }
1016 1032
1017 bool IsUseStrongLiteral() const { 1033 bool IsUseStrongLiteral() const {
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
1086 1102
1087 int position() const { return RelocInfo::kNoPosition; } 1103 int position() const { return RelocInfo::kNoPosition; }
1088 void set_function_token_position(int position) {} 1104 void set_function_token_position(int position) {}
1089 1105
1090 private: 1106 private:
1091 enum Type { 1107 enum Type {
1092 kExpression, 1108 kExpression,
1093 kIdentifierExpression, 1109 kIdentifierExpression,
1094 kStringLiteralExpression, 1110 kStringLiteralExpression,
1095 kBinaryOperationExpression, 1111 kBinaryOperationExpression,
1096 kSpreadExpression 1112 kSpreadExpression,
1113 kObjectLiteralExpression,
1114 kArrayLiteralExpression
1097 }; 1115 };
1098 1116
1099 enum ExpressionType { 1117 enum ExpressionType {
1100 kThisExpression, 1118 kThisExpression,
1101 kThisPropertyExpression, 1119 kThisPropertyExpression,
1102 kPropertyExpression, 1120 kPropertyExpression,
1103 kCallExpression, 1121 kCallExpression,
1104 kSuperCallReference, 1122 kSuperCallReference,
1105 kNoTemplateTagExpression 1123 kNoTemplateTagExpression
1106 }; 1124 };
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
1224 PreParserIdentifier js_flags, 1242 PreParserIdentifier js_flags,
1225 int literal_index, 1243 int literal_index,
1226 bool is_strong, 1244 bool is_strong,
1227 int pos) { 1245 int pos) {
1228 return PreParserExpression::Default(); 1246 return PreParserExpression::Default();
1229 } 1247 }
1230 PreParserExpression NewArrayLiteral(PreParserExpressionList values, 1248 PreParserExpression NewArrayLiteral(PreParserExpressionList values,
1231 int literal_index, 1249 int literal_index,
1232 bool is_strong, 1250 bool is_strong,
1233 int pos) { 1251 int pos) {
1234 return PreParserExpression::Default(); 1252 return PreParserExpression::ArrayLiteral();
1235 } 1253 }
1236 PreParserExpression NewArrayLiteral(PreParserExpressionList values, 1254 PreParserExpression NewArrayLiteral(PreParserExpressionList values,
1237 int first_spread_index, int literal_index, 1255 int first_spread_index, int literal_index,
1238 bool is_strong, int pos) { 1256 bool is_strong, int pos) {
1239 return PreParserExpression::Default(); 1257 return PreParserExpression::ArrayLiteral();
1240 } 1258 }
1241 PreParserExpression NewObjectLiteralProperty(PreParserExpression key, 1259 PreParserExpression NewObjectLiteralProperty(PreParserExpression key,
1242 PreParserExpression value, 1260 PreParserExpression value,
1243 ObjectLiteralProperty::Kind kind, 1261 ObjectLiteralProperty::Kind kind,
1244 bool is_static, 1262 bool is_static,
1245 bool is_computed_name) { 1263 bool is_computed_name) {
1246 return PreParserExpression::Default(); 1264 return PreParserExpression::Default();
1247 } 1265 }
1248 PreParserExpression NewObjectLiteralProperty(PreParserExpression key, 1266 PreParserExpression NewObjectLiteralProperty(PreParserExpression key,
1249 PreParserExpression value, 1267 PreParserExpression value,
1250 bool is_static, 1268 bool is_static,
1251 bool is_computed_name) { 1269 bool is_computed_name) {
1252 return PreParserExpression::Default(); 1270 return PreParserExpression::Default();
1253 } 1271 }
1254 PreParserExpression NewObjectLiteral(PreParserExpressionList properties, 1272 PreParserExpression NewObjectLiteral(PreParserExpressionList properties,
1255 int literal_index, 1273 int literal_index,
1256 int boilerplate_properties, 1274 int boilerplate_properties,
1257 bool has_function, 1275 bool has_function,
1258 bool is_strong, 1276 bool is_strong,
1259 int pos) { 1277 int pos) {
1260 return PreParserExpression::Default(); 1278 return PreParserExpression::ObjectLiteral();
1261 } 1279 }
1262 PreParserExpression NewVariableProxy(void* variable) { 1280 PreParserExpression NewVariableProxy(void* variable) {
1263 return PreParserExpression::Default(); 1281 return PreParserExpression::Default();
1264 } 1282 }
1265 PreParserExpression NewProperty(PreParserExpression obj, 1283 PreParserExpression NewProperty(PreParserExpression obj,
1266 PreParserExpression key, 1284 PreParserExpression key,
1267 int pos) { 1285 int pos) {
1268 if (obj.IsThis()) { 1286 if (obj.IsThis()) {
1269 return PreParserExpression::ThisProperty(); 1287 return PreParserExpression::ThisProperty();
1270 } 1288 }
(...skipping 2933 matching lines...) Expand 10 before | Expand all | Expand 10 after
4204 return; 4222 return;
4205 } 4223 }
4206 has_seen_constructor_ = true; 4224 has_seen_constructor_ = true;
4207 return; 4225 return;
4208 } 4226 }
4209 } 4227 }
4210 } // namespace internal 4228 } // namespace internal
4211 } // namespace v8 4229 } // namespace v8
4212 4230
4213 #endif // V8_PREPARSER_H 4231 #endif // V8_PREPARSER_H
OLDNEW
« no previous file with comments | « src/parser.cc ('k') | src/preparser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698