| 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 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 // Inline function typed parameter, like `void m(int f(String s))`. | 141 // Inline function typed parameter, like `void m(int f(String s))`. |
| 142 computeInlineFunctionType(link.head); | 142 computeInlineFunctionType(link.head); |
| 143 } else if (link.head.asSend() != null && | 143 } else if (link.head.asSend() != null && |
| 144 link.head.asSend().selector.asFunctionExpression() != null) { | 144 link.head.asSend().selector.asFunctionExpression() != null) { |
| 145 // Inline function typed initializing formal or | 145 // Inline function typed initializing formal or |
| 146 // parameter with default value, like `C(int this.f(String s))` or | 146 // parameter with default value, like `C(int this.f(String s))` or |
| 147 // `void m([int f(String s) = null])`. | 147 // `void m([int f(String s) = null])`. |
| 148 computeInlineFunctionType( | 148 computeInlineFunctionType( |
| 149 link.head.asSend().selector.asFunctionExpression()); | 149 link.head.asSend().selector.asFunctionExpression()); |
| 150 } else { | 150 } else { |
| 151 assert(invariant(currentDefinitions, | 151 assert(link.head.asIdentifier() != null || link.head.asSend() != null, |
| 152 link.head.asIdentifier() != null || link.head.asSend() != null)); | 152 failedAt(currentDefinitions)); |
| 153 if (fieldElement != null) { | 153 if (fieldElement != null) { |
| 154 element.typeCache = fieldElement.computeType(resolution); | 154 element.typeCache = fieldElement.computeType(resolution); |
| 155 } else { | 155 } else { |
| 156 element.typeCache = const ResolutionDynamicType(); | 156 element.typeCache = const ResolutionDynamicType(); |
| 157 } | 157 } |
| 158 } | 158 } |
| 159 } | 159 } |
| 160 } | 160 } |
| 161 | 161 |
| 162 FormalElementX visitIdentifier(Identifier node) { | 162 FormalElementX visitIdentifier(Identifier node) { |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 358 createRealParameters: createRealParameters); | 358 createRealParameters: createRealParameters); |
| 359 List<Element> parameters = const <Element>[]; | 359 List<Element> parameters = const <Element>[]; |
| 360 int requiredParameterCount = 0; | 360 int requiredParameterCount = 0; |
| 361 if (formalParameters == null) { | 361 if (formalParameters == null) { |
| 362 if (!element.isGetter) { | 362 if (!element.isGetter) { |
| 363 if (element.isMalformed) { | 363 if (element.isMalformed) { |
| 364 // If the element is erroneous, an error should already have been | 364 // If the element is erroneous, an error should already have been |
| 365 // reported. In the case of parse errors, it is possible that there | 365 // reported. In the case of parse errors, it is possible that there |
| 366 // are formal parameters, but something else in the method failed to | 366 // are formal parameters, but something else in the method failed to |
| 367 // parse. So we suppress the message about missing formals. | 367 // parse. So we suppress the message about missing formals. |
| 368 assert(invariant(element, reporter.hasReportedError)); | 368 assert(reporter.hasReportedError, failedAt(element)); |
| 369 } else { | 369 } else { |
| 370 reporter.reportErrorMessage(element, MessageKind.MISSING_FORMALS); | 370 reporter.reportErrorMessage(element, MessageKind.MISSING_FORMALS); |
| 371 } | 371 } |
| 372 } | 372 } |
| 373 } else { | 373 } else { |
| 374 if (element.isGetter) { | 374 if (element.isGetter) { |
| 375 if (!identical( | 375 if (!identical( |
| 376 formalParameters.endToken.next.stringValue, | 376 formalParameters.endToken.next.stringValue, |
| 377 // TODO(ahe): Remove the check for native keyword. | 377 // TODO(ahe): Remove the check for native keyword. |
| 378 'native')) { | 378 'native')) { |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 505 /// variables of the function signature itself when its signature is analyzed. | 505 /// variables of the function signature itself when its signature is analyzed. |
| 506 class FunctionSignatureBuildingScope extends TypeVariablesScope { | 506 class FunctionSignatureBuildingScope extends TypeVariablesScope { |
| 507 @override | 507 @override |
| 508 final List<ResolutionDartType> typeVariables; | 508 final List<ResolutionDartType> typeVariables; |
| 509 | 509 |
| 510 FunctionSignatureBuildingScope(Scope parent, this.typeVariables) | 510 FunctionSignatureBuildingScope(Scope parent, this.typeVariables) |
| 511 : super(parent); | 511 : super(parent); |
| 512 | 512 |
| 513 String toString() => 'FunctionSignatureBuildingScope($typeVariables)'; | 513 String toString() => 'FunctionSignatureBuildingScope($typeVariables)'; |
| 514 } | 514 } |
| OLD | NEW |