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

Unified Diff: pkg/compiler/lib/src/js_emitter/startup_emitter/model_emitter.dart

Issue 1653453002: Don't use "var" to introduce the deferred_initializer. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Add test. Created 4 years, 11 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 | « no previous file | pkg/compiler/lib/src/native/native.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/js_emitter/startup_emitter/model_emitter.dart
diff --git a/pkg/compiler/lib/src/js_emitter/startup_emitter/model_emitter.dart b/pkg/compiler/lib/src/js_emitter/startup_emitter/model_emitter.dart
index 65d0519b357cf876b49338421e5249dfa45441a7..11826c37fa72fe91ce3ee5ab900866df65b16d59 100644
--- a/pkg/compiler/lib/src/js_emitter/startup_emitter/model_emitter.dart
+++ b/pkg/compiler/lib/src/js_emitter/startup_emitter/model_emitter.dart
@@ -252,10 +252,9 @@ class ModelEmitter {
}
js.Statement buildDeferredInitializerGlobal() {
- String global = deferredInitializersGlobal;
- return js.js.statement(
- "if (typeof($global) === 'undefined') var # = Object.create(null);",
- new js.VariableDeclaration(global, allowRename: false));
+ return js.js.statement('self.#deferredInitializers = '
+ 'self.#deferredInitializers || Object.create(null);',
+ {'deferredInitializers': deferredInitializersGlobal});
}
// Writes the given [fragment]'s [code] into a file.
« no previous file with comments | « no previous file | pkg/compiler/lib/src/native/native.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698