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

Unified Diff: src/preparser.h

Issue 8417035: Introduce extended mode. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed more comments. Created 9 years, 1 month 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/preparse-data.h ('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 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(); }
« no previous file with comments | « src/preparse-data.h ('k') | src/preparser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698