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 '../common.dart'; | 7 import '../common.dart'; |
8 import '../common/resolution.dart'; | 8 import '../common/resolution.dart'; |
9 import '../elements/resolution_types.dart'; | 9 import '../elements/resolution_types.dart'; |
10 import '../elements/elements.dart'; | 10 import '../elements/elements.dart'; |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 registry, | 127 registry, |
128 defaultValuesError: MessageKind.FUNCTION_TYPE_FORMAL_WITH_DEFAULT); | 128 defaultValuesError: MessageKind.FUNCTION_TYPE_FORMAL_WITH_DEFAULT); |
129 element.functionSignature = functionSignature; | 129 element.functionSignature = functionSignature; |
130 } | 130 } |
131 | 131 |
132 if (currentDefinitions.type != null) { | 132 if (currentDefinitions.type != null) { |
133 element.typeCache = resolveTypeAnnotation(currentDefinitions.type); | 133 element.typeCache = resolveTypeAnnotation(currentDefinitions.type); |
134 } else { | 134 } else { |
135 // Is node.definitions exactly one FunctionExpression? | 135 // Is node.definitions exactly one FunctionExpression? |
136 Link<Node> link = currentDefinitions.definitions.nodes; | 136 Link<Node> link = currentDefinitions.definitions.nodes; |
137 assert(invariant(currentDefinitions, !link.isEmpty)); | 137 assert(!link.isEmpty, failedAt(currentDefinitions)); |
138 assert(invariant(currentDefinitions, link.tail.isEmpty)); | 138 assert(link.tail.isEmpty, failedAt(currentDefinitions)); |
139 if (link.head.asFunctionExpression() != null) { | 139 if (link.head.asFunctionExpression() != null) { |
140 // Inline function typed parameter, like `void m(int f(String s))`. | 140 // Inline function typed parameter, like `void m(int f(String s))`. |
141 computeInlineFunctionType(link.head); | 141 computeInlineFunctionType(link.head); |
142 } else if (link.head.asSend() != null && | 142 } else if (link.head.asSend() != null && |
143 link.head.asSend().selector.asFunctionExpression() != null) { | 143 link.head.asSend().selector.asFunctionExpression() != null) { |
144 // Inline function typed initializing formal or | 144 // Inline function typed initializing formal or |
145 // parameter with default value, like `C(int this.f(String s))` or | 145 // parameter with default value, like `C(int this.f(String s))` or |
146 // `void m([int f(String s) = null])`. | 146 // `void m([int f(String s) = null])`. |
147 computeInlineFunctionType( | 147 computeInlineFunctionType( |
148 link.head.asSend().selector.asFunctionExpression()); | 148 link.head.asSend().selector.asFunctionExpression()); |
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
504 /// variables of the function signature itself when its signature is analyzed. | 504 /// variables of the function signature itself when its signature is analyzed. |
505 class FunctionSignatureBuildingScope extends TypeVariablesScope { | 505 class FunctionSignatureBuildingScope extends TypeVariablesScope { |
506 @override | 506 @override |
507 final List<ResolutionDartType> typeVariables; | 507 final List<ResolutionDartType> typeVariables; |
508 | 508 |
509 FunctionSignatureBuildingScope(Scope parent, this.typeVariables) | 509 FunctionSignatureBuildingScope(Scope parent, this.typeVariables) |
510 : super(parent); | 510 : super(parent); |
511 | 511 |
512 String toString() => 'FunctionSignatureBuildingScope($typeVariables)'; | 512 String toString() => 'FunctionSignatureBuildingScope($typeVariables)'; |
513 } | 513 } |
OLD | NEW |