| OLD | NEW |
| 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 1232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1243 explicit PreParserFactory(void* unused_value_factory) {} | 1243 explicit PreParserFactory(void* unused_value_factory) {} |
| 1244 PreParserExpression NewStringLiteral(PreParserIdentifier identifier, | 1244 PreParserExpression NewStringLiteral(PreParserIdentifier identifier, |
| 1245 int pos) { | 1245 int pos) { |
| 1246 return PreParserExpression::Default(); | 1246 return PreParserExpression::Default(); |
| 1247 } | 1247 } |
| 1248 PreParserExpression NewNumberLiteral(double number, | 1248 PreParserExpression NewNumberLiteral(double number, |
| 1249 int pos) { | 1249 int pos) { |
| 1250 return PreParserExpression::Default(); | 1250 return PreParserExpression::Default(); |
| 1251 } | 1251 } |
| 1252 PreParserExpression NewRegExpLiteral(PreParserIdentifier js_pattern, | 1252 PreParserExpression NewRegExpLiteral(PreParserIdentifier js_pattern, |
| 1253 PreParserIdentifier js_flags, | 1253 int js_flags, int literal_index, |
| 1254 int literal_index, | 1254 bool is_strong, int pos) { |
| 1255 bool is_strong, | |
| 1256 int pos) { | |
| 1257 return PreParserExpression::Default(); | 1255 return PreParserExpression::Default(); |
| 1258 } | 1256 } |
| 1259 PreParserExpression NewArrayLiteral(PreParserExpressionList values, | 1257 PreParserExpression NewArrayLiteral(PreParserExpressionList values, |
| 1260 int literal_index, | 1258 int literal_index, |
| 1261 bool is_strong, | 1259 bool is_strong, |
| 1262 int pos) { | 1260 int pos) { |
| 1263 return PreParserExpression::ArrayLiteral(); | 1261 return PreParserExpression::ArrayLiteral(); |
| 1264 } | 1262 } |
| 1265 PreParserExpression NewArrayLiteral(PreParserExpressionList values, | 1263 PreParserExpression NewArrayLiteral(PreParserExpressionList values, |
| 1266 int first_spread_index, int literal_index, | 1264 int first_spread_index, int literal_index, |
| (...skipping 952 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2219 if (!scanner()->ScanRegExpPattern(seen_equal)) { | 2217 if (!scanner()->ScanRegExpPattern(seen_equal)) { |
| 2220 Next(); | 2218 Next(); |
| 2221 ReportMessage(MessageTemplate::kUnterminatedRegExp); | 2219 ReportMessage(MessageTemplate::kUnterminatedRegExp); |
| 2222 *ok = false; | 2220 *ok = false; |
| 2223 return Traits::EmptyExpression(); | 2221 return Traits::EmptyExpression(); |
| 2224 } | 2222 } |
| 2225 | 2223 |
| 2226 int literal_index = function_state_->NextMaterializedLiteralIndex(); | 2224 int literal_index = function_state_->NextMaterializedLiteralIndex(); |
| 2227 | 2225 |
| 2228 IdentifierT js_pattern = this->GetNextSymbol(scanner()); | 2226 IdentifierT js_pattern = this->GetNextSymbol(scanner()); |
| 2229 if (!scanner()->ScanRegExpFlags()) { | 2227 Maybe<RegExp::Flags> flags = scanner()->ScanRegExpFlags(); |
| 2228 if (flags.IsNothing()) { |
| 2230 Next(); | 2229 Next(); |
| 2231 ReportMessage(MessageTemplate::kMalformedRegExpFlags); | 2230 ReportMessage(MessageTemplate::kMalformedRegExpFlags); |
| 2232 *ok = false; | 2231 *ok = false; |
| 2233 return Traits::EmptyExpression(); | 2232 return Traits::EmptyExpression(); |
| 2234 } | 2233 } |
| 2235 IdentifierT js_flags = this->GetNextSymbol(scanner()); | 2234 int js_flags = flags.FromJust(); |
| 2236 Next(); | 2235 Next(); |
| 2237 return factory()->NewRegExpLiteral(js_pattern, js_flags, literal_index, | 2236 return factory()->NewRegExpLiteral(js_pattern, js_flags, literal_index, |
| 2238 is_strong(language_mode()), pos); | 2237 is_strong(language_mode()), pos); |
| 2239 } | 2238 } |
| 2240 | 2239 |
| 2241 | 2240 |
| 2242 #define CHECK_OK ok); \ | 2241 #define CHECK_OK ok); \ |
| 2243 if (!*ok) return this->EmptyExpression(); \ | 2242 if (!*ok) return this->EmptyExpression(); \ |
| 2244 ((void)0 | 2243 ((void)0 |
| 2245 #define DUMMY ) // to make indentation work | 2244 #define DUMMY ) // to make indentation work |
| (...skipping 2008 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4254 return; | 4253 return; |
| 4255 } | 4254 } |
| 4256 has_seen_constructor_ = true; | 4255 has_seen_constructor_ = true; |
| 4257 return; | 4256 return; |
| 4258 } | 4257 } |
| 4259 } | 4258 } |
| 4260 } // namespace internal | 4259 } // namespace internal |
| 4261 } // namespace v8 | 4260 } // namespace v8 |
| 4262 | 4261 |
| 4263 #endif // V8_PREPARSER_H | 4262 #endif // V8_PREPARSER_H |
| OLD | NEW |