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

Unified Diff: src/scopes.h

Issue 8344082: Replace boolean indications of strict mode by an enum value. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Some fixes and adapted the preparser. Created 9 years, 2 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
« src/compiler.cc ('K') | « src/runtime.cc ('k') | src/scopes.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/scopes.h
diff --git a/src/scopes.h b/src/scopes.h
index 72f1e31878efb744ac8d1210f531d1d16b7a0026..40898f8c6b36bad9e83f15ca66303848d037db95 100644
--- a/src/scopes.h
+++ b/src/scopes.h
@@ -201,9 +201,9 @@ class Scope: public ZoneObject {
// Inform the scope that the corresponding code contains an eval call.
void RecordEvalCall() { if (!is_global_scope()) scope_calls_eval_ = true; }
- // Enable strict mode for the scope (unless disabled by a global flag).
- void EnableStrictMode() {
- strict_mode_ = FLAG_strict_mode;
+ // 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;
}
// ---------------------------------------------------------------------------
@@ -219,7 +219,7 @@ 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_; }
+ bool is_strict_mode() const { return strict_mode_flag() == kStrictMode; }
bool is_strict_mode_eval_scope() const {
return is_eval_scope() && is_strict_mode();
}
@@ -244,6 +244,8 @@ class Scope: public ZoneObject {
// ---------------------------------------------------------------------------
// Accessors.
+ StrictModeFlag strict_mode_flag() const { return strict_mode_flag_; }
+
// The variable corresponding the 'this' value.
Variable* receiver() { return receiver_; }
@@ -386,7 +388,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.
- bool strict_mode_;
+ StrictModeFlag strict_mode_flag_;
// Computed via PropagateScopeInfo.
bool outer_scope_calls_non_strict_eval_;
« src/compiler.cc ('K') | « src/runtime.cc ('k') | src/scopes.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698