| Index: sdk/lib/_internal/compiler/implementation/inferrer/type_graph_nodes.dart
|
| ===================================================================
|
| --- sdk/lib/_internal/compiler/implementation/inferrer/type_graph_nodes.dart (revision 30992)
|
| +++ sdk/lib/_internal/compiler/implementation/inferrer/type_graph_nodes.dart (working copy)
|
| @@ -816,10 +816,10 @@
|
| }
|
|
|
| /**
|
| - * A [ContainerTypeInformation] is a [TypeInformation] created
|
| + * A [ListTypeInformation] is a [TypeInformation] created
|
| * for each `List` instantiations.
|
| */
|
| -class ContainerTypeInformation extends TypeInformation {
|
| +class ListTypeInformation extends TypeInformation {
|
| final ElementInContainerTypeInformation elementType;
|
|
|
| /** The container type before it is inferred. */
|
| @@ -832,7 +832,7 @@
|
| int inferredLength;
|
|
|
| /**
|
| - * Whether this container goes through a growable check.
|
| + * Whether this list goes through a growable check.
|
| * We conservatively assume it does.
|
| */
|
| bool checksGrowable = true;
|
| @@ -844,18 +844,18 @@
|
| bool bailedOut = true;
|
| bool analyzed = false;
|
|
|
| - ContainerTypeInformation(this.originalContainerType,
|
| - this.elementType,
|
| - this.originalLength) {
|
| + ListTypeInformation(this.originalContainerType,
|
| + this.elementType,
|
| + this.originalLength) {
|
| type = originalContainerType;
|
| inferredLength = originalContainerType.length;
|
| elementType.addUser(this);
|
| }
|
|
|
| - String toString() => 'Container type $type';
|
| + String toString() => 'List type $type';
|
|
|
| accept(TypeInformationVisitor visitor) {
|
| - return visitor.visitContainerTypeInformation(this);
|
| + return visitor.visitListTypeInformation(this);
|
| }
|
|
|
| bool hasStableType(TypeGraphInferrerEngine inferrer) {
|
| @@ -879,7 +879,7 @@
|
|
|
| /**
|
| * An [ElementInContainerTypeInformation] holds the common type of the
|
| - * elements in a [ContainerTypeInformation].
|
| + * elements in a [ListTypeInformation].
|
| */
|
| class ElementInContainerTypeInformation extends TypeInformation {
|
| /** Whether the element type in that container has been inferred. */
|
| @@ -908,6 +908,32 @@
|
| }
|
|
|
| /**
|
| + * A [MapTypeInformation] is a [TypeInformation] created
|
| + * for maps.
|
| + */
|
| +class MapTypeInformation extends TypeInformation {
|
| + final TypeInformation keyType;
|
| + final TypeInformation valueType;
|
| + final TypeMask initialType;
|
| +
|
| + MapTypeInformation(this.keyType, this.valueType, this.initialType) {
|
| + keyType.addUser(this);
|
| + valueType.addUser(this);
|
| + type = initialType;
|
| + }
|
| +
|
| + accept(TypeInformationVisitor visitor) {
|
| + return visitor.visitMapTypeInformation(this);
|
| + }
|
| +
|
| + TypeMask refine(TypeGraphInferrerEngine inferrer) {
|
| + return initialType;
|
| + }
|
| +
|
| + String toString() => 'Map $type';
|
| +}
|
| +
|
| +/**
|
| * A [PhiElementTypeInformation] is an union of
|
| * [ElementTypeInformation], that is local to a method.
|
| */
|
| @@ -934,7 +960,8 @@
|
| T visitPhiElementTypeInformation(PhiElementTypeInformation info);
|
| T visitElementInContainerTypeInformation(
|
| ElementInContainerTypeInformation info);
|
| - T visitContainerTypeInformation(ContainerTypeInformation info);
|
| + T visitListTypeInformation(ListTypeInformation info);
|
| + T visitMapTypeInformation(MapTypeInformation info);
|
| T visitConcreteTypeInformation(ConcreteTypeInformation info);
|
| T visitClosureCallSiteTypeInformation(ClosureCallSiteTypeInformation info);
|
| T visitStaticCallSiteTypeInformation(StaticCallSiteTypeInformation info);
|
|
|