Index: runtime/lib/string_patch.dart |
diff --git a/runtime/lib/string_patch.dart b/runtime/lib/string_patch.dart |
index 1ba5e1a919b43b74d7d4800ca746f5ba47c2d67b..43101b0e47580695298a33a27c167640876e4aeb 100644 |
--- a/runtime/lib/string_patch.dart |
+++ b/runtime/lib/string_patch.dart |
@@ -417,7 +417,7 @@ class _StringBase { |
return result; |
} |
- List<int> get codeUnits => new CodeUnits(this); |
+ List<int> get codeUnits => new _CodeUnits(this); |
Runes get runes => new Runes(this); |
@@ -613,3 +613,17 @@ class _StringMatch implements Match { |
final String str; |
final String pattern; |
} |
+ |
+/** |
+ * An [Iterable] of the UTF-16 code units of a [String] in index order. |
+ */ |
+class _CodeUnits extends Object with ListMixin<int>, |
+ UnmodifiableListMixin<int> { |
+ /** The string that this is the code units of. */ |
+ String _string; |
+ |
+ _CodeUnits(this._string); |
+ |
+ int get length => _string.length; |
+ int operator[](int i) => _string.codeUnitAt(i); |
+} |