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

Side by Side Diff: frog/gen.dart

Issue 9877008: Move the DOMContentLoaded logic into the generated JavaScript (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 8 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 /** 5 /**
6 * Top level generator object for writing code and keeping track of 6 * Top level generator object for writing code and keeping track of
7 * dependencies. 7 * dependencies.
8 * 8 *
9 * Should have two compilation models, but only one implemented so far. 9 * Should have two compilation models, but only one implemented so far.
10 * 10 *
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 writeTypes(main.declaringType.library); 115 writeTypes(main.declaringType.library);
116 116
117 // Write out any inherited concrete members. 117 // Write out any inherited concrete members.
118 // TODO(jmesserly): this won't need to come last once we are sorting types 118 // TODO(jmesserly): this won't need to come last once we are sorting types
119 // correctly. 119 // correctly.
120 if (_mixins != null) writer.write(_mixins.text); 120 if (_mixins != null) writer.write(_mixins.text);
121 121
122 writeDynamicDispatchMetadata(); 122 writeDynamicDispatchMetadata();
123 123
124 writeGlobals(); 124 writeGlobals();
125 writer.writeln('${mainCall.code};'); 125 writer.writeln("if (typeof window != 'undefined' && window.addEventListener) {");
vsm 2012/03/28 17:17:57 line length > 80?
126 writer.writeln(" window.addEventListener('DOMContentLoaded', function(e) {" );
127 writer.writeln(" ${mainCall.code};");
128 writer.writeln(" });");
129 writer.writeln("} else {");
130 writer.writeln(" ${mainCall.code};");
131 writer.writeln("}");
126 } 132 }
127 133
128 void markLibrariesUsed(List<Library> libs) => 134 void markLibrariesUsed(List<Library> libs) =>
129 getAllTypes(libs).forEach(markTypeUsed); 135 getAllTypes(libs).forEach(markTypeUsed);
130 136
131 void markTypeUsed(Type type) { 137 void markTypeUsed(Type type) {
132 if (!type.isClass) return; 138 if (!type.isClass) return;
133 139
134 type.markUsed(); 140 type.markUsed();
135 type.isTested = true; 141 type.isTested = true;
(...skipping 2385 matching lines...) Expand 10 before | Expand all | Expand 10 after
2521 return true; 2527 return true;
2522 } 2528 }
2523 2529
2524 } 2530 }
2525 2531
2526 class ReturnKind { 2532 class ReturnKind {
2527 static final int IGNORE = 1; 2533 static final int IGNORE = 1;
2528 static final int POST = 2; 2534 static final int POST = 2;
2529 static final int PRE = 3; 2535 static final int PRE = 3;
2530 } 2536 }
OLDNEW
« client/tools/htmlconverter.py ('K') | « client/tools/htmlconverter.py ('k') | frog/minfrog » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698