Index: runtime/lib/string_patch.dart |
diff --git a/runtime/lib/string_patch.dart b/runtime/lib/string_patch.dart |
index 11db8fe066a8f4e74ede1e9d314ac6427f612edf..21a5ab0090f8329bc2d8d05874492448b5163a12 100644 |
--- a/runtime/lib/string_patch.dart |
+++ b/runtime/lib/string_patch.dart |
@@ -896,14 +896,16 @@ class _StringBase { |
List<String> result = new List<String>(); |
int startIndex = 0; |
int previousIndex = 0; |
+ // 'pattern' may not be implemented correctly and therefore we cannot |
+ // call _substringUnhchecked unless it is a trustworthy type (e.g. String). |
while (true) { |
if (startIndex == length || !iterator.moveNext()) { |
- result.add(this._substringUnchecked(previousIndex, length)); |
+ result.add(this.substring(previousIndex, length)); |
break; |
} |
Match match = iterator.current; |
if (match.start == length) { |
- result.add(this._substringUnchecked(previousIndex, length)); |
+ result.add(this.substring(previousIndex, length)); |
break; |
} |
int endIndex = match.end; |
@@ -911,7 +913,7 @@ class _StringBase { |
++startIndex; // empty match, advance and restart |
continue; |
} |
- result.add(this._substringUnchecked(previousIndex, match.start)); |
+ result.add(this.substring(previousIndex, match.start)); |
startIndex = previousIndex = endIndex; |
} |
return result; |