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 232914493d66747a2b22da72def3c5b8dd6a168a..25fb1c9e8c20394e22760ebd427f3cf34b1c17eb 100644 |
--- a/pkg/compiler/lib/src/cps_ir/type_mask_system.dart |
+++ b/pkg/compiler/lib/src/cps_ir/type_mask_system.dart |
@@ -579,4 +579,19 @@ class TypeMaskSystem implements AbstractValueDomain { |
return null; |
} |
} |
+ |
+ /// Returns the type of the entry at a given index, `null` if unknown. |
+ TypeMask indexWithConstant(TypeMask container, ConstantValue indexValue) { |
+ if (container is DictionaryTypeMask) { |
+ if (indexValue is StringConstantValue) { |
+ String key = indexValue.primitiveValue.slowToString(); |
+ TypeMask result = container.typeMap[key]; |
+ if (result != null) return result; |
+ } |
+ } |
+ if (container is ContainerTypeMask) { |
+ return container.elementType; |
+ } |
+ return null; |
+ } |
} |