Index: src/ast/scopes.cc |
diff --git a/src/ast/scopes.cc b/src/ast/scopes.cc |
index c351f1d0d6f50d3ac39216ab3754f045b34b72a4..8530d6cc90fc5b4cc8ad6b9317d6f83e793dbe6a 100644 |
--- a/src/ast/scopes.cc |
+++ b/src/ast/scopes.cc |
@@ -1707,6 +1707,15 @@ void Scope::ResolveVariable(ParseInfo* info, VariableProxy* proxy) { |
namespace { |
bool AccessNeedsHoleCheck(Variable* var, VariableProxy* proxy, Scope* scope) { |
+ if (var->mode() == DYNAMIC_LOCAL) { |
+ // Dynamically introduced variables never need a hole check (since they're |
+ // VAR bindings, either from var or function declarations), but the variable |
+ // they shadow might need a hole check, which we want to do if we decide |
+ // that no shadowing variable was dynamically introoduced. |
+ DCHECK(!var->binding_needs_init()); |
+ return AccessNeedsHoleCheck(var->local_if_not_shadowed(), proxy, scope); |
+ } |
+ |
if (!var->binding_needs_init()) { |
return false; |
} |