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 1424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1435 String mainAccess = "${namer.isolateAccess(appMain)}"; | 1435 String mainAccess = "${namer.isolateAccess(appMain)}"; |
1436 String currentIsolate = "${namer.CURRENT_ISOLATE}"; | 1436 String currentIsolate = "${namer.CURRENT_ISOLATE}"; |
1437 String mainEnsureGetter = ''; | 1437 String mainEnsureGetter = ''; |
1438 // Since we pass the closurized version of the main method to | 1438 // Since we pass the closurized version of the main method to |
1439 // the isolate method, we must make sure that it exists. | 1439 // the isolate method, we must make sure that it exists. |
1440 if (!compiler.codegenWorld.staticFunctionsNeedingGetter.contains(appMain)) { | 1440 if (!compiler.codegenWorld.staticFunctionsNeedingGetter.contains(appMain)) { |
1441 Selector selector = new Selector.callClosure(0); | 1441 Selector selector = new Selector.callClosure(0); |
1442 String invocationName = "${namer.closureInvocationName(selector)}"; | 1442 String invocationName = "${namer.closureInvocationName(selector)}"; |
1443 mainEnsureGetter = "$mainAccess.$invocationName = $mainAccess"; | 1443 mainEnsureGetter = "$mainAccess.$invocationName = $mainAccess"; |
1444 } | 1444 } |
1445 | |
1446 // TODO(ngeoffray): These globals are currently required by the isolate | 1445 // TODO(ngeoffray): These globals are currently required by the isolate |
1447 // library. They should be removed. | 1446 // library. They should be removed. |
1448 buffer.add(""" | 1447 buffer.add(""" |
1449 var \$globalThis = $currentIsolate; | 1448 var \$globalThis = $currentIsolate; |
1450 var \$globalState; | 1449 var \$globalState; |
1451 var \$globals; | 1450 var \$globals; |
1452 var \$isWorker = false; | 1451 var \$isWorker = false; |
1453 var \$supportsWorkers = false; | 1452 var \$supportsWorkers = false; |
1454 var \$thisScriptUrl; | 1453 var \$thisScriptUrl; |
1455 function \$static_init(){}; | 1454 function \$static_init(){}; |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1581 const String HOOKS_API_USAGE = """ | 1580 const String HOOKS_API_USAGE = """ |
1582 // Generated by dart2js, the Dart to JavaScript compiler. | 1581 // Generated by dart2js, the Dart to JavaScript compiler. |
1583 // The code supports the following hooks: | 1582 // The code supports the following hooks: |
1584 // dartPrint(message) - if this function is defined it is called | 1583 // dartPrint(message) - if this function is defined it is called |
1585 // instead of the Dart [print] method. | 1584 // instead of the Dart [print] method. |
1586 // dartMainRunner(main) - if this function is defined, the Dart [main] | 1585 // dartMainRunner(main) - if this function is defined, the Dart [main] |
1587 // method will not be invoked directly. | 1586 // method will not be invoked directly. |
1588 // Instead, a closure that will invoke [main] is | 1587 // Instead, a closure that will invoke [main] is |
1589 // passed to [dartMainRunner]. | 1588 // passed to [dartMainRunner]. |
1590 """; | 1589 """; |
OLD | NEW |