Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(391)

Side by Side Diff: pkg/compiler/lib/src/resolution/resolution.dart

Issue 2699073003: Support `void` as generic argument.
Patch Set: Add specialized messages for `void` for-ins. Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 424 matching lines...) Expand 10 before | Expand all | Expand 10 after
435 element.computeType(resolution); 435 element.computeType(resolution);
436 436
437 resolution.target.resolveNativeElement(element, registry.impactBuilder); 437 resolution.target.resolveNativeElement(element, registry.impactBuilder);
438 438
439 return registry.impactBuilder; 439 return registry.impactBuilder;
440 }); 440 });
441 } 441 }
442 442
443 ResolutionDartType resolveTypeAnnotation( 443 ResolutionDartType resolveTypeAnnotation(
444 Element element, TypeAnnotation annotation) { 444 Element element, TypeAnnotation annotation) {
445 ResolutionDartType type = _resolveReturnType(element, annotation);
446 if (type.isVoid) {
447 reporter.reportErrorMessage(annotation, MessageKind.VOID_NOT_ALLOWED);
448 }
449 return type;
450 }
451
452 ResolutionDartType _resolveReturnType(
453 Element element, TypeAnnotation annotation) {
454 if (annotation == null) return const ResolutionDynamicType(); 445 if (annotation == null) return const ResolutionDynamicType();
455 ResolutionDartType result = 446 ResolutionDartType result =
456 visitorFor(element).resolveTypeAnnotation(annotation); 447 visitorFor(element).resolveTypeAnnotation(annotation);
457 assert(invariant(annotation, result != null, 448 assert(invariant(annotation, result != null,
458 message: "No type computed for $annotation.")); 449 message: "No type computed for $annotation."));
459 if (result == null) { 450 if (result == null) {
460 // TODO(karklose): warning. 451 // TODO(karklose): warning.
461 return const ResolutionDynamicType(); 452 return const ResolutionDynamicType();
462 } 453 }
463 return result; 454 return result;
(...skipping 675 matching lines...) Expand 10 before | Expand all | Expand 10 after
1139 TreeElements get treeElements { 1130 TreeElements get treeElements {
1140 assert(invariant(this, _treeElements != null, 1131 assert(invariant(this, _treeElements != null,
1141 message: "TreeElements have not been computed for $this.")); 1132 message: "TreeElements have not been computed for $this."));
1142 return _treeElements; 1133 return _treeElements;
1143 } 1134 }
1144 1135
1145 void reuseElement() { 1136 void reuseElement() {
1146 _treeElements = null; 1137 _treeElements = null;
1147 } 1138 }
1148 } 1139 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698