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 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
434 element.computeType(resolution); | 434 element.computeType(resolution); |
435 | 435 |
436 resolution.target.resolveNativeMember(element, registry.impactBuilder); | 436 resolution.target.resolveNativeMember(element, registry.impactBuilder); |
437 | 437 |
438 return registry.impactBuilder; | 438 return registry.impactBuilder; |
439 }); | 439 }); |
440 } | 440 } |
441 | 441 |
442 ResolutionDartType resolveTypeAnnotation( | 442 ResolutionDartType resolveTypeAnnotation( |
443 Element element, TypeAnnotation annotation) { | 443 Element element, TypeAnnotation annotation) { |
444 ResolutionDartType type = _resolveReturnType(element, annotation); | |
445 if (type.isVoid) { | |
446 reporter.reportErrorMessage(annotation, MessageKind.VOID_NOT_ALLOWED); | |
447 } | |
448 return type; | |
449 } | |
450 | |
451 ResolutionDartType _resolveReturnType( | |
452 Element element, TypeAnnotation annotation) { | |
453 if (annotation == null) return const ResolutionDynamicType(); | 444 if (annotation == null) return const ResolutionDynamicType(); |
454 ResolutionDartType result = | 445 ResolutionDartType result = |
455 visitorFor(element).resolveTypeAnnotation(annotation); | 446 visitorFor(element).resolveTypeAnnotation(annotation); |
456 assert(invariant(annotation, result != null, | 447 assert(invariant(annotation, result != null, |
457 message: "No type computed for $annotation.")); | 448 message: "No type computed for $annotation.")); |
458 if (result == null) { | 449 if (result == null) { |
459 // TODO(karklose): warning. | 450 // TODO(karklose): warning. |
460 return const ResolutionDynamicType(); | 451 return const ResolutionDynamicType(); |
461 } | 452 } |
462 return result; | 453 return result; |
(...skipping 680 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1143 TreeElements get treeElements { | 1134 TreeElements get treeElements { |
1144 assert(invariant(this, _treeElements != null, | 1135 assert(invariant(this, _treeElements != null, |
1145 message: "TreeElements have not been computed for $this.")); | 1136 message: "TreeElements have not been computed for $this.")); |
1146 return _treeElements; | 1137 return _treeElements; |
1147 } | 1138 } |
1148 | 1139 |
1149 void reuseElement() { | 1140 void reuseElement() { |
1150 _treeElements = null; | 1141 _treeElements = null; |
1151 } | 1142 } |
1152 } | 1143 } |
OLD | NEW |