| Index: pkg/compiler/lib/src/types/union_type_mask.dart
|
| diff --git a/pkg/compiler/lib/src/types/union_type_mask.dart b/pkg/compiler/lib/src/types/union_type_mask.dart
|
| index 9cd5bcb023255f54db93311b7f6345d5db80c9ad..f05880a895cf50f71c04203efb7aea76f5354a7c 100644
|
| --- a/pkg/compiler/lib/src/types/union_type_mask.dart
|
| +++ b/pkg/compiler/lib/src/types/union_type_mask.dart
|
| @@ -20,7 +20,8 @@ class UnionTypeMask implements TypeMask {
|
| }
|
|
|
| static TypeMask unionOf(Iterable<TypeMask> masks, ClassWorld classWorld) {
|
| - assert(masks.every((mask) => TypeMask.assertIsNormalized(mask, classWorld)));
|
| + assert(
|
| + masks.every((mask) => TypeMask.assertIsNormalized(mask, classWorld)));
|
| List<FlatTypeMask> disjoint = <FlatTypeMask>[];
|
| unionOfHelper(masks, disjoint, classWorld);
|
| if (disjoint.isEmpty) return new TypeMask.nonNullEmpty();
|
| @@ -34,8 +35,7 @@ class UnionTypeMask implements TypeMask {
|
| }
|
|
|
| static void unionOfHelper(Iterable<TypeMask> masks,
|
| - List<FlatTypeMask> disjoint,
|
| - ClassWorld classWorld) {
|
| + List<FlatTypeMask> disjoint, ClassWorld classWorld) {
|
| // TODO(johnniwinther): Impose an order on the mask to ensure subclass masks
|
| // are preferred to subtype masks.
|
| for (TypeMask mask in masks) {
|
| @@ -103,7 +103,8 @@ class UnionTypeMask implements TypeMask {
|
| int bestKind;
|
| int bestSize;
|
| for (ClassElement candidate in candidates) {
|
| - bool isInstantiatedStrictSubclass(cls) => cls != candidate &&
|
| + bool isInstantiatedStrictSubclass(cls) =>
|
| + cls != candidate &&
|
| classWorld.isDirectlyInstantiated(cls) &&
|
| classWorld.isSubclassOf(cls, candidate);
|
|
|
| @@ -138,8 +139,7 @@ class UnionTypeMask implements TypeMask {
|
| other = TypeMask.nonForwardingMask(other);
|
| if (!other.isUnion && disjointMasks.contains(other)) return this;
|
|
|
| - List<FlatTypeMask> newList =
|
| - new List<FlatTypeMask>.from(disjointMasks);
|
| + List<FlatTypeMask> newList = new List<FlatTypeMask>.from(disjointMasks);
|
| if (!other.isUnion) {
|
| newList.add(other);
|
| } else {
|
| @@ -322,17 +322,16 @@ class UnionTypeMask implements TypeMask {
|
| ClassElement singleClass(ClassWorld classWorld) => null;
|
|
|
| bool needsNoSuchMethodHandling(Selector selector, ClassWorld classWorld) {
|
| - return disjointMasks.any(
|
| - (e) => e.needsNoSuchMethodHandling(selector, classWorld));
|
| + return disjointMasks
|
| + .any((e) => e.needsNoSuchMethodHandling(selector, classWorld));
|
| }
|
|
|
| bool canHit(Element element, Selector selector, ClassWorld classWorld) {
|
| return disjointMasks.any((e) => e.canHit(element, selector, classWorld));
|
| }
|
|
|
| - Element locateSingleElement(Selector selector,
|
| - TypeMask mask,
|
| - Compiler compiler) {
|
| + Element locateSingleElement(
|
| + Selector selector, TypeMask mask, Compiler compiler) {
|
| Element candidate;
|
| for (FlatTypeMask mask in disjointMasks) {
|
| Element current = mask.locateSingleElement(selector, mask, compiler);
|
| @@ -348,12 +347,13 @@ class UnionTypeMask implements TypeMask {
|
| }
|
|
|
| String toString() {
|
| - String masksString = (disjointMasks.map((TypeMask mask) => mask.toString())
|
| - .toList()..sort()).join(", ");
|
| + String masksString =
|
| + (disjointMasks.map((TypeMask mask) => mask.toString()).toList()..sort())
|
| + .join(", ");
|
| return 'Union of [$masksString]';
|
| }
|
|
|
| - bool operator==(other) {
|
| + bool operator ==(other) {
|
| if (identical(this, other)) return true;
|
|
|
| bool containsAll() {
|
| @@ -363,10 +363,10 @@ class UnionTypeMask implements TypeMask {
|
| });
|
| }
|
|
|
| - return other is UnionTypeMask
|
| - && other.isNullable == isNullable
|
| - && other.disjointMasks.length == disjointMasks.length
|
| - && containsAll();
|
| + return other is UnionTypeMask &&
|
| + other.isNullable == isNullable &&
|
| + other.disjointMasks.length == disjointMasks.length &&
|
| + containsAll();
|
| }
|
|
|
| int get hashCode {
|
|
|