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 library dart2js.resolution; | 5 library dart2js.resolution; |
6 | 6 |
7 import 'dart:collection' show Queue; | 7 import 'dart:collection' show Queue; |
8 | 8 |
9 import '../common.dart'; | 9 import '../common.dart'; |
10 import '../common/names.dart' show Identifiers; | 10 import '../common/names.dart' show Identifiers; |
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
423 // Perform various checks as side effect of "computing" the type. | 423 // Perform various checks as side effect of "computing" the type. |
424 element.computeType(resolution); | 424 element.computeType(resolution); |
425 | 425 |
426 resolution.target.resolveNativeElement(element, registry.impactBuilder); | 426 resolution.target.resolveNativeElement(element, registry.impactBuilder); |
427 | 427 |
428 return registry.impactBuilder; | 428 return registry.impactBuilder; |
429 }); | 429 }); |
430 } | 430 } |
431 | 431 |
432 DartType resolveTypeAnnotation(Element element, TypeAnnotation annotation) { | 432 DartType resolveTypeAnnotation(Element element, TypeAnnotation annotation) { |
433 DartType type = resolveReturnType(element, annotation); | 433 DartType type = _resolveReturnType(element, annotation); |
434 if (type.isVoid) { | 434 if (type.isVoid) { |
435 reporter.reportErrorMessage(annotation, MessageKind.VOID_NOT_ALLOWED); | 435 reporter.reportErrorMessage(annotation, MessageKind.VOID_NOT_ALLOWED); |
436 } | 436 } |
437 return type; | 437 return type; |
438 } | 438 } |
439 | 439 |
440 DartType resolveReturnType(Element element, TypeAnnotation annotation) { | 440 DartType _resolveReturnType(Element element, TypeAnnotation annotation) { |
441 if (annotation == null) return const DynamicType(); | 441 if (annotation == null) return const DynamicType(); |
442 DartType result = visitorFor(element).resolveTypeAnnotation(annotation); | 442 DartType result = visitorFor(element).resolveTypeAnnotation(annotation); |
| 443 assert(invariant(annotation, result != null, |
| 444 message: "No type computed for $annotation.")); |
443 if (result == null) { | 445 if (result == null) { |
444 // TODO(karklose): warning. | 446 // TODO(karklose): warning. |
445 return const DynamicType(); | 447 return const DynamicType(); |
446 } | 448 } |
447 return result; | 449 return result; |
448 } | 450 } |
449 | 451 |
450 void resolveRedirectionChain(ConstructorElement constructor, Spannable node) { | 452 void resolveRedirectionChain(ConstructorElement constructor, Spannable node) { |
451 ConstructorElement target = constructor; | 453 ConstructorElement target = constructor; |
452 DartType targetType; | 454 DartType targetType; |
(...skipping 669 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1122 TreeElements get treeElements { | 1124 TreeElements get treeElements { |
1123 assert(invariant(this, _treeElements != null, | 1125 assert(invariant(this, _treeElements != null, |
1124 message: "TreeElements have not been computed for $this.")); | 1126 message: "TreeElements have not been computed for $this.")); |
1125 return _treeElements; | 1127 return _treeElements; |
1126 } | 1128 } |
1127 | 1129 |
1128 void reuseElement() { | 1130 void reuseElement() { |
1129 _treeElements = null; | 1131 _treeElements = null; |
1130 } | 1132 } |
1131 } | 1133 } |
OLD | NEW |