Commit 540bc271 authored by Toon Verwaest's avatar Toon Verwaest Committed by Commit Bot

[parser] Don't copy unresolved references if outer is script_scope

Change-Id: Ia5f8ff6279860db83e5bb95206d3e740a13fcc3c
Reviewed-on: https://chromium-review.googlesource.com/1248621Reviewed-by: 's avatarIgor Sheludko <ishell@chromium.org>
Commit-Queue: Toon Verwaest <verwaest@chromium.org>
Cr-Commit-Position: refs/heads/master@{#56265}
parent 5f33baf6
......@@ -1547,8 +1547,13 @@ void DeclarationScope::AnalyzePartially(AstNodeFactory* ast_node_factory) {
// them in the outer Scopes here, because they are incomplete.
ResolveScopesThenForEachVariable(
this, [=, &new_unresolved_list](VariableProxy* proxy) {
VariableProxy* copy = ast_node_factory->CopyVariableProxy(proxy);
new_unresolved_list.AddFront(copy);
// Don't copy unresolved references to the script scope, unless it's a
// reference to a private field. In that case keep it so we can fail
// later.
if (!outer_scope_->is_script_scope() || proxy->is_private_field()) {
VariableProxy* copy = ast_node_factory->CopyVariableProxy(proxy);
new_unresolved_list.AddFront(copy);
}
});
// Migrate function_ to the right Zone.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment