| Index: pkg/compiler/lib/src/cps_ir/type_mask_system.dart
|
| diff --git a/pkg/compiler/lib/src/cps_ir/type_mask_system.dart b/pkg/compiler/lib/src/cps_ir/type_mask_system.dart
|
| index a5fa5a8dc9618e51ca53f4b51496735ff404cdbf..aa48348cfdae49f6854cb721738f56b59bf264b2 100644
|
| --- a/pkg/compiler/lib/src/cps_ir/type_mask_system.dart
|
| +++ b/pkg/compiler/lib/src/cps_ir/type_mask_system.dart
|
| @@ -295,4 +295,35 @@ class TypeMaskSystem {
|
| TypeMask receiverTypeFor(Selector selector, TypeMask mask) {
|
| return classWorld.allFunctions.receiverType(selector, mask);
|
| }
|
| +
|
| + /// The result of an index operation on something of [type], or the dynamic
|
| + /// type if unknown.
|
| + TypeMask elementTypeOfIndexable(TypeMask type) {
|
| + if (type is UnionTypeMask) {
|
| + return new TypeMask.unionOf(
|
| + type.disjointMasks.map(elementTypeOfIndexable), classWorld);
|
| + }
|
| + if (type is ContainerTypeMask) {
|
| + return type.elementType;
|
| + }
|
| + if (isDefinitelyString(type)) {
|
| + return stringType;
|
| + }
|
| + if (type.satisfies(backend.typedArrayClass, classWorld)) {
|
| + if (type.satisfies(backend.typedArrayOfIntClass, classWorld)) {
|
| + return intType;
|
| + }
|
| + return numType;
|
| + }
|
| + return dynamicType;
|
| + }
|
| +
|
| + /// The length of something of [type], or `null` if unknown.
|
| + int getContainerLength(TypeMask type) {
|
| + if (type is ContainerTypeMask) {
|
| + return type.length;
|
| + } else {
|
| + return null;
|
| + }
|
| + }
|
| }
|
|
|