Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(90)

Side by Side Diff: runtime/lib/string_patch.dart

Issue 15333006: Rewrite double.parse. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 498 matching lines...) Expand 10 before | Expand all | Expand 10 after
509 } 509 }
510 510
511 int get hashCode native "String_getHashCode"; 511 int get hashCode native "String_getHashCode";
512 512
513 // Checks for one-byte whitespaces only. 513 // Checks for one-byte whitespaces only.
514 // TODO(srdjan): Investigate if 0x85 (NEL) and 0xA0 (NBSP) are valid 514 // TODO(srdjan): Investigate if 0x85 (NEL) and 0xA0 (NBSP) are valid
515 // whitespaces for one byte strings. 515 // whitespaces for one byte strings.
516 bool _isWhitespace(int codePoint) { 516 bool _isWhitespace(int codePoint) {
517 return 517 return
518 (codePoint == 32) || // Space. 518 (codePoint == 32) || // Space.
519 ((9 <= codePoint) && (codePoint <= 13)); // CR, LF, TAB, etc. 519 ((9 <= codePoint) && (codePoint <= 13)) || // CR, LF, TAB, etc.
520 (codePoint == 0xA0); // NBSP.
520 } 521 }
521 522
522 String _substringUncheckedNative(int startIndex, int endIndex) 523 String _substringUncheckedNative(int startIndex, int endIndex)
523 native "OneByteString_substringUnchecked"; 524 native "OneByteString_substringUnchecked";
524 525
525 List<String> _splitWithCharCode(int charCode) 526 List<String> _splitWithCharCode(int charCode)
526 native "OneByteString_splitWithCharCode"; 527 native "OneByteString_splitWithCharCode";
527 528
528 List<String> split(Pattern pattern) { 529 List<String> split(Pattern pattern) {
529 if ((pattern._cid == _OneByteString._classId) && (pattern.length == 1)) { 530 if ((pattern._cid == _OneByteString._classId) && (pattern.length == 1)) {
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
567 throw new UnsupportedError( 568 throw new UnsupportedError(
568 "_TwoByteString can only be allocated by the VM"); 569 "_TwoByteString can only be allocated by the VM");
569 } 570 }
570 571
571 // Checks for one-byte whitespaces only. 572 // Checks for one-byte whitespaces only.
572 // TODO(srdjan): Investigate if 0x85 (NEL) and 0xA0 (NBSP) are valid 573 // TODO(srdjan): Investigate if 0x85 (NEL) and 0xA0 (NBSP) are valid
573 // whitespaces. Add checking for multi-byte whitespace codepoints. 574 // whitespaces. Add checking for multi-byte whitespace codepoints.
574 bool _isWhitespace(int codePoint) { 575 bool _isWhitespace(int codePoint) {
575 return 576 return
576 (codePoint == 32) || // Space. 577 (codePoint == 32) || // Space.
577 ((9 <= codePoint) && (codePoint <= 13)); // CR, LF, TAB, etc. 578 ((9 <= codePoint) && (codePoint <= 13)) || // CR, LF, TAB, etc.
579 (codePoint == 0xA0); // NBSP.
578 } 580 }
579 } 581 }
580 582
581 583
582 class _FourByteString extends _StringBase implements String { 584 class _FourByteString extends _StringBase implements String {
583 factory _FourByteString._uninstantiable() { 585 factory _FourByteString._uninstantiable() {
584 throw new UnsupportedError( 586 throw new UnsupportedError(
585 "_FourByteString can only be allocated by the VM"); 587 "_FourByteString can only be allocated by the VM");
586 } 588 }
587 589
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
665 class _CodeUnits extends Object with ListMixin<int>, 667 class _CodeUnits extends Object with ListMixin<int>,
666 UnmodifiableListMixin<int> { 668 UnmodifiableListMixin<int> {
667 /** The string that this is the code units of. */ 669 /** The string that this is the code units of. */
668 String _string; 670 String _string;
669 671
670 _CodeUnits(this._string); 672 _CodeUnits(this._string);
671 673
672 int get length => _string.length; 674 int get length => _string.length;
673 int operator[](int i) => _string.codeUnitAt(i); 675 int operator[](int i) => _string.codeUnitAt(i);
674 } 676 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698