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

Unified Diff: runtime/lib/string_patch.dart

Issue 16285004: Better documentation on Sets and Maps, and more. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments. Created 7 years, 6 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 | sdk/lib/_internal/compiler/implementation/lib/string_helper.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/lib/string_patch.dart
diff --git a/runtime/lib/string_patch.dart b/runtime/lib/string_patch.dart
index 0707a5fdaa91fdfe3aadb824fb138661470385bc..3cdb2a12d37a6433974dcb85c6853c66726a900f 100644
--- a/runtime/lib/string_patch.dart
+++ b/runtime/lib/string_patch.dart
@@ -267,9 +267,12 @@ class _StringBase {
bool contains(Pattern pattern, [int startIndex = 0]) {
if (pattern is String) {
+ if (startIndex < 0 || startIndex > this.length) {
+ throw new RangeError.range(startIndex, 0, this.length);
+ }
return indexOf(pattern, startIndex) >= 0;
}
- return pattern.allMatches(this.substring(startIndex)).iterator.moveNext();
+ return pattern.allMatches(this.substring(startIndex)).isNotEmpty;
}
String replaceFirst(Pattern pattern, String replacement) {
« no previous file with comments | « no previous file | sdk/lib/_internal/compiler/implementation/lib/string_helper.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698