Chromium Code Reviews| Index: dart/frog/leg/lib/js_helper.dart |
| diff --git a/dart/frog/leg/lib/js_helper.dart b/dart/frog/leg/lib/js_helper.dart |
| index ca78471a909b3163ed3598c2f1b89b0d453dd6d8..909ed3d2ca8d52b1b36ea65eee7183932a98b44f 100644 |
| --- a/dart/frog/leg/lib/js_helper.dart |
| +++ b/dart/frog/leg/lib/js_helper.dart |
| @@ -595,8 +595,8 @@ builtin$getRange$2(receiver, start, length) { |
| checkNull(length); // TODO(ahe): This is not specified but co19 tests it. |
| if (start is !int) throw new IllegalArgumentException(start); |
| if (length is !int) throw new IllegalArgumentException(length); |
| - if (start < 0) throw new IndexOutOfRangeException(start); |
| if (length < 0) throw new IllegalArgumentException(length); |
| + if (start < 0) throw new IndexOutOfRangeException(start); |
| var end = start + length; |
| if (end > receiver.length) { |
| throw new IndexOutOfRangeException(length); |
| @@ -697,7 +697,10 @@ builtin$lastIndexOf$2(receiver, element, start) { |
| if (start !== null) { |
| if (start is !num) throw new IllegalArgumentException(start); |
| if (start < 0) return -1; |
| - if (start >= receiver.length) start = receiver.length - 1; |
| + if (start >= receiver.length) { |
| + if (element == "") return receiver.length; |
| + start = receiver.length - 1; |
|
floitsch
2012/03/26 19:57:43
You could avoid special casing by simply setting s
|
| + } |
| } |
| return stringLastIndexOfUnchecked(receiver, element, start); |
| } |