Chromium Code Reviews| Index: runtime/lib/string_patch.dart |
| diff --git a/runtime/lib/string_patch.dart b/runtime/lib/string_patch.dart |
| index 717e49db71984f56878bbfcf0cde617c7efb3be5..563dfef978903134bf79622f99f7a1ee62301050 100644 |
| --- a/runtime/lib/string_patch.dart |
| +++ b/runtime/lib/string_patch.dart |
| @@ -814,28 +814,20 @@ class _OneByteString extends _StringBase implements String { |
| 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, |
| ]; |
| - String _toLowerCaseUpperCaseDetectedAt(int firstUpperCaseIndex) { |
| - // String contains upper case characters. Create a new string. |
| - final length = this.length; |
| - final result = _allocate(length); |
| - // First up to firstUpperIndex. |
| - int i = 0; |
| - for (; i < firstUpperCaseIndex; i++) { |
| - result._setAt(i, this.codeUnitAt(i)); |
| - } |
| - for (; i < length; i++) { |
| - result._setAt(i, _LC_TABLE[this.codeUnitAt(i)]); |
| - } |
| - return result; |
| - } |
| - |
| String toLowerCase() { |
| for (int i = 0; i < this.length; i++) { |
| final c = this.codeUnitAt(i); |
| - // Ranges: 0x41-0x5a ('A' - 'Z'), 0xc0-0xd6, 0xd8-0xde. |
| - if (c != _LC_TABLE[c]) { |
| - return _toLowerCaseUpperCaseDetectedAt(i); |
| + if (c == _LC_TABLE[c]) continue; |
| + // Upper-case character found. |
| + final result = _allocate(this.length); |
| + for (int j = 0; j < i; j++) { |
| + result._setAt(j, this.codeUnitAt(j)); |
| } |
| + for (int j = i; j < this.length; j++) { |
| + // Ranges: 0x41-0x5a ('A' - 'Z'), 0xc0-0xd6, 0xd8-0xde. |
|
Lasse Reichstein Nielsen
2014/03/26 11:37:51
Maybe move this comment to the table?
// Upper-cas
Anders Johnsen
2014/03/26 11:39:12
Done.
|
| + result._setAt(j, _LC_TABLE[this.codeUnitAt(j)]); |
| + } |
| + return result; |
| } |
| return this; |
| } |