Index: pkg/compiler/lib/src/cps_ir/type_propagation.dart |
diff --git a/pkg/compiler/lib/src/cps_ir/type_propagation.dart b/pkg/compiler/lib/src/cps_ir/type_propagation.dart |
index 1ac163ee538b0732f31819e3dfb1f7c485a61acb..b185bc70b8cc801ba4e71076c7322d04c8898d98 100644 |
--- a/pkg/compiler/lib/src/cps_ir/type_propagation.dart |
+++ b/pkg/compiler/lib/src/cps_ir/type_propagation.dart |
@@ -1230,6 +1230,14 @@ class TransformingVisitor extends LeafVisitor { |
} |
if (!isExtendable) return false; |
CpsFragment cps = new CpsFragment(sourceInfo); |
+ Primitive length = cps.letPrim(new GetLength(list)); |
+ Primitive isEmpty = cps.applyBuiltin( |
+ BuiltinOperator.StrictEq, |
+ [length, cps.makeZero()]); |
+ CpsFragment fail = cps.ifTruthy(isEmpty); |
+ fail.invokeStaticThrower( |
+ backend.getThrowIndexOutOfBoundsError(), |
+ [list, fail.makeConstant(new IntConstantValue(-1))]); |
Primitive removedItem = cps.invokeBuiltin(BuiltinMethod.Pop, |
list, |
<Primitive>[], |