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 const int _maxAscii = 0x7f; | 5 const int _maxAscii = 0x7f; |
6 const int _maxLatin1 = 0xff; | 6 const int _maxLatin1 = 0xff; |
7 const int _maxUtf16 = 0xffff; | 7 const int _maxUtf16 = 0xffff; |
8 const int _maxUnicode = 0x10ffff; | 8 const int _maxUnicode = 0x10ffff; |
9 | 9 |
10 @patch class String { | 10 @patch class String { |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 // For longer strings, calling into C++ to create the result of a | 76 // For longer strings, calling into C++ to create the result of a |
77 // [replaceAll] is faster than [_joinReplaceAllOneByteResult]. | 77 // [replaceAll] is faster than [_joinReplaceAllOneByteResult]. |
78 // TODO(lrn): See if this limit can be tweaked. | 78 // TODO(lrn): See if this limit can be tweaked. |
79 static const int _maxJoinReplaceOneByteStringLength = 500; | 79 static const int _maxJoinReplaceOneByteStringLength = 500; |
80 | 80 |
81 factory _StringBase._uninstantiable() { | 81 factory _StringBase._uninstantiable() { |
82 throw new UnsupportedError( | 82 throw new UnsupportedError( |
83 "_StringBase can't be instaniated"); | 83 "_StringBase can't be instaniated"); |
84 } | 84 } |
85 | 85 |
| 86 Type get runtimeType => String; |
| 87 |
86 int get hashCode native "String_getHashCode"; | 88 int get hashCode native "String_getHashCode"; |
87 | 89 |
88 bool get _isOneByte { | 90 bool get _isOneByte { |
89 // Alternatively return false and override it on one-byte string classes. | 91 // Alternatively return false and override it on one-byte string classes. |
90 int id = ClassID.getID(this); | 92 int id = ClassID.getID(this); |
91 return id == ClassID.cidOneByteString || | 93 return id == ClassID.cidOneByteString || |
92 id == ClassID.cidExternalOneByteString; | 94 id == ClassID.cidExternalOneByteString; |
93 } | 95 } |
94 | 96 |
95 /** | 97 /** |
(...skipping 1261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1357 int end = index + _pattern.length; | 1359 int end = index + _pattern.length; |
1358 _current = new _StringMatch(index, _input, _pattern); | 1360 _current = new _StringMatch(index, _input, _pattern); |
1359 // Empty match, don't start at same location again. | 1361 // Empty match, don't start at same location again. |
1360 if (end == _index) end++; | 1362 if (end == _index) end++; |
1361 _index = end; | 1363 _index = end; |
1362 return true; | 1364 return true; |
1363 } | 1365 } |
1364 | 1366 |
1365 Match get current => _current; | 1367 Match get current => _current; |
1366 } | 1368 } |
OLD | NEW |