Index: src/ast/scopes.cc |
diff --git a/src/ast/scopes.cc b/src/ast/scopes.cc |
index 4e107bd3fdab1a258a5ff747ebc63893094cd5e8..5b37bd9714bc7ded2b37d0237ef53119551f5a4e 100644 |
--- a/src/ast/scopes.cc |
+++ b/src/ast/scopes.cc |
@@ -1304,7 +1304,7 @@ Variable* Scope::LookupRecursive(VariableProxy* proxy, |
} else if (outer_scope_ != nullptr && this != max_outer_scope) { |
var = outer_scope_->LookupRecursive(proxy, binding_kind, factory, |
max_outer_scope); |
- if (*binding_kind == BOUND && (is_function_scope() || is_with_scope())) { |
+ if (*binding_kind == BOUND && is_function_scope()) { |
var->ForceContextAllocation(); |
} |
} else { |
@@ -1323,7 +1323,11 @@ Variable* Scope::LookupRecursive(VariableProxy* proxy, |
// the associated variable has to be marked as potentially being accessed |
// from inside of an inner with scope (the property may not be in the 'with' |
// object). |
- if (var != NULL && proxy->is_assigned()) var->set_maybe_assigned(); |
+ if (var != NULL) { |
+ var->set_is_used(); |
+ var->ForceContextAllocation(); |
+ if (proxy->is_assigned()) var->set_maybe_assigned(); |
+ } |
*binding_kind = DYNAMIC_LOOKUP; |
return NULL; |
} else if (calls_sloppy_eval() && is_declaration_scope() && |
@@ -1489,8 +1493,7 @@ bool Scope::MustAllocate(Variable* var) { |
// via an eval() call. This is only possible if the variable has a |
// visible name. |
if ((var->is_this() || !var->raw_name()->IsEmpty()) && |
- (var->has_forced_context_allocation() || scope_calls_eval_ || |
- inner_scope_calls_eval_ || is_catch_scope() || is_block_scope() || |
+ (scope_calls_eval_ || inner_scope_calls_eval_ || is_catch_scope() || |
is_script_scope())) { |
var->set_is_used(); |
if (scope_calls_eval_ || inner_scope_calls_eval_) var->set_maybe_assigned(); |