Open rakudrama opened 11 years ago
Added TriageForM5 label.
Removed this from the M5 milestone. Added this to the Later milestone. Removed TriageForM5 label.
Removed this from the Later milestone. Added Oldschool-Milestone-Later label.
Removed Oldschool-Milestone-Later label.
get:last
has been rewritten to throw a StateError
when the list is empty.
HBoundCheck
still has the length as an input when there is no upper-range check:
@pragma('dart2js:noInline')
T lastOf<T>(List<T> a) => a[a.length - 1];
t1
is still used once:
lastOf(a, $T) {
var t1 = a.length,
t2 = t1 - 1;
if (!(t2 >= 0))
return A.ioore(a, t2);
return a[t2];
}
$$.JSArray = {"": "Object;",
get$last: function(receiver) { var t1, t2; t1 = receiver.length; t2 = t1 - 1; if (t2 < 0) throw $.ioore(t2); return receiver[t2]; },
In this code, t1 is used once. The code is generated like this because the HBoundsCheck has t1 as an input, but the input is not used (so the code generator thinks t1 has two uses). Better code would be generated here if the unused input was unlinked, or if HBoundsCheck was broken into components.
I have put this at low priority since I don't think it is all that common.