| 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 1025 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1036 parameters.add(new js.Parameter('receiver')); | 1036 parameters.add(new js.Parameter('receiver')); |
| 1037 | 1037 |
| 1038 String name; | 1038 String name; |
| 1039 if (selector.isGetter()) { | 1039 if (selector.isGetter()) { |
| 1040 name = backend.namer.getterName(selector.library, selector.name); | 1040 name = backend.namer.getterName(selector.library, selector.name); |
| 1041 } else if (selector.isSetter()) { | 1041 } else if (selector.isSetter()) { |
| 1042 name = backend.namer.setterName(selector.library, selector.name); | 1042 name = backend.namer.setterName(selector.library, selector.name); |
| 1043 parameters.add(new js.Parameter('value')); | 1043 parameters.add(new js.Parameter('value')); |
| 1044 arguments.add(new js.VariableUse('value')); | 1044 arguments.add(new js.VariableUse('value')); |
| 1045 } else { | 1045 } else { |
| 1046 assert(selector.isCall() || selector.isOperator()); | |
| 1047 name = backend.namer.instanceMethodInvocationName( | 1046 name = backend.namer.instanceMethodInvocationName( |
| 1048 selector.library, selector.name, selector); | 1047 selector.library, selector.name, selector); |
| 1049 for (int i = 0; i < selector.argumentCount; i++) { | 1048 for (int i = 0; i < selector.argumentCount; i++) { |
| 1050 String argName = 'a$i'; | 1049 String argName = 'a$i'; |
| 1051 parameters.add(new js.Parameter(argName)); | 1050 parameters.add(new js.Parameter(argName)); |
| 1052 arguments.add(new js.VariableUse(argName)); | 1051 arguments.add(new js.VariableUse(argName)); |
| 1053 } | 1052 } |
| 1054 } | 1053 } |
| 1055 js.Fun function = | 1054 js.Fun function = |
| 1056 new js.Fun(parameters, | 1055 new js.Fun(parameters, |
| (...skipping 963 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2020 """; | 2019 """; |
| 2021 const String HOOKS_API_USAGE = """ | 2020 const String HOOKS_API_USAGE = """ |
| 2022 // The code supports the following hooks: | 2021 // The code supports the following hooks: |
| 2023 // dartPrint(message) - if this function is defined it is called | 2022 // dartPrint(message) - if this function is defined it is called |
| 2024 // instead of the Dart [print] method. | 2023 // instead of the Dart [print] method. |
| 2025 // dartMainRunner(main) - if this function is defined, the Dart [main] | 2024 // dartMainRunner(main) - if this function is defined, the Dart [main] |
| 2026 // method will not be invoked directly. | 2025 // method will not be invoked directly. |
| 2027 // Instead, a closure that will invoke [main] is | 2026 // Instead, a closure that will invoke [main] is |
| 2028 // passed to [dartMainRunner]. | 2027 // passed to [dartMainRunner]. |
| 2029 """; | 2028 """; |
| OLD | NEW |