ensure dynamic imports are hoisted

This commit is contained in:
Sebastian McKenzie
2015-05-08 23:33:30 +01:00
parent 920c84a1f2
commit 89e31085d2
2 changed files with 10 additions and 6 deletions

View File

@@ -7,6 +7,11 @@ export var metadata = {
export var Program = {
exit(program, parent, scope, file) {
strict.wrap(program, function () {
// ensure that these are at the top, just like normal imports
for (var node of (file.dynamicImports: Array)) {
node._blockHoist = 3;
}
program.body = file.dynamicImports.concat(program.body);
});