Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8282)

Unified Diff: dart/frog/leg/lib/js_helper.dart

Issue 9852018: Minor tweaks to the core library. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | dart/frog/leg/lib/string_helper.dart » ('j') | dart/frog/leg/lib/string_helper.dart » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
+ }
}
return stringLastIndexOfUnchecked(receiver, element, start);
}
« no previous file with comments | « no previous file | dart/frog/leg/lib/string_helper.dart » ('j') | dart/frog/leg/lib/string_helper.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698