Ensure helpers that reference globals continue to reference the globals properly.

This commit is contained in:
Logan Smyth
2017-05-05 01:01:35 -07:00
parent 158e9fbfd7
commit 634c750558
3 changed files with 16 additions and 8 deletions

View File

@@ -9,13 +9,6 @@ export default function() {
Function(path, state) {
if (!path.node.async || path.node.generator) return;
// Ensure any Promise bindings at the Program level are renamed
// so the asyncToGenerator helper only sees the native Promise
const programScope = path.scope.getProgramParent();
if (programScope.hasBinding("Promise", true)) {
programScope.rename("Promise");
}
remapAsyncToGenerator(path, state.file, {
wrapAsync: state.addHelper("asyncToGenerator"),
});