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

Unified Diff: pkg/compiler/lib/src/types/dictionary_type_mask.dart

Issue 1859343004: dartfmt pkg/compiler (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/compiler/lib/src/types/container_type_mask.dart ('k') | pkg/compiler/lib/src/types/flat_type_mask.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/types/dictionary_type_mask.dart
diff --git a/pkg/compiler/lib/src/types/dictionary_type_mask.dart b/pkg/compiler/lib/src/types/dictionary_type_mask.dart
index cba828f7ad852bc692c1b2c02075cf889bd4a8da..74f9fdd96b27fefc5034194a381c71cd35b589a7 100644
--- a/pkg/compiler/lib/src/types/dictionary_type_mask.dart
+++ b/pkg/compiler/lib/src/types/dictionary_type_mask.dart
@@ -16,30 +16,21 @@ class DictionaryTypeMask extends MapTypeMask {
// The underlying key/value map of this dictionary.
final Map<String, TypeMask> typeMap;
- DictionaryTypeMask(forwardTo,
- allocationNode,
- allocationElement,
- keyType, valueType,
- this.typeMap) :
- super(forwardTo, allocationNode, allocationElement, keyType, valueType);
+ DictionaryTypeMask(forwardTo, allocationNode, allocationElement, keyType,
+ valueType, this.typeMap)
+ : super(forwardTo, allocationNode, allocationElement, keyType, valueType);
TypeMask nullable() {
return isNullable
? this
- : new DictionaryTypeMask(forwardTo.nullable(),
- allocationNode,
- allocationElement,
- keyType, valueType,
- typeMap);
+ : new DictionaryTypeMask(forwardTo.nullable(), allocationNode,
+ allocationElement, keyType, valueType, typeMap);
}
TypeMask nonNullable() {
return isNullable
- ? new DictionaryTypeMask(forwardTo.nonNullable(),
- allocationNode,
- allocationElement,
- keyType, valueType,
- typeMap)
+ ? new DictionaryTypeMask(forwardTo.nonNullable(), allocationNode,
+ allocationElement, keyType, valueType, typeMap)
: this;
}
@@ -49,20 +40,17 @@ class DictionaryTypeMask extends MapTypeMask {
bool equalsDisregardNull(other) {
if (other is! DictionaryTypeMask) return false;
return allocationNode == other.allocationNode &&
- keyType == other.keyType &&
- valueType == other.valueType &&
- typeMap.keys.every((k) => other.typeMap.containsKey(k)) &&
- other.typeMap.keys.every((k) => typeMap.containsKey(k) &&
- typeMap[k] == other.typeMap[k]);
-
+ keyType == other.keyType &&
+ valueType == other.valueType &&
+ typeMap.keys.every((k) => other.typeMap.containsKey(k)) &&
+ other.typeMap.keys.every(
+ (k) => typeMap.containsKey(k) && typeMap[k] == other.typeMap[k]);
}
TypeMask intersection(TypeMask other, ClassWorld classWorld) {
TypeMask forwardIntersection = forwardTo.intersection(other, classWorld);
if (forwardIntersection.isEmptyOrNull) return forwardIntersection;
- return forwardIntersection.isNullable
- ? nullable()
- : nonNullable();
+ return forwardIntersection.isNullable ? nullable() : nonNullable();
}
TypeMask union(other, ClassWorld classWorld) {
@@ -77,42 +65,40 @@ class DictionaryTypeMask extends MapTypeMask {
TypeMask newKeyType = keyType.union(other.keyType, classWorld);
TypeMask newValueType = valueType.union(other.valueType, classWorld);
Map<String, TypeMask> mappings = <String, TypeMask>{};
- typeMap.forEach((k,v) {
- if (!other.typeMap.containsKey(k)) {
- mappings[k] = v.nullable();
- }
- });
- other.typeMap.forEach((k,v) {
+ typeMap.forEach((k, v) {
+ if (!other.typeMap.containsKey(k)) {
+ mappings[k] = v.nullable();
+ }
+ });
+ other.typeMap.forEach((k, v) {
if (typeMap.containsKey(k)) {
mappings[k] = v.union(typeMap[k], classWorld);
} else {
mappings[k] = v.nullable();
}
});
- return new DictionaryTypeMask(newForwardTo, null, null,
- newKeyType, newValueType, mappings);
+ return new DictionaryTypeMask(
+ newForwardTo, null, null, newKeyType, newValueType, mappings);
} else if (other.isMap &&
- (other.keyType != null) &&
- (other.valueType != null)) {
+ (other.keyType != null) &&
+ (other.valueType != null)) {
TypeMask newForwardTo = forwardTo.union(other.forwardTo, classWorld);
TypeMask newKeyType = keyType.union(other.keyType, classWorld);
TypeMask newValueType = valueType.union(other.valueType, classWorld);
- return new MapTypeMask(newForwardTo, null, null,
- newKeyType, newValueType);
+ return new MapTypeMask(
+ newForwardTo, null, null, newKeyType, newValueType);
} else {
return forwardTo.union(other, classWorld);
}
}
- bool operator==(other) => super == other;
+ bool operator ==(other) => super == other;
int get hashCode {
- return computeHashCode(
- allocationNode, isNullable, typeMap, forwardTo);
+ return computeHashCode(allocationNode, isNullable, typeMap, forwardTo);
}
String toString() {
- return
- 'Dictionary mask: [$keyType/$valueType with $typeMap] type: $forwardTo';
+ return 'Dictionary mask: [$keyType/$valueType with $typeMap] type: $forwardTo';
}
}
« no previous file with comments | « pkg/compiler/lib/src/types/container_type_mask.dart ('k') | pkg/compiler/lib/src/types/flat_type_mask.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698