Index: lib/src/compiler/module_builder.dart |
diff --git a/lib/src/compiler/module_builder.dart b/lib/src/compiler/module_builder.dart |
index 7a6866c6463c53269bc03c0f817ff11c01b59a5a..ec193d98abca6680a9dfde071e410b3b0282692c 100644 |
--- a/lib/src/compiler/module_builder.dart |
+++ b/lib/src/compiler/module_builder.dart |
@@ -104,7 +104,10 @@ class LegacyModuleBuilder extends _ModuleBuilder { |
/// Generates node modules. |
class NodeModuleBuilder extends _ModuleBuilder { |
Program build(Program module) { |
- var importStatements = [js.statement("'use strict';"),]; |
+ var importStatements = []; |
+ |
+ // Collect imports/exports/statements. |
+ visitProgram(module); |
for (var import in imports) { |
// TODO(jmesserly): we could use destructuring once Atom supports it. |
@@ -135,7 +138,11 @@ class NodeModuleBuilder extends _ModuleBuilder { |
} |
} |
} |
- return new Program(statements); |
+ |
+ var block = |
vsm
2016/04/18 13:38:25
Not entirely sure why I seem to need this. Withou
Jennifer Messerly
2016/04/18 20:52:18
Yeah seems like it's skipping the top-level. That'
vsm
2016/04/19 21:28:29
Added a TODO and filed a bug for now.
|
+ js.statement("(function() { 'use strict'; #; })()", [statements]); |
+ |
+ return new Program([block]); |
} |
} |