Skip to content
This repository has been archived by the owner on Jan 11, 2023. It is now read-only.

Handle out-of-order declarations in scopes. #5690

Merged
merged 2 commits into from Mar 16, 2018

Conversation

loganfsmyth
Copy link
Contributor

Refs Issue: #5561

Summary of Changes

  • Collects variable references on enter but doesn't try to find their related bindings until exit

Trying to associate the references with declarations on enter leads to errors if the references is earlier in the file that the declaration.

end: fromBabelLocation(node.loc.end, state.sourceId),
meta: buildMetaBindings(state.sourceId, node, ancestors)
});
let freeVariables = state.freeVariables.get(node.name);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what's this doing? can you add some comments here for what a free variable is

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Totally.

if (binding) {
binding.refs = freeVariables.concat(binding.refs);
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does it also help to have a unit test for the visitor so that we have more direct tests of this case, which would be easier to fix than the mochitest

@jasonLaster
Copy link
Contributor

i think all of these PRs are blocked by unrelated travis fails... i'll fix them in #5689 which was in hindsight too narrow

@jasonLaster jasonLaster merged commit 7fa4241 into firefox-devtools:master Mar 16, 2018
@loganfsmyth loganfsmyth deleted the out-of-order-decl branch March 16, 2018 21:16
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants