Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 * A function element that represents a closure call. The signature is copied | 6 * A function element that represents a closure call. The signature is copied |
| 7 * from the given element. | 7 * from the given element. |
| 8 */ | 8 */ |
| 9 class ClosureInvocationElement extends FunctionElement { | 9 class ClosureInvocationElement extends FunctionElement { |
| 10 ClosureInvocationElement(SourceString name, | 10 ClosureInvocationElement(SourceString name, |
| (...skipping 1197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1208 Element main = compiler.mainApp.find(Compiler.MAIN); | 1208 Element main = compiler.mainApp.find(Compiler.MAIN); |
| 1209 String mainCall = null; | 1209 String mainCall = null; |
| 1210 if (compiler.isolateLibrary != null) { | 1210 if (compiler.isolateLibrary != null) { |
| 1211 Element isolateMain = | 1211 Element isolateMain = |
| 1212 compiler.isolateLibrary.find(Compiler.START_ROOT_ISOLATE); | 1212 compiler.isolateLibrary.find(Compiler.START_ROOT_ISOLATE); |
| 1213 mainCall = buildIsolateSetup(buffer, main, isolateMain); | 1213 mainCall = buildIsolateSetup(buffer, main, isolateMain); |
| 1214 } else { | 1214 } else { |
| 1215 mainCall = '${namer.isolateAccess(main)}()'; | 1215 mainCall = '${namer.isolateAccess(main)}()'; |
| 1216 } | 1216 } |
| 1217 buffer.add(""" | 1217 buffer.add(""" |
| 1218 if (typeof document != 'undefined' && document.readyState != 'complete') { | 1218 if (typeof dartMainRunner == 'function') { |
|
kasperl
2012/09/06 10:29:29
Somehow it feels shaky to not wait until the docum
ahe
2012/09/08 13:32:32
Done.
| |
| 1219 dartMainRunner(function() { ${mainCall}; }); | |
| 1220 } else if (typeof document != 'undefined' && document.readyState != 'complete') { | |
| 1219 document.addEventListener('readystatechange', function () { | 1221 document.addEventListener('readystatechange', function () { |
| 1220 if (document.readyState == 'complete') { | 1222 if (document.readyState == 'complete') { |
| 1221 ${mainCall}; | 1223 ${mainCall}; |
| 1222 } | 1224 } |
| 1223 }, false); | 1225 }, false); |
| 1224 } else { | 1226 } else { |
| 1225 ${mainCall}; | 1227 ${mainCall}; |
| 1226 } | 1228 } |
| 1227 """); | 1229 """); |
| 1228 } | 1230 } |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1297 sourceName = token.slowToString(); | 1299 sourceName = token.slowToString(); |
| 1298 } | 1300 } |
| 1299 int totalOffset = bufferOffset + offset; | 1301 int totalOffset = bufferOffset + offset; |
| 1300 sourceMapBuilder.addMapping( | 1302 sourceMapBuilder.addMapping( |
| 1301 sourceFile, token.charOffset, sourceName, totalOffset); | 1303 sourceFile, token.charOffset, sourceName, totalOffset); |
| 1302 }); | 1304 }); |
| 1303 } | 1305 } |
| 1304 } | 1306 } |
| 1305 | 1307 |
| 1306 typedef void DefineMemberFunction(String invocationName, CodeBuffer definition); | 1308 typedef void DefineMemberFunction(String invocationName, CodeBuffer definition); |
| OLD | NEW |