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

Side by Side Diff: src/preparser.h

Issue 1219853004: [es6] Initial support for let/const bindings in sloppy mode (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Updated tests and comments Created 5 years, 5 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 unified diff | Download patch
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/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
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698