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

Side by Side Diff: test/dart_codegen/expect/core/string.dart

Issue 963593002: Disable formatting and add new-lines to make tests faster. (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 5 years, 9 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
OLDNEW
1 part of dart.core; 1 part of dart.core;
2 2 abstract class String implements Comparable<String>, Pattern {factory String.fr omCharCodes(Iterable<int> charCodes, [int start = 0, int end]) {
3 abstract class String implements Comparable<String>, Pattern { 3 if (charCodes is! JSArray) {
4 factory String.fromCharCodes(Iterable<int> charCodes, 4 return ((__x36) => DDC$RT.cast(__x36, dynamic, String, "CastGeneral", """lin e 118, column 15 of dart:core/string.dart: """, __x36 is String, true))(_stringF romIterable(charCodes, start, end));
5 [int start = 0, int end]) {
6 if (charCodes is! JSArray) {
7 return ((__x36) => DDC$RT.cast(__x36, dynamic, String, "CastGeneral",
8 """line 118, column 15 of dart:core/string.dart: """, __x36 is String,
9 true))(_stringFromIterable(charCodes, start, end));
10 } 5 }
11 List list = DDC$RT.cast(charCodes, DDC$RT.type((Iterable<int> _) {}), 6 List list = DDC$RT.cast(charCodes, DDC$RT.type((Iterable<int> _) {
12 DDC$RT.type((List<dynamic> _) {}), "CastGeneral",
13 """line 121, column 18 of dart:core/string.dart: """,
14 charCodes is List<dynamic>, true);
15 int len = list.length;
16 if (start < 0 || start > len) {
17 throw new RangeError.range(start, 0, len);
18 } 7 }
19 if (end == null) { 8 ), DDC$RT.type((List<dynamic> _) {
20 end = len;
21 } else if (end < start || end > len) {
22 throw new RangeError.range(end, start, len);
23 } 9 }
24 if (start > 0 || end < len) { 10 ), "CastGeneral", """line 121, column 18 of dart:core/string.dart: """, charCo des is List<dynamic>, true);
25 list = list.sublist(start, end); 11 int len = list.length;
12 if (start < 0 || start > len) {
13 throw new RangeError.range(start, 0, len);
26 } 14 }
27 return ((__x37) => DDC$RT.cast(__x37, dynamic, String, "CastGeneral", 15 if (end == null) {
28 """line 135, column 13 of dart:core/string.dart: """, __x37 is String, 16 end = len;
29 true))(Primitives.stringFromCharCodes(list)); 17 }
18 else if (end < start || end > len) {
19 throw new RangeError.range(end, start, len);
20 }
21 if (start > 0 || end < len) {
22 list = list.sublist(start, end);
23 }
24 return ((__x37) => DDC$RT.cast(__x37, dynamic, String, "CastGeneral", """line 135, column 13 of dart:core/string.dart: """, __x37 is String, true))(Primitive s.stringFromCharCodes(list));
30 } 25 }
31 factory String.fromCharCode(int charCode) { 26 factory String.fromCharCode(int charCode) {
32 return ((__x38) => DDC$RT.cast(__x38, dynamic, String, "CastGeneral", 27 return ((__x38) => DDC$RT.cast(__x38, dynamic, String, "CastGeneral", """line 149, column 13 of dart:core/string.dart: """, __x38 is String, true))(Primitives .stringFromCharCode(charCode));
33 """line 149, column 13 of dart:core/string.dart: """, __x38 is String,
34 true))(Primitives.stringFromCharCode(charCode));
35 } 28 }
36 factory String.fromEnvironment(String name, {String defaultValue}) { 29 factory String.fromEnvironment(String name, {
37 throw new UnsupportedError( 30 String defaultValue}
38 'String.fromEnvironment can only be used as a const constructor'); 31 ) {
32 throw new UnsupportedError('String.fromEnvironment can only be used as a const constructor');
39 } 33 }
40 String operator [](int index); 34 String operator [](int index);
41 int codeUnitAt(int index); 35 int codeUnitAt(int index);
42 int get length; 36 int get length;
43 int get hashCode; 37 int get hashCode;
44 bool operator ==(Object other); 38 bool operator ==(Object other);
45 bool endsWith(String other); 39 bool endsWith(String other);
46 bool startsWith(Pattern pattern, [int index = 0]); 40 bool startsWith(Pattern pattern, [int index = 0]);
47 int indexOf(Pattern pattern, [int start]); 41 int indexOf(Pattern pattern, [int start]);
48 int lastIndexOf(Pattern pattern, [int start]); 42 int lastIndexOf(Pattern pattern, [int start]);
49 bool get isEmpty; 43 bool get isEmpty;
50 bool get isNotEmpty; 44 bool get isNotEmpty;
51 String operator +(String other); 45 String operator +(String other);
52 String substring(int startIndex, [int endIndex]); 46 String substring(int startIndex, [int endIndex]);
53 String trim(); 47 String trim();
54 String trimLeft(); 48 String trimLeft();
55 String trimRight(); 49 String trimRight();
56 String operator *(int times); 50 String operator *(int times);
57 String padLeft(int width, [String padding = ' ']); 51 String padLeft(int width, [String padding = ' ']);
58 String padRight(int width, [String padding = ' ']); 52 String padRight(int width, [String padding = ' ']);
59 bool contains(Pattern other, [int startIndex = 0]); 53 bool contains(Pattern other, [int startIndex = 0]);
60 String replaceFirst(Pattern from, String to, [int startIndex = 0]); 54 String replaceFirst(Pattern from, String to, [int startIndex = 0]);
61 String replaceAll(Pattern from, String replace); 55 String replaceAll(Pattern from, String replace);
62 String replaceAllMapped(Pattern from, String replace(Match match)); 56 String replaceAllMapped(Pattern from, String replace(Match match));
63 List<String> split(Pattern pattern); 57 List<String> split(Pattern pattern);
64 String splitMapJoin(Pattern pattern, 58 String splitMapJoin(Pattern pattern, {
65 {String onMatch(Match match), String onNonMatch(String nonMatch)}); 59 String onMatch(Match match), String onNonMatch(String nonMatch)}
66 List<int> get codeUnits; 60 );
67 Runes get runes; 61 List<int> get codeUnits;
68 String toLowerCase(); 62 Runes get runes;
69 String toUpperCase(); 63 String toLowerCase();
64 String toUpperCase();
70 } 65 }
71 class Runes extends IterableBase<int> { 66 class Runes extends IterableBase<int> {final String string;
72 final String string; 67 Runes(this.string);
73 Runes(this.string); 68 RuneIterator get iterator => new RuneIterator(string);
74 RuneIterator get iterator => new RuneIterator(string); 69 int get last {
75 int get last { 70 if (string.length == 0) {
76 if (string.length == 0) { 71 throw new StateError('No elements.');
77 throw new StateError('No elements.'); 72 }
73 int length = string.length;
74 int code = string.codeUnitAt(length - 1);
75 if (_isTrailSurrogate(code) && string.length > 1) {
76 int previousCode = string.codeUnitAt(length - 2);
77 if (_isLeadSurrogate(previousCode)) {
78 return _combineSurrogatePair(previousCode, code);
78 } 79 }
79 int length = string.length; 80 }
80 int code = string.codeUnitAt(length - 1); 81 return code;
81 if (_isTrailSurrogate(code) && string.length > 1) { 82 }
82 int previousCode = string.codeUnitAt(length - 2); 83 }
83 if (_isLeadSurrogate(previousCode)) { 84 bool _isLeadSurrogate(int code) => (code & 0xFC00) == 0xD800;
84 return _combineSurrogatePair(previousCode, code); 85 bool _isTrailSurrogate(int code) => (code & 0xFC00) == 0xDC00;
85 } 86 int _combineSurrogatePair(int start, int end) {
86 } 87 return 0x10000 + ((start & 0x3FF) << 10) + (end & 0x3FF);
87 return code; 88 }
89 class RuneIterator implements BidirectionalIterator<int> {final String string;
90 int _position;
91 int _nextPosition;
92 num _currentCodePoint;
93 RuneIterator(String string) : this.string = string, _position = 0, _nextPositio n = 0;
94 RuneIterator.at(String string, int index) : string = string, _position = index, _nextPosition = index {
95 RangeError.checkValueInInterval(index, 0, string.length);
96 _checkSplitSurrogate(index);
97 }
98 void _checkSplitSurrogate(int index) {
99 if (index > 0 && index < string.length && _isLeadSurrogate(string.codeUnitAt(ind ex - 1)) && _isTrailSurrogate(string.codeUnitAt(index))) {
100 throw new ArgumentError('Index inside surrogate pair: $index');
101 }
102 }
103 int get rawIndex => ((__x39) => DDC$RT.cast(__x39, dynamic, int, "CastGeneral", """line 690, column 24 of dart:core/string.dart: """, __x39 is int, true))((_po sition != _nextPosition) ? _position : null);
104 void set rawIndex(int rawIndex) {
105 RangeError.checkValidIndex(rawIndex, string, "rawIndex");
106 reset(rawIndex);
107 moveNext();
108 }
109 void reset([int rawIndex = 0]) {
110 RangeError.checkValueInInterval(rawIndex, 0, string.length, "rawIndex");
111 _checkSplitSurrogate(rawIndex);
112 _position = _nextPosition = rawIndex;
113 _currentCodePoint = null;
114 }
115 int get current => DDC$RT.cast(_currentCodePoint, num, int, "CastGeneral", """l ine 727, column 23 of dart:core/string.dart: """, _currentCodePoint is int, true );
116 int get currentSize => _nextPosition - _position;
117 String get currentAsString {
118 if (_position == _nextPosition) return null;
119 if (_position + 1 == _nextPosition) return string[_position];
120 return string.substring(_position, _nextPosition);
121 }
122 bool moveNext() {
123 _position = _nextPosition;
124 if (_position == string.length) {
125 _currentCodePoint = null;
126 return false;
127 }
128 int codeUnit = string.codeUnitAt(_position);
129 int nextPosition = _position + 1;
130 if (_isLeadSurrogate(codeUnit) && nextPosition < string.length) {
131 int nextCodeUnit = string.codeUnitAt(nextPosition);
132 if (_isTrailSurrogate(nextCodeUnit)) {
133 _nextPosition = nextPosition + 1;
134 _currentCodePoint = _combineSurrogatePair(codeUnit, nextCodeUnit);
135 return true;
88 } 136 }
89 } 137 }
90 bool _isLeadSurrogate(int code) => (code & 0xFC00) == 0xD800; 138 _nextPosition = nextPosition;
91 bool _isTrailSurrogate(int code) => (code & 0xFC00) == 0xDC00; 139 _currentCodePoint = codeUnit;
92 int _combineSurrogatePair(int start, int end) { 140 return true;
93 return 0x10000 + ((start & 0x3FF) << 10) + (end & 0x3FF);
94 } 141 }
95 class RuneIterator implements BidirectionalIterator<int> { 142 bool movePrevious() {
96 final String string; 143 _nextPosition = _position;
97 int _position; 144 if (_position == 0) {
98 int _nextPosition; 145 _currentCodePoint = null;
99 num _currentCodePoint; 146 return false;
100 RuneIterator(String string) 147 }
101 : this.string = string, 148 int position = _position - 1;
102 _position = 0, 149 int codeUnit = string.codeUnitAt(position);
103 _nextPosition = 0; 150 if (_isTrailSurrogate(codeUnit) && position > 0) {
104 RuneIterator.at(String string, int index) 151 int prevCodeUnit = string.codeUnitAt(position - 1);
105 : string = string, 152 if (_isLeadSurrogate(prevCodeUnit)) {
106 _position = index, 153 _position = position - 1;
107 _nextPosition = index { 154 _currentCodePoint = _combineSurrogatePair(prevCodeUnit, codeUnit);
108 RangeError.checkValueInInterval(index, 0, string.length); 155 return true;
109 _checkSplitSurrogate(index);
110 }
111 void _checkSplitSurrogate(int index) {
112 if (index > 0 &&
113 index < string.length &&
114 _isLeadSurrogate(string.codeUnitAt(index - 1)) &&
115 _isTrailSurrogate(string.codeUnitAt(index))) {
116 throw new ArgumentError('Index inside surrogate pair: $index');
117 }
118 }
119 int get rawIndex => ((__x39) => DDC$RT.cast(__x39, dynamic, int,
120 "CastGeneral", """line 690, column 24 of dart:core/string.dart: """,
121 __x39 is int, true))((_position != _nextPosition) ? _position : null);
122 void set rawIndex(int rawIndex) {
123 RangeError.checkValidIndex(rawIndex, string, "rawIndex");
124 reset(rawIndex);
125 moveNext();
126 }
127 void reset([int rawIndex = 0]) {
128 RangeError.checkValueInInterval(rawIndex, 0, string.length, "rawIndex");
129 _checkSplitSurrogate(rawIndex);
130 _position = _nextPosition = rawIndex;
131 _currentCodePoint = null;
132 }
133 int get current => DDC$RT.cast(_currentCodePoint, num, int, "CastGeneral",
134 """line 727, column 23 of dart:core/string.dart: """,
135 _currentCodePoint is int, true);
136 int get currentSize => _nextPosition - _position;
137 String get currentAsString {
138 if (_position == _nextPosition) return null;
139 if (_position + 1 == _nextPosition) return string[_position];
140 return string.substring(_position, _nextPosition);
141 }
142 bool moveNext() {
143 _position = _nextPosition;
144 if (_position == string.length) {
145 _currentCodePoint = null;
146 return false;
147 }
148 int codeUnit = string.codeUnitAt(_position);
149 int nextPosition = _position + 1;
150 if (_isLeadSurrogate(codeUnit) && nextPosition < string.length) {
151 int nextCodeUnit = string.codeUnitAt(nextPosition);
152 if (_isTrailSurrogate(nextCodeUnit)) {
153 _nextPosition = nextPosition + 1;
154 _currentCodePoint = _combineSurrogatePair(codeUnit, nextCodeUnit);
155 return true;
156 }
157 }
158 _nextPosition = nextPosition;
159 _currentCodePoint = codeUnit;
160 return true;
161 }
162 bool movePrevious() {
163 _nextPosition = _position;
164 if (_position == 0) {
165 _currentCodePoint = null;
166 return false;
167 }
168 int position = _position - 1;
169 int codeUnit = string.codeUnitAt(position);
170 if (_isTrailSurrogate(codeUnit) && position > 0) {
171 int prevCodeUnit = string.codeUnitAt(position - 1);
172 if (_isLeadSurrogate(prevCodeUnit)) {
173 _position = position - 1;
174 _currentCodePoint = _combineSurrogatePair(prevCodeUnit, codeUnit);
175 return true;
176 }
177 }
178 _position = position;
179 _currentCodePoint = codeUnit;
180 return true;
181 } 156 }
182 } 157 }
158 _position = position;
159 _currentCodePoint = codeUnit;
160 return true;
161 }
162 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698