| 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 |
| 11 | 11 |
| 12 /** | 12 /** |
| 13 * [_StringBase] contains common methods used by concrete String | 13 * [_StringBase] contains common methods used by concrete String |
| 14 * implementations, e.g., _OneByteString. | 14 * implementations, e.g., _OneByteString. |
| 15 */ | 15 */ |
| 16 class _StringBase { | 16 class _StringBase { |
| 17 | 17 |
| 18 factory _StringBase._uninstantiable() { | 18 factory _StringBase._uninstantiable() { |
| 19 throw new UnsupportedError( | 19 throw new UnsupportedError( |
| 20 "_StringBase can't be instaniated"); | 20 "_StringBase can't be instaniated"); |
| 21 } | 21 } |
| 22 | 22 |
| 23 Type get runtimeType => String; |
| 24 |
| 23 int get hashCode native "String_getHashCode"; | 25 int get hashCode native "String_getHashCode"; |
| 24 | 26 |
| 25 /** | 27 /** |
| 26 * Create the most efficient string representation for specified | 28 * Create the most efficient string representation for specified |
| 27 * [codePoints]. | 29 * [codePoints]. |
| 28 */ | 30 */ |
| 29 static String createFromCharCodes(Iterable<int> charCodes) { | 31 static String createFromCharCodes(Iterable<int> charCodes) { |
| 30 if (charCodes != null) { | 32 if (charCodes != null) { |
| 31 // TODO(srdjan): Also skip copying of typed arrays. | 33 // TODO(srdjan): Also skip copying of typed arrays. |
| 32 final ccid = charCodes._cid; | 34 final ccid = charCodes._cid; |
| (...skipping 605 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 638 class _CodeUnits extends Object with ListMixin<int>, | 640 class _CodeUnits extends Object with ListMixin<int>, |
| 639 UnmodifiableListMixin<int> { | 641 UnmodifiableListMixin<int> { |
| 640 /** The string that this is the code units of. */ | 642 /** The string that this is the code units of. */ |
| 641 String _string; | 643 String _string; |
| 642 | 644 |
| 643 _CodeUnits(this._string); | 645 _CodeUnits(this._string); |
| 644 | 646 |
| 645 int get length => _string.length; | 647 int get length => _string.length; |
| 646 int operator[](int i) => _string.codeUnitAt(i); | 648 int operator[](int i) => _string.codeUnitAt(i); |
| 647 } | 649 } |
| OLD | NEW |