Index: src/parser.cc |
diff --git a/src/parser.cc b/src/parser.cc |
index 02fa25b192372665f4211f43ed09a634353e01be..ffbf9d9f8c5cada1a546a09d350cf7037ef6c07f 100644 |
--- a/src/parser.cc |
+++ b/src/parser.cc |
@@ -3011,7 +3011,18 @@ Expression* Parser::ParseLeftHandSideExpression(bool* ok) { |
VariableProxy* callee = result->AsVariableProxy(); |
if (callee != NULL && |
callee->IsVariable(isolate()->factory()->eval_symbol())) { |
- top_scope_->DeclarationScope()->RecordEvalCall(); |
+ if (FLAG_harmony_scoping) { |
+ Scope* scope = top_scope_; |
+ while (!scope->calls_eval() && |
+ !scope->is_declaration_scope()) { |
+ scope->RecordEvalCall(); |
+ scope = scope->outer_scope(); |
+ } |
+ // Make sure to record the eval call in the declaration scope. |
+ scope->RecordEvalCall(); |
+ } else { |
+ top_scope_->DeclarationScope()->RecordEvalCall(); |
+ } |
} |
result = NewCall(result, args, pos); |
break; |