Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(122)

Unified Diff: pkg/dev_compiler/lib/src/compiler/module_builder.dart

Issue 2701963002: Enable DDC output to run on v8/d8 using ES6 modules (Closed)
Patch Set: Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: pkg/dev_compiler/lib/src/compiler/module_builder.dart
diff --git a/pkg/dev_compiler/lib/src/compiler/module_builder.dart b/pkg/dev_compiler/lib/src/compiler/module_builder.dart
index 355f3effaf5c6f9e2c91b956a79e6606db96da2f..07510ebc9daf46b3523a3f185fed6461f0e76eae 100644
--- a/pkg/dev_compiler/lib/src/compiler/module_builder.dart
+++ b/pkg/dev_compiler/lib/src/compiler/module_builder.dart
@@ -212,7 +212,7 @@ class LegacyModuleBuilder extends _ModuleBuilder {
/// Generates CommonJS modules (used by Node.js).
class CommonJSModuleBuilder extends _ModuleBuilder {
Program build(Program module) {
- var importStatements = <Statement>[];
+ var importStatements = [js.statement("'use strict';"),];
// Collect imports/exports/statements.
visitProgram(module);
@@ -249,12 +249,7 @@ class CommonJSModuleBuilder extends _ModuleBuilder {
}
}
- // TODO(vsm): See https://github.com/dart-lang/sdk/issues/27309
- // This extra level of indirection should be unnecessary.
- var block =
- js.statement("(function() { 'use strict'; #; })()", [statements]);
-
- return new Program([block]);
+ return new Program(statements);
}
}
« no previous file with comments | « pkg/dev_compiler/lib/src/compiler/js_names.dart ('k') | pkg/dev_compiler/test/codegen_expected/node_modules.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698