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

Side by Side Diff: pkg/compiler/lib/src/inferrer/type_graph_nodes.dart

Issue 2718513002: Void is not required to be `null` anymore. (Closed)
Patch Set: Update Kernel code. Created 3 years, 7 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
« no previous file with comments | « CHANGELOG.md ('k') | pkg/compiler/lib/src/inferrer/type_system.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 compiler.src.inferrer.type_graph_nodes; 5 library compiler.src.inferrer.type_graph_nodes;
6 6
7 import 'dart:collection' show IterableBase; 7 import 'dart:collection' show IterableBase;
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 1735 matching lines...) Expand 10 before | Expand all | Expand 10 after
1746 T visitClosureTypeInformation(ClosureTypeInformation info); 1746 T visitClosureTypeInformation(ClosureTypeInformation info);
1747 T visitAwaitTypeInformation(AwaitTypeInformation info); 1747 T visitAwaitTypeInformation(AwaitTypeInformation info);
1748 T visitYieldTypeInformation(YieldTypeInformation info); 1748 T visitYieldTypeInformation(YieldTypeInformation info);
1749 } 1749 }
1750 1750
1751 TypeMask _narrowType( 1751 TypeMask _narrowType(
1752 ClosedWorld closedWorld, TypeMask type, ResolutionDartType annotation, 1752 ClosedWorld closedWorld, TypeMask type, ResolutionDartType annotation,
1753 {bool isNullable: true}) { 1753 {bool isNullable: true}) {
1754 if (annotation.treatAsDynamic) return type; 1754 if (annotation.treatAsDynamic) return type;
1755 if (annotation.isObject) return type; 1755 if (annotation.isObject) return type;
1756 if (annotation.isVoid) return type;
1756 TypeMask otherType; 1757 TypeMask otherType;
1757 if (annotation.isTypedef || annotation.isFunctionType) { 1758 if (annotation.isTypedef || annotation.isFunctionType) {
1758 otherType = closedWorld.commonMasks.functionType; 1759 otherType = closedWorld.commonMasks.functionType;
1759 } else if (annotation.isTypeVariable) { 1760 } else if (annotation.isTypeVariable) {
1760 // TODO(ngeoffray): Narrow to bound. 1761 // TODO(ngeoffray): Narrow to bound.
1761 return type; 1762 return type;
1762 } else if (annotation.isVoid) {
1763 otherType = closedWorld.commonMasks.nullType;
1764 } else { 1763 } else {
1765 ResolutionInterfaceType interfaceType = annotation; 1764 ResolutionInterfaceType interfaceType = annotation;
1766 otherType = new TypeMask.nonNullSubtype(interfaceType.element, closedWorld); 1765 otherType = new TypeMask.nonNullSubtype(interfaceType.element, closedWorld);
1767 } 1766 }
1768 if (isNullable) otherType = otherType.nullable(); 1767 if (isNullable) otherType = otherType.nullable();
1769 if (type == null) return otherType; 1768 if (type == null) return otherType;
1770 return type.intersection(otherType, closedWorld); 1769 return type.intersection(otherType, closedWorld);
1771 } 1770 }
OLDNEW
« no previous file with comments | « CHANGELOG.md ('k') | pkg/compiler/lib/src/inferrer/type_system.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698