| 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 part of resolution; | 5 part of resolution; |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * [SignatureResolver] resolves function signatures. | 8 * [SignatureResolver] resolves function signatures. |
| 9 */ | 9 */ |
| 10 class SignatureResolver extends MappingVisitor<FormalElementX> { | 10 class SignatureResolver extends MappingVisitor<FormalElementX> { |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 | 171 |
| 172 InitializingFormalElementX createFieldParameter(Send node, | 172 InitializingFormalElementX createFieldParameter(Send node, |
| 173 Expression initializer) { | 173 Expression initializer) { |
| 174 InitializingFormalElementX element; | 174 InitializingFormalElementX element; |
| 175 if (node.receiver.asIdentifier() == null || | 175 if (node.receiver.asIdentifier() == null || |
| 176 !node.receiver.asIdentifier().isThis()) { | 176 !node.receiver.asIdentifier().isThis()) { |
| 177 error(node, MessageKind.INVALID_PARAMETER); | 177 error(node, MessageKind.INVALID_PARAMETER); |
| 178 } else if (!identical(enclosingElement.kind, | 178 } else if (!identical(enclosingElement.kind, |
| 179 ElementKind.GENERATIVE_CONSTRUCTOR)) { | 179 ElementKind.GENERATIVE_CONSTRUCTOR)) { |
| 180 error(node, MessageKind.INITIALIZING_FORMAL_NOT_ALLOWED); | 180 error(node, MessageKind.INITIALIZING_FORMAL_NOT_ALLOWED); |
| 181 // TODO(ahe): Don't throw, recover from error. |
| 182 throw new CompilerCancelledException(null); |
| 181 } else { | 183 } else { |
| 182 Identifier name = getParameterName(node); | 184 Identifier name = getParameterName(node); |
| 183 validateName(name); | 185 validateName(name); |
| 184 Element fieldElement = | 186 Element fieldElement = |
| 185 enclosingElement.enclosingClass.lookupLocalMember(name.source); | 187 enclosingElement.enclosingClass.lookupLocalMember(name.source); |
| 186 if (fieldElement == null || | 188 if (fieldElement == null || |
| 187 !identical(fieldElement.kind, ElementKind.FIELD)) { | 189 !identical(fieldElement.kind, ElementKind.FIELD)) { |
| 188 error(node, MessageKind.NOT_A_FIELD, {'fieldName': name}); | 190 error(node, MessageKind.NOT_A_FIELD, {'fieldName': name}); |
| 191 // TODO(ahe): Don't throw, recover from error. |
| 192 throw new CompilerCancelledException(null); |
| 189 } else if (!fieldElement.isInstanceMember) { | 193 } else if (!fieldElement.isInstanceMember) { |
| 190 error(node, MessageKind.NOT_INSTANCE_FIELD, {'fieldName': name}); | 194 error(node, MessageKind.NOT_INSTANCE_FIELD, {'fieldName': name}); |
| 191 } | 195 } |
| 192 element = new InitializingFormalElementX(enclosingElement, | 196 element = new InitializingFormalElementX(enclosingElement, |
| 193 currentDefinitions, name, initializer, fieldElement); | 197 currentDefinitions, name, initializer, fieldElement); |
| 194 computeParameterType(element, fieldElement); | 198 computeParameterType(element, fieldElement); |
| 195 } | 199 } |
| 196 return element; | 200 return element; |
| 197 } | 201 } |
| 198 | 202 |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 370 | 374 |
| 371 DartType resolveReturnType(TypeAnnotation annotation) { | 375 DartType resolveReturnType(TypeAnnotation annotation) { |
| 372 if (annotation == null) return const DynamicType(); | 376 if (annotation == null) return const DynamicType(); |
| 373 DartType result = resolver.resolveTypeAnnotation(annotation); | 377 DartType result = resolver.resolveTypeAnnotation(annotation); |
| 374 if (result == null) { | 378 if (result == null) { |
| 375 return const DynamicType(); | 379 return const DynamicType(); |
| 376 } | 380 } |
| 377 return result; | 381 return result; |
| 378 } | 382 } |
| 379 } | 383 } |
| OLD | NEW |