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

Unified Diff: src/scopes.h

Issue 8417035: Introduce extended mode. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebased version. 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
Index: src/scopes.h
diff --git a/src/scopes.h b/src/scopes.h
index d08e2948242d1e52e61c33853d5e8281a2063b27..b412773d5d9711e613eb12fc5464a323bde90133 100644
--- a/src/scopes.h
+++ b/src/scopes.h
@@ -192,8 +192,8 @@ class Scope: public ZoneObject {
void RecordEvalCall() { if (!is_global_scope()) scope_calls_eval_ = true; }
// Set the strict mode flag (unless disabled by a global flag).
- void SetStrictModeFlag(StrictModeFlag strict_mode_flag) {
- strict_mode_flag_ = FLAG_strict_mode ? strict_mode_flag : kNonStrictMode;
+ void SetLanguageMode(LanguageMode language_mode) {
+ language_mode_ = FLAG_strict_mode ? language_mode : CLASSIC_MODE;
rossberg 2011/11/08 15:02:46 Does such a flag still make sense given the new la
Steven 2011/11/08 16:13:49 Not really. Removing it. On 2011/11/08 15:02:46, r
}
// Position in the source where this scope begins and ends.
@@ -240,15 +240,23 @@ class Scope: public ZoneObject {
bool is_declaration_scope() const {
return is_eval_scope() || is_function_scope() || is_global_scope();
}
- bool is_strict_mode() const { return strict_mode_flag() == kStrictMode; }
- bool is_strict_mode_eval_scope() const {
- return is_eval_scope() && is_strict_mode();
+ bool is_classic_mode() const {
+ return language_mode() == CLASSIC_MODE;
+ }
+ bool is_extended_mode() const {
+ return language_mode() == EXTENDED_MODE;
+ }
+ bool is_strict_or_extended_mode() const {
rossberg 2011/11/08 15:02:46 And one more.
Steven 2011/11/08 16:13:49 Done.
+ return language_mode() != CLASSIC_MODE;
+ }
+ bool is_strict_or_extended_eval_scope() const {
+ return is_eval_scope() && is_strict_or_extended_mode();
}
// Information about which scopes calls eval.
bool calls_eval() const { return scope_calls_eval_; }
bool calls_non_strict_eval() {
- return scope_calls_eval_ && !is_strict_mode();
+ return scope_calls_eval_ && is_classic_mode();
}
bool outer_scope_calls_non_strict_eval() const {
return outer_scope_calls_non_strict_eval_;
@@ -268,8 +276,8 @@ class Scope: public ZoneObject {
// The type of this scope.
ScopeType type() const { return type_; }
- // The strict mode of this scope.
- StrictModeFlag strict_mode_flag() const { return strict_mode_flag_; }
+ // The language mode of this scope.
+ LanguageMode language_mode() const { return language_mode_; }
// The variable corresponding the 'this' value.
Variable* receiver() { return receiver_; }
@@ -425,7 +433,7 @@ class Scope: public ZoneObject {
// the 'eval' call site this scope is the declaration scope.
bool scope_calls_eval_;
// This scope is a strict mode scope.
- StrictModeFlag strict_mode_flag_;
+ LanguageMode language_mode_;
// Source positions.
int start_position_;
int end_position_;

Powered by Google App Engine
This is Rietveld 408576698