Index: src/preparser.h |
diff --git a/src/preparser.h b/src/preparser.h |
index 647a142b1a152d31fe059fbd72224450bca9d3b5..fbc852e3fd2101dc689c077b12fb10c43fd7dac7 100644 |
--- a/src/preparser.h |
+++ b/src/preparser.h |
@@ -417,8 +417,8 @@ class PreParser { |
materialized_literal_count_(0), |
expected_properties_(0), |
with_nesting_count_(0), |
- strict_mode_flag_((prev_ != NULL) ? prev_->strict_mode_flag() |
- : i::kNonStrictMode) { |
+ language_mode_( |
+ (prev_ != NULL) ? prev_->language_mode() : i::CLASSIC_MODE) { |
*variable = this; |
} |
~Scope() { *variable_ = prev_; } |
@@ -428,12 +428,14 @@ class PreParser { |
int expected_properties() { return expected_properties_; } |
int materialized_literal_count() { return materialized_literal_count_; } |
bool IsInsideWith() { return with_nesting_count_ != 0; } |
- bool is_strict_mode() { return strict_mode_flag_ == i::kStrictMode; } |
- i::StrictModeFlag strict_mode_flag() { |
- return strict_mode_flag_; |
+ bool is_classic_mode() { |
+ return language_mode_ == i::CLASSIC_MODE; |
} |
- void set_strict_mode_flag(i::StrictModeFlag strict_mode_flag) { |
- strict_mode_flag_ = strict_mode_flag; |
+ i::LanguageMode language_mode() { |
+ return language_mode_; |
+ } |
+ void set_language_mode(i::LanguageMode language_mode) { |
+ language_mode_ = language_mode; |
} |
void EnterWith() { with_nesting_count_++; } |
void LeaveWith() { with_nesting_count_--; } |
@@ -445,7 +447,7 @@ class PreParser { |
int materialized_literal_count_; |
int expected_properties_; |
int with_nesting_count_; |
- i::StrictModeFlag strict_mode_flag_; |
+ i::LanguageMode language_mode_; |
}; |
// Private constructor only used in PreParseProgram. |
@@ -476,7 +478,7 @@ class PreParser { |
if (stack_overflow_) return kPreParseStackOverflow; |
if (!ok) { |
ReportUnexpectedToken(scanner_->current_token()); |
- } else if (scope_->is_strict_mode()) { |
+ } else if (!scope_->is_classic_mode()) { |
CheckOctalLiteral(start_position, scanner_->location().end_pos, &ok); |
} |
return kPreParseSuccess; |
@@ -580,13 +582,19 @@ class PreParser { |
bool peek_any_identifier(); |
- void set_strict_mode() { |
- scope_->set_strict_mode_flag(i::kStrictMode); |
+ void set_language_mode(i::LanguageMode language_mode) { |
+ scope_->set_language_mode(language_mode); |
+ } |
+ |
+ bool is_classic_mode() { |
+ return scope_->language_mode() == i::CLASSIC_MODE; |
} |
- bool strict_mode() { return scope_->strict_mode_flag() == i::kStrictMode; } |
+ bool is_extended_mode() { |
+ return scope_->language_mode() == i::EXTENDED_MODE; |
+ } |
- i::StrictModeFlag strict_mode_flag() { return scope_->strict_mode_flag(); } |
+ i::LanguageMode language_mode() { return scope_->language_mode(); } |
void Consume(i::Token::Value token) { Next(); } |