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

Side by Side Diff: pkg/compiler/lib/src/types/dictionary_type_mask.dart

Issue 2941033002: Finish strong mode cleaning of dart2js. (Closed)
Patch Set: Add bug numbers and address comments. Created 3 years, 6 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) 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 masks; 5 part of masks;
6 6
7 /** 7 /**
8 * A [DictionaryTypeMask] is a [TypeMask] for a specific allocation 8 * A [DictionaryTypeMask] is a [TypeMask] for a specific allocation
9 * site of a map (currently only internal Map class) that is used as 9 * site of a map (currently only internal Map class) that is used as
10 * a dictionary, i.e. a mapping from a set of statically known strings 10 * a dictionary, i.e. a mapping from a set of statically known strings
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 other.typeMap.keys.every( 46 other.typeMap.keys.every(
47 (k) => typeMap.containsKey(k) && typeMap[k] == other.typeMap[k]); 47 (k) => typeMap.containsKey(k) && typeMap[k] == other.typeMap[k]);
48 } 48 }
49 49
50 TypeMask intersection(TypeMask other, ClosedWorld closedWorld) { 50 TypeMask intersection(TypeMask other, ClosedWorld closedWorld) {
51 TypeMask forwardIntersection = forwardTo.intersection(other, closedWorld); 51 TypeMask forwardIntersection = forwardTo.intersection(other, closedWorld);
52 if (forwardIntersection.isEmptyOrNull) return forwardIntersection; 52 if (forwardIntersection.isEmptyOrNull) return forwardIntersection;
53 return forwardIntersection.isNullable ? nullable() : nonNullable(); 53 return forwardIntersection.isNullable ? nullable() : nonNullable();
54 } 54 }
55 55
56 TypeMask union(other, ClosedWorld closedWorld) { 56 TypeMask union(dynamic other, ClosedWorld closedWorld) {
57 if (this == other) { 57 if (this == other) {
58 return this; 58 return this;
59 } else if (equalsDisregardNull(other)) { 59 } else if (equalsDisregardNull(other)) {
60 return other.isNullable ? other : this; 60 return other.isNullable ? other : this;
61 } else if (other.isEmptyOrNull) { 61 } else if (other.isEmptyOrNull) {
62 return other.isNullable ? this.nullable() : this; 62 return other.isNullable ? this.nullable() : this;
63 } else if (other.isDictionary) { 63 } else if (other.isDictionary) {
64 TypeMask newForwardTo = forwardTo.union(other.forwardTo, closedWorld); 64 TypeMask newForwardTo = forwardTo.union(other.forwardTo, closedWorld);
65 TypeMask newKeyType = keyType.union(other.keyType, closedWorld); 65 TypeMask newKeyType = keyType.union(other.keyType, closedWorld);
66 TypeMask newValueType = valueType.union(other.valueType, closedWorld); 66 TypeMask newValueType = valueType.union(other.valueType, closedWorld);
(...skipping 28 matching lines...) Expand all
95 bool operator ==(other) => super == other; 95 bool operator ==(other) => super == other;
96 96
97 int get hashCode { 97 int get hashCode {
98 return computeHashCode(allocationNode, isNullable, typeMap, forwardTo); 98 return computeHashCode(allocationNode, isNullable, typeMap, forwardTo);
99 } 99 }
100 100
101 String toString() { 101 String toString() {
102 return 'Dictionary mask: [$keyType/$valueType with $typeMap] type: $forwardT o'; 102 return 'Dictionary mask: [$keyType/$valueType with $typeMap] type: $forwardT o';
103 } 103 }
104 } 104 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/types/container_type_mask.dart ('k') | pkg/compiler/lib/src/types/map_type_mask.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698