Index: pkg/analyzer/lib/src/summary/link.dart |
diff --git a/pkg/analyzer/lib/src/summary/link.dart b/pkg/analyzer/lib/src/summary/link.dart |
index 1b3f15fa5287835fb07461b801505ccd823d5cdb..8d7d33ed206c6a37fd2f83e9f27f0cd8ac2f4bae 100644 |
--- a/pkg/analyzer/lib/src/summary/link.dart |
+++ b/pkg/analyzer/lib/src/summary/link.dart |
@@ -1791,9 +1791,7 @@ class ExprTypeComputer { |
_doAssignToIndex(); |
break; |
case UnlinkedConstOperation.extractIndex: |
- stack.length -= 2; |
- // TODO(paulberry): implement. |
- stack.add(DynamicTypeImpl.instance); |
+ _doExtractIndex(); |
break; |
case UnlinkedConstOperation.invokeMethodRef: |
_doInvokeMethodRef(); |
@@ -1924,6 +1922,20 @@ class ExprTypeComputer { |
stack.add(type); |
} |
+ void _doExtractIndex() { |
+ stack.removeLast(); // index |
+ DartType target = stack.removeLast(); |
+ stack.add(() { |
+ if (target is InterfaceType) { |
+ MethodElement method = target.lookUpMethod('[]', library); |
+ if (method != null) { |
+ return method.returnType; |
+ } |
+ } |
+ return DynamicTypeImpl.instance; |
+ }()); |
+ } |
+ |
void _doExtractProperty() { |
DartType target = stack.removeLast(); |
String propertyName = _getNextString(); |