| 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 1600 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1611 // implementation. We could do better by only looking at | 1611 // implementation. We could do better by only looking at |
| 1612 // instantiated (or otherwise needed) classes. | 1612 // instantiated (or otherwise needed) classes. |
| 1613 result = compiler.world.findNoSuchMethodHolders(type); | 1613 result = compiler.world.findNoSuchMethodHolders(type); |
| 1614 noSuchMethodHolders[element] = result; | 1614 noSuchMethodHolders[element] = result; |
| 1615 } | 1615 } |
| 1616 return result; | 1616 return result; |
| 1617 } | 1617 } |
| 1618 | 1618 |
| 1619 js.Expression generateMethod(String jsName, Selector selector) { | 1619 js.Expression generateMethod(String jsName, Selector selector) { |
| 1620 // Values match JSInvocationMirror in js-helper library. | 1620 // Values match JSInvocationMirror in js-helper library. |
| 1621 const int METHOD = 0; | 1621 int type = selector.invocationMirrorKind; |
| 1622 const int GETTER = 1; | |
| 1623 const int SETTER = 2; | |
| 1624 int type = METHOD; | |
| 1625 if (selector.isGetter()) { | |
| 1626 type = GETTER; | |
| 1627 } else if (selector.isSetter()) { | |
| 1628 type = SETTER; | |
| 1629 } | |
| 1630 String methodName = selector.invocationMirrorMemberName; | 1622 String methodName = selector.invocationMirrorMemberName; |
| 1631 List<js.Parameter> parameters = <js.Parameter>[]; | 1623 List<js.Parameter> parameters = <js.Parameter>[]; |
| 1632 CodeBuffer args = new CodeBuffer(); | 1624 CodeBuffer args = new CodeBuffer(); |
| 1633 for (int i = 0; i < selector.argumentCount; i++) { | 1625 for (int i = 0; i < selector.argumentCount; i++) { |
| 1634 parameters.add(new js.Parameter('\$$i')); | 1626 parameters.add(new js.Parameter('\$$i')); |
| 1635 } | 1627 } |
| 1636 | 1628 |
| 1637 List<js.Expression> argNames = | 1629 List<js.Expression> argNames = |
| 1638 selector.getOrderedNamedArguments().map((SourceString name) => | 1630 selector.getOrderedNamedArguments().map((SourceString name) => |
| 1639 new js.LiteralString('"${name.slowToString()}"')); | 1631 new js.LiteralString('"${name.slowToString()}"')); |
| (...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1968 const String HOOKS_API_USAGE = """ | 1960 const String HOOKS_API_USAGE = """ |
| 1969 // Generated by dart2js, the Dart to JavaScript compiler. | 1961 // Generated by dart2js, the Dart to JavaScript compiler. |
| 1970 // The code supports the following hooks: | 1962 // The code supports the following hooks: |
| 1971 // dartPrint(message) - if this function is defined it is called | 1963 // dartPrint(message) - if this function is defined it is called |
| 1972 // instead of the Dart [print] method. | 1964 // instead of the Dart [print] method. |
| 1973 // dartMainRunner(main) - if this function is defined, the Dart [main] | 1965 // dartMainRunner(main) - if this function is defined, the Dart [main] |
| 1974 // method will not be invoked directly. | 1966 // method will not be invoked directly. |
| 1975 // Instead, a closure that will invoke [main] is | 1967 // Instead, a closure that will invoke [main] is |
| 1976 // passed to [dartMainRunner]. | 1968 // passed to [dartMainRunner]. |
| 1977 """; | 1969 """; |
| OLD | NEW |