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

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

Issue 2753623002: Support iife heuristic in DDC (Closed)
Patch Set: Created 3 years, 9 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
« no previous file with comments | « pkg/dev_compiler/lib/js/legacy/dart_sdk.js ('k') | pkg/dev_compiler/lib/src/js_ast/nodes.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 e3072469b06b38b12e47bce0faf59bf1f15ebd6c..6f6c237eac3ed9e76ca988fc95046b1545aeb419 100644
--- a/pkg/dev_compiler/lib/src/compiler/module_builder.dart
+++ b/pkg/dev_compiler/lib/src/compiler/module_builder.dart
@@ -196,7 +196,7 @@ class LegacyModuleBuilder extends _ModuleBuilder {
var functionName =
'load__' + pathToJSIdentifier(module.name.replaceAll('.', '_'));
resultModule =
- new NamedFunction(new Identifier(functionName), resultModule);
+ new NamedFunction(new Identifier(functionName), resultModule, true);
var moduleDef = js.statement("dart_library.library(#, #, #, #)", [
js.string(module.name, "'"),
@@ -302,6 +302,8 @@ class AmdModuleBuilder extends _ModuleBuilder {
new Return(new ObjectInitializer(exportedProps, multiline: true)));
}
+ // TODO(vsm): Consider using an immediately invoked named function pattern
+ // (see legacy code above).
var block = singleOutFile
? js.statement("define(#, #, function(#) { 'use strict'; #; });", [
js.string(module.name, "'"),
« no previous file with comments | « pkg/dev_compiler/lib/js/legacy/dart_sdk.js ('k') | pkg/dev_compiler/lib/src/js_ast/nodes.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698