| 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 970 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 981 String mainCall = null; | 981 String mainCall = null; |
| 982 if (compiler.isolateLibrary != null) { | 982 if (compiler.isolateLibrary != null) { |
| 983 Element isolateMain = | 983 Element isolateMain = |
| 984 compiler.isolateLibrary.find(Compiler.START_ROOT_ISOLATE); | 984 compiler.isolateLibrary.find(Compiler.START_ROOT_ISOLATE); |
| 985 mainCall = buildIsolateSetup(buffer, main, isolateMain); | 985 mainCall = buildIsolateSetup(buffer, main, isolateMain); |
| 986 } else { | 986 } else { |
| 987 mainCall = '${namer.isolateAccess(main)}()'; | 987 mainCall = '${namer.isolateAccess(main)}()'; |
| 988 } | 988 } |
| 989 buffer.add(""" | 989 buffer.add(""" |
| 990 if (typeof window != 'undefined' && typeof document != 'undefined' && | 990 if (typeof window != 'undefined' && typeof document != 'undefined' && |
| 991 window.addEventListener && document.readyState != 'complete') { | 991 window.addEventListener && document.readyState == 'loading') { |
| 992 window.addEventListener('DOMContentLoaded', function(e) { | 992 window.addEventListener('DOMContentLoaded', function(e) { |
| 993 ${mainCall}; | 993 ${mainCall}; |
| 994 }); | 994 }); |
| 995 } else { | 995 } else { |
| 996 ${mainCall}; | 996 ${mainCall}; |
| 997 } | 997 } |
| 998 """); | 998 """); |
| 999 } | 999 } |
| 1000 | 1000 |
| 1001 String assembleProgram() { | 1001 String assembleProgram() { |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1055 null, sourceMap, new api.Diagnostic(-1, 'source map')); | 1055 null, sourceMap, new api.Diagnostic(-1, 'source map')); |
| 1056 } | 1056 } |
| 1057 }); | 1057 }); |
| 1058 return compiler.assembledCode; | 1058 return compiler.assembledCode; |
| 1059 } | 1059 } |
| 1060 } | 1060 } |
| 1061 | 1061 |
| 1062 typedef void DefineMemberFunction(String invocationName, | 1062 typedef void DefineMemberFunction(String invocationName, |
| 1063 String definition, | 1063 String definition, |
| 1064 [List<SourceMappingEntry> sourceMappings]); | 1064 [List<SourceMappingEntry> sourceMappings]); |
| OLD | NEW |