| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 library dart2js.resolution.signatures; | 5 library dart2js.resolution.signatures; |
| 6 | 6 |
| 7 import '../compiler.dart' show | 7 import '../compiler.dart' show |
| 8 Compiler; | 8 Compiler; |
| 9 import '../dart_types.dart'; | 9 import '../dart_types.dart'; |
| 10 import '../diagnostics/diagnostic_listener.dart' show | 10 import '../diagnostics/diagnostic_listener.dart' show |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 } | 119 } |
| 120 } | 120 } |
| 121 | 121 |
| 122 void computeParameterType(FormalElementX element, | 122 void computeParameterType(FormalElementX element, |
| 123 [VariableElement fieldElement]) { | 123 [VariableElement fieldElement]) { |
| 124 void computeFunctionType(FunctionExpression functionExpression) { | 124 void computeFunctionType(FunctionExpression functionExpression) { |
| 125 FunctionSignature functionSignature = SignatureResolver.analyze( | 125 FunctionSignature functionSignature = SignatureResolver.analyze( |
| 126 compiler, functionExpression.parameters, | 126 compiler, functionExpression.parameters, |
| 127 functionExpression.returnType, element, registry, | 127 functionExpression.returnType, element, registry, |
| 128 defaultValuesError: MessageKind.FUNCTION_TYPE_FORMAL_WITH_DEFAULT); | 128 defaultValuesError: MessageKind.FUNCTION_TYPE_FORMAL_WITH_DEFAULT); |
| 129 element.functionSignatureCache = functionSignature; | 129 element.functionSignature = functionSignature; |
| 130 element.typeCache = functionSignature.type; | |
| 131 } | 130 } |
| 132 | 131 |
| 133 if (currentDefinitions.type != null) { | 132 if (currentDefinitions.type != null) { |
| 134 element.typeCache = resolveTypeAnnotation(currentDefinitions.type); | 133 element.typeCache = resolveTypeAnnotation(currentDefinitions.type); |
| 135 } else { | 134 } else { |
| 136 // Is node.definitions exactly one FunctionExpression? | 135 // Is node.definitions exactly one FunctionExpression? |
| 137 Link<Node> link = currentDefinitions.definitions.nodes; | 136 Link<Node> link = currentDefinitions.definitions.nodes; |
| 138 assert(invariant(currentDefinitions, !link.isEmpty)); | 137 assert(invariant(currentDefinitions, !link.isEmpty)); |
| 139 assert(invariant(currentDefinitions, link.tail.isEmpty)); | 138 assert(invariant(currentDefinitions, link.tail.isEmpty)); |
| 140 if (link.head.asFunctionExpression() != null) { | 139 if (link.head.asFunctionExpression() != null) { |
| (...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 443 | 442 |
| 444 DartType resolveReturnType(TypeAnnotation annotation) { | 443 DartType resolveReturnType(TypeAnnotation annotation) { |
| 445 if (annotation == null) return const DynamicType(); | 444 if (annotation == null) return const DynamicType(); |
| 446 DartType result = resolver.resolveTypeAnnotation(annotation); | 445 DartType result = resolver.resolveTypeAnnotation(annotation); |
| 447 if (result == null) { | 446 if (result == null) { |
| 448 return const DynamicType(); | 447 return const DynamicType(); |
| 449 } | 448 } |
| 450 return result; | 449 return result; |
| 451 } | 450 } |
| 452 } | 451 } |
| OLD | NEW |