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 3546 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3557 return globalMetadataMap.putIfAbsent(string, () { | 3557 return globalMetadataMap.putIfAbsent(string, () { |
3558 globalMetadata.add(string); | 3558 globalMetadata.add(string); |
3559 return globalMetadata.length - 1; | 3559 return globalMetadata.length - 1; |
3560 }); | 3560 }); |
3561 } | 3561 } |
3562 | 3562 |
3563 jsAst.Fun extendWithMetadata(FunctionElement element, jsAst.Fun code) { | 3563 jsAst.Fun extendWithMetadata(FunctionElement element, jsAst.Fun code) { |
3564 if (!backend.retainMetadataOf(element)) return code; | 3564 if (!backend.retainMetadataOf(element)) return code; |
3565 return compiler.withCurrentElement(element, () { | 3565 return compiler.withCurrentElement(element, () { |
3566 List<int> metadata = <int>[]; | 3566 List<int> metadata = <int>[]; |
3567 FunctionSignature signature = element.computeSignature(compiler); | 3567 FunctionSignature signature = element.functionSignature; |
3568 if (element.isConstructor()) { | 3568 if (element.isConstructor()) { |
3569 metadata.add(reifyType(element.getEnclosingClass().thisType)); | 3569 metadata.add(reifyType(element.getEnclosingClass().thisType)); |
3570 } else { | 3570 } else { |
3571 metadata.add(reifyType(signature.returnType)); | 3571 metadata.add(reifyType(signature.returnType)); |
3572 } | 3572 } |
3573 signature.forEachParameter((Element parameter) { | 3573 signature.forEachParameter((Element parameter) { |
3574 metadata | 3574 metadata |
3575 ..add(reifyName(parameter.name)) | 3575 ..add(reifyName(parameter.name)) |
3576 ..add(reifyType(parameter.computeType(compiler))); | 3576 ..add(reifyType(parameter.computeType(compiler))); |
3577 }); | 3577 }); |
(...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4070 | 4070 |
4071 const String HOOKS_API_USAGE = """ | 4071 const String HOOKS_API_USAGE = """ |
4072 // The code supports the following hooks: | 4072 // The code supports the following hooks: |
4073 // dartPrint(message) - if this function is defined it is called | 4073 // dartPrint(message) - if this function is defined it is called |
4074 // instead of the Dart [print] method. | 4074 // instead of the Dart [print] method. |
4075 // dartMainRunner(main) - if this function is defined, the Dart [main] | 4075 // dartMainRunner(main) - if this function is defined, the Dart [main] |
4076 // method will not be invoked directly. | 4076 // method will not be invoked directly. |
4077 // Instead, a closure that will invoke [main] is | 4077 // Instead, a closure that will invoke [main] is |
4078 // passed to [dartMainRunner]. | 4078 // passed to [dartMainRunner]. |
4079 """; | 4079 """; |
OLD | NEW |