| 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 582 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 593 } | 593 } |
| 594 | 594 |
| 595 bool _isWhitespace(int codePoint) { | 595 bool _isWhitespace(int codePoint) { |
| 596 return _StringBase._isTwoByteWhitespace(codePoint); | 596 return _StringBase._isTwoByteWhitespace(codePoint); |
| 597 } | 597 } |
| 598 } | 598 } |
| 599 | 599 |
| 600 | 600 |
| 601 class _StringMatch implements Match { | 601 class _StringMatch implements Match { |
| 602 const _StringMatch(int this.start, | 602 const _StringMatch(int this.start, |
| 603 String this.str, | 603 String this.input, |
| 604 String this.pattern); | 604 String this.pattern); |
| 605 | 605 |
| 606 int get end => start + pattern.length; | 606 int get end => start + pattern.length; |
| 607 String operator[](int g) => group(g); | 607 String operator[](int g) => group(g); |
| 608 int get groupCount => 0; | 608 int get groupCount => 0; |
| 609 | 609 |
| 610 String group(int group) { | 610 String group(int group) { |
| 611 if (group != 0) { | 611 if (group != 0) { |
| 612 throw new RangeError.value(group); | 612 throw new RangeError.value(group); |
| 613 } | 613 } |
| 614 return pattern; | 614 return pattern; |
| 615 } | 615 } |
| 616 | 616 |
| 617 List<String> groups(List<int> groups) { | 617 List<String> groups(List<int> groups) { |
| 618 List<String> result = new List<String>(); | 618 List<String> result = new List<String>(); |
| 619 for (int g in groups) { | 619 for (int g in groups) { |
| 620 result.add(group(g)); | 620 result.add(group(g)); |
| 621 } | 621 } |
| 622 return result; | 622 return result; |
| 623 } | 623 } |
| 624 | 624 |
| 625 // TODO(12843): Remove when grace period is over. |
| 626 String get str => input; |
| 627 |
| 625 final int start; | 628 final int start; |
| 626 final String str; | 629 final String input; |
| 627 final String pattern; | 630 final String pattern; |
| 628 } | 631 } |
| 629 | 632 |
| 630 /** | 633 /** |
| 631 * An [Iterable] of the UTF-16 code units of a [String] in index order. | 634 * An [Iterable] of the UTF-16 code units of a [String] in index order. |
| 632 */ | 635 */ |
| 633 class _CodeUnits extends Object with ListMixin<int>, | 636 class _CodeUnits extends Object with ListMixin<int>, |
| 634 UnmodifiableListMixin<int> { | 637 UnmodifiableListMixin<int> { |
| 635 /** The string that this is the code units of. */ | 638 /** The string that this is the code units of. */ |
| 636 String _string; | 639 String _string; |
| 637 | 640 |
| 638 _CodeUnits(this._string); | 641 _CodeUnits(this._string); |
| 639 | 642 |
| 640 int get length => _string.length; | 643 int get length => _string.length; |
| 641 int operator[](int i) => _string.codeUnitAt(i); | 644 int operator[](int i) => _string.codeUnitAt(i); |
| 642 } | 645 } |
| OLD | NEW |