| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 patch class String { | 5 patch class String { |
| 6 /* patch */ factory String.fromCharCodes(Iterable<int> charCodes) { | 6 /* patch */ factory String.fromCharCodes(Iterable<int> charCodes) { |
| 7 return _StringBase.createFromCharCodes(charCodes); | 7 return _StringBase.createFromCharCodes(charCodes); |
| 8 } | 8 } |
| 9 } | 9 } |
| 10 | 10 |
| (...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 483 if ((pattern is _OneByteString) && (pattern.length == 1)) { | 483 if ((pattern is _OneByteString) && (pattern.length == 1)) { |
| 484 return _splitWithCharCode(pattern.codeUnitAt(0)); | 484 return _splitWithCharCode(pattern.codeUnitAt(0)); |
| 485 } | 485 } |
| 486 return super.split(pattern); | 486 return super.split(pattern); |
| 487 } | 487 } |
| 488 | 488 |
| 489 // Allocates a string of given length, expecting its content to be | 489 // Allocates a string of given length, expecting its content to be |
| 490 // set using _setAt. | 490 // set using _setAt. |
| 491 static _OneByteString _allocate(int length) native "OneByteString_allocate"; | 491 static _OneByteString _allocate(int length) native "OneByteString_allocate"; |
| 492 | 492 |
| 493 // Code point value must be a valid Latin1 (0..0xFF). Index must be valid. | 493 // This is internal helper method. Code point value must be a valid |
| 494 // Latin1 value (0..0xFF), index must be valid. |
| 494 void _setAt(int index, int codePoint) native "OneByteString_setAt"; | 495 void _setAt(int index, int codePoint) native "OneByteString_setAt"; |
| 495 } | 496 } |
| 496 | 497 |
| 497 | 498 |
| 498 class _TwoByteString extends _StringBase implements String { | 499 class _TwoByteString extends _StringBase implements String { |
| 499 factory _TwoByteString._uninstantiable() { | 500 factory _TwoByteString._uninstantiable() { |
| 500 throw new UnsupportedError( | 501 throw new UnsupportedError( |
| 501 "_TwoByteString can only be allocated by the VM"); | 502 "_TwoByteString can only be allocated by the VM"); |
| 502 } | 503 } |
| 503 | 504 |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 615 class _CodeUnits extends Object with ListMixin<int>, | 616 class _CodeUnits extends Object with ListMixin<int>, |
| 616 UnmodifiableListMixin<int> { | 617 UnmodifiableListMixin<int> { |
| 617 /** The string that this is the code units of. */ | 618 /** The string that this is the code units of. */ |
| 618 String _string; | 619 String _string; |
| 619 | 620 |
| 620 _CodeUnits(this._string); | 621 _CodeUnits(this._string); |
| 621 | 622 |
| 622 int get length => _string.length; | 623 int get length => _string.length; |
| 623 int operator[](int i) => _string.codeUnitAt(i); | 624 int operator[](int i) => _string.codeUnitAt(i); |
| 624 } | 625 } |
| OLD | NEW |