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 part of js_backend; | 5 part of js_backend; |
6 | 6 |
7 /** | 7 /** |
8 * A function element that represents a closure call. The signature is copied | 8 * A function element that represents a closure call. The signature is copied |
9 * from the given element. | 9 * from the given element. |
10 */ | 10 */ |
(...skipping 1854 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1865 String buildIsolateSetup(CodeBuffer buffer, | 1865 String buildIsolateSetup(CodeBuffer buffer, |
1866 Element appMain, | 1866 Element appMain, |
1867 Element isolateMain) { | 1867 Element isolateMain) { |
1868 String mainAccess = "${namer.isolateAccess(appMain)}"; | 1868 String mainAccess = "${namer.isolateAccess(appMain)}"; |
1869 String currentIsolate = "${namer.CURRENT_ISOLATE}"; | 1869 String currentIsolate = "${namer.CURRENT_ISOLATE}"; |
1870 // Since we pass the closurized version of the main method to | 1870 // Since we pass the closurized version of the main method to |
1871 // the isolate method, we must make sure that it exists. | 1871 // the isolate method, we must make sure that it exists. |
1872 if (!compiler.codegenWorld.staticFunctionsNeedingGetter.contains(appMain)) { | 1872 if (!compiler.codegenWorld.staticFunctionsNeedingGetter.contains(appMain)) { |
1873 Selector selector = new Selector.callClosure(0); | 1873 Selector selector = new Selector.callClosure(0); |
1874 String invocationName = namer.invocationName(selector); | 1874 String invocationName = namer.invocationName(selector); |
1875 buffer.add("$mainAccess.$invocationName = $mainAccess"); | 1875 buffer.add("$mainAccess.$invocationName = $mainAccess$N"); |
1876 } | 1876 } |
1877 return "${namer.isolateAccess(isolateMain)}($mainAccess)"; | 1877 return "${namer.isolateAccess(isolateMain)}($mainAccess)"; |
1878 } | 1878 } |
1879 | 1879 |
1880 emitMain(CodeBuffer buffer) { | 1880 emitMain(CodeBuffer buffer) { |
1881 if (compiler.isMockCompilation) return; | 1881 if (compiler.isMockCompilation) return; |
1882 Element main = compiler.mainApp.find(Compiler.MAIN); | 1882 Element main = compiler.mainApp.find(Compiler.MAIN); |
1883 String mainCall = null; | 1883 String mainCall = null; |
1884 if (compiler.hasIsolateSupport()) { | 1884 if (compiler.hasIsolateSupport()) { |
1885 Element isolateMain = | 1885 Element isolateMain = |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2160 """; | 2160 """; |
2161 const String HOOKS_API_USAGE = """ | 2161 const String HOOKS_API_USAGE = """ |
2162 // The code supports the following hooks: | 2162 // The code supports the following hooks: |
2163 // dartPrint(message) - if this function is defined it is called | 2163 // dartPrint(message) - if this function is defined it is called |
2164 // instead of the Dart [print] method. | 2164 // instead of the Dart [print] method. |
2165 // dartMainRunner(main) - if this function is defined, the Dart [main] | 2165 // dartMainRunner(main) - if this function is defined, the Dart [main] |
2166 // method will not be invoked directly. | 2166 // method will not be invoked directly. |
2167 // Instead, a closure that will invoke [main] is | 2167 // Instead, a closure that will invoke [main] is |
2168 // passed to [dartMainRunner]. | 2168 // passed to [dartMainRunner]. |
2169 """; | 2169 """; |
OLD | NEW |