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

Unified Diff: src/preparser.h

Issue 1218803006: Add a flag for legacy const semantics (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Add message tests 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/parser.cc ('k') | src/preparser.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/preparser.h
diff --git a/src/preparser.h b/src/preparser.h
index 92712ff0d892cb0c035148cb50dd8955a63cf7db..2831266db7a3a206e1a6d00c2fef87bdda17ad4e 100644
--- a/src/preparser.h
+++ b/src/preparser.h
@@ -99,7 +99,8 @@ class ParserBase : public Traits {
allow_harmony_destructuring_(false),
allow_harmony_spread_arrays_(false),
allow_harmony_new_target_(false),
- allow_strong_mode_(false) {}
+ allow_strong_mode_(false),
+ allow_legacy_const_(true) {}
#define ALLOW_ACCESSORS(name) \
bool allow_##name() const { return allow_##name##_; } \
@@ -116,6 +117,7 @@ class ParserBase : public Traits {
ALLOW_ACCESSORS(harmony_spread_arrays);
ALLOW_ACCESSORS(harmony_new_target);
ALLOW_ACCESSORS(strong_mode);
+ ALLOW_ACCESSORS(legacy_const);
#undef ALLOW_ACCESSORS
bool allow_harmony_modules() const { return scanner()->HarmonyModules(); }
@@ -491,6 +493,10 @@ class ParserBase : public Traits {
LanguageMode language_mode() { return scope_->language_mode(); }
bool is_generator() const { return function_state_->is_generator(); }
+ bool allow_const() {
+ return is_strict(language_mode()) || allow_legacy_const();
+ }
+
// Report syntax errors.
void ReportMessage(MessageTemplate::Template message, const char* arg = NULL,
ParseErrorType error_type = kSyntaxError) {
@@ -788,6 +794,7 @@ class ParserBase : public Traits {
bool allow_harmony_spread_arrays_;
bool allow_harmony_new_target_;
bool allow_strong_mode_;
+ bool allow_legacy_const_;
};
« 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