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

Side by Side Diff: pkg/compiler/lib/src/js_emitter/new_emitter/model_emitter.dart

Issue 1186503003: Wrap program into (function(){ <prog> })() instead of !function...(). (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 6 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library dart2js.new_js_emitter.model_emitter; 5 library dart2js.new_js_emitter.model_emitter;
6 6
7 import '../../constants/values.dart' show ConstantValue, FunctionConstantValue; 7 import '../../constants/values.dart' show ConstantValue, FunctionConstantValue;
8 import '../../dart2jslib.dart' show Compiler; 8 import '../../dart2jslib.dart' show Compiler;
9 import '../../elements/elements.dart' show ClassElement, FunctionElement; 9 import '../../elements/elements.dart' show ClassElement, FunctionElement;
10 import '../../js/js.dart' as js; 10 import '../../js/js.dart' as js;
(...skipping 886 matching lines...) Expand 10 before | Expand all | Expand 10 after
897 return output; 897 return output;
898 } 898 }
899 899
900 static final String setupProgramName = "setupProgram"; 900 static final String setupProgramName = "setupProgram";
901 901
902 static final String boilerplate = """ 902 static final String boilerplate = """
903 { 903 {
904 // Declare deferred-initializer global. 904 // Declare deferred-initializer global.
905 #deferredInitializer; 905 #deferredInitializer;
906 906
907 !function(start, program) { 907 (function(start, program) {
908 // Initialize holder objects. 908 // Initialize holder objects.
909 #holders; 909 #holders;
910 var nativeInfos = Object.create(null); 910 var nativeInfos = Object.create(null);
911 911
912 // Counter to generate unique names for tear offs. 912 // Counter to generate unique names for tear offs.
913 var functionCounter = 0; 913 var functionCounter = 0;
914 914
915 function $setupProgramName(program, typesOffset) { 915 function $setupProgramName(program, typesOffset) {
916 for (var i = 0; i < program.length - 2; i++) { 916 for (var i = 0; i < program.length - 2; i++) {
917 setupLibrary(program[i], typesOffset); 917 setupLibrary(program[i], typesOffset);
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
1231 #nativeIsolateAffinityTagInitialization; 1231 #nativeIsolateAffinityTagInitialization;
1232 1232
1233 // Initialize eager classes. 1233 // Initialize eager classes.
1234 #eagerClasses; 1234 #eagerClasses;
1235 1235
1236 var end = Date.now(); 1236 var end = Date.now();
1237 // print('Setup: ' + (end - start) + ' ms.'); 1237 // print('Setup: ' + (end - start) + ' ms.');
1238 1238
1239 #invokeMain; // Start main. 1239 #invokeMain; // Start main.
1240 1240
1241 }(Date.now(), #code) 1241 })(Date.now(), #code)
1242 }"""; 1242 }""";
1243 1243
1244 } 1244 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698