Index: src/scopes.h |
diff --git a/src/scopes.h b/src/scopes.h |
index a9220eb827566e94e7a126f1085bdc90d6c3a67c..123c4d867f251d1c77e264eb79b34b9817b2afcd 100644 |
--- a/src/scopes.h |
+++ b/src/scopes.h |
@@ -193,6 +193,10 @@ class Scope: public ZoneObject { |
// Inform the scope that the corresponding code contains an eval call. |
void RecordEvalCall() { scope_calls_eval_ = true; } |
+ // Enable strict mode for the scope (unless disabled by a global flag). |
+ void EnableStrictMode() { |
+ strict_mode_ = FLAG_strict_mode; |
+ } |
// --------------------------------------------------------------------------- |
// Predicates. |
@@ -201,6 +205,7 @@ class Scope: public ZoneObject { |
bool is_eval_scope() const { return type_ == EVAL_SCOPE; } |
bool is_function_scope() const { return type_ == FUNCTION_SCOPE; } |
bool is_global_scope() const { return type_ == GLOBAL_SCOPE; } |
+ bool is_strict_mode() const { return strict_mode_; } |
// Information about which scopes calls eval. |
bool calls_eval() const { return scope_calls_eval_; } |
@@ -363,6 +368,7 @@ class Scope: public ZoneObject { |
bool scope_inside_with_; // this scope is inside a 'with' of some outer scope |
bool scope_contains_with_; // this scope contains a 'with' statement |
bool scope_calls_eval_; // this scope contains an 'eval' call |
+ bool strict_mode_; // this scope is a strict mode scope |
// Computed via PropagateScopeInfo. |
bool outer_scope_calls_eval_; |
@@ -428,6 +434,8 @@ class Scope: public ZoneObject { |
scope_inside_with_ = false; |
scope_contains_with_ = false; |
scope_calls_eval_ = false; |
+ // Inherit the strict mode from the parent scope. |
+ strict_mode_ = (outer_scope != NULL) && outer_scope->strict_mode_; |
outer_scope_calls_eval_ = false; |
inner_scope_calls_eval_ = false; |
outer_scope_is_eval_scope_ = false; |