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/v8.h" | 8 #include "src/v8.h" |
9 | 9 |
10 #include "src/bailout-reason.h" | 10 #include "src/bailout-reason.h" |
(...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
487 } | 487 } |
488 | 488 |
489 typename Traits::Type::Factory* factory() { | 489 typename Traits::Type::Factory* factory() { |
490 return function_state_->factory(); | 490 return function_state_->factory(); |
491 } | 491 } |
492 | 492 |
493 LanguageMode language_mode() { return scope_->language_mode(); } | 493 LanguageMode language_mode() { return scope_->language_mode(); } |
494 bool is_generator() const { return function_state_->is_generator(); } | 494 bool is_generator() const { return function_state_->is_generator(); } |
495 | 495 |
496 bool allow_const() { | 496 bool allow_const() { |
497 return is_strict(language_mode()) || allow_legacy_const(); | 497 return is_strict(language_mode()) || allow_harmony_sloppy() || |
| 498 allow_legacy_const(); |
| 499 } |
| 500 |
| 501 bool allow_let() { |
| 502 return is_strict(language_mode()) || allow_harmony_sloppy(); |
498 } | 503 } |
499 | 504 |
500 // Report syntax errors. | 505 // Report syntax errors. |
501 void ReportMessage(MessageTemplate::Template message, const char* arg = NULL, | 506 void ReportMessage(MessageTemplate::Template message, const char* arg = NULL, |
502 ParseErrorType error_type = kSyntaxError) { | 507 ParseErrorType error_type = kSyntaxError) { |
503 Scanner::Location source_location = scanner()->location(); | 508 Scanner::Location source_location = scanner()->location(); |
504 Traits::ReportMessageAt(source_location, message, arg, error_type); | 509 Traits::ReportMessageAt(source_location, message, arg, error_type); |
505 } | 510 } |
506 | 511 |
507 void ReportMessageAt(Scanner::Location location, | 512 void ReportMessageAt(Scanner::Location location, |
(...skipping 3460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3968 *ok = false; | 3973 *ok = false; |
3969 return; | 3974 return; |
3970 } | 3975 } |
3971 has_seen_constructor_ = true; | 3976 has_seen_constructor_ = true; |
3972 return; | 3977 return; |
3973 } | 3978 } |
3974 } | 3979 } |
3975 } } // v8::internal | 3980 } } // v8::internal |
3976 | 3981 |
3977 #endif // V8_PREPARSER_H | 3982 #endif // V8_PREPARSER_H |
OLD | NEW |