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

Side by Side Diff: sdk/lib/_internal/js_runtime/lib/js_string.dart

Issue 2733353002: Remove U+180E from whitespace in js_runtime and tests (Closed)
Patch Set: also corelib_strong Created 3 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 // 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 part of _interceptors; 5 part of _interceptors;
6 6
7 /** 7 /**
8 * The interceptor class for [String]. The compiler recognizes this 8 * The interceptor class for [String]. The compiler recognizes this
9 * class as an interceptor, and changes references to [:this:] to 9 * class as an interceptor, and changes references to [:this:] to
10 * actually use the receiver of the method, which is generated as an extra 10 * actually use the receiver of the method, which is generated as an extra
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 'returns:String;effects:none;depends:none;throws:null(1)', 163 'returns:String;effects:none;depends:none;throws:null(1)',
164 r'#.toLowerCase()', this); 164 r'#.toLowerCase()', this);
165 } 165 }
166 166
167 String toUpperCase() { 167 String toUpperCase() {
168 return JS( 168 return JS(
169 'returns:String;effects:none;depends:none;throws:null(1)', 169 'returns:String;effects:none;depends:none;throws:null(1)',
170 r'#.toUpperCase()', this); 170 r'#.toUpperCase()', this);
171 } 171 }
172 172
173 // Characters with Whitespace property (Unicode 6.2). 173 // Characters with Whitespace property (Unicode 6.3).
174 // 0009..000D ; White_Space # Cc <control-0009>..<control-000D> 174 // 0009..000D ; White_Space # Cc <control-0009>..<control-000D>
175 // 0020 ; White_Space # Zs SPACE 175 // 0020 ; White_Space # Zs SPACE
176 // 0085 ; White_Space # Cc <control-0085> 176 // 0085 ; White_Space # Cc <control-0085>
177 // 00A0 ; White_Space # Zs NO-BREAK SPACE 177 // 00A0 ; White_Space # Zs NO-BREAK SPACE
178 // 1680 ; White_Space # Zs OGHAM SPACE MARK 178 // 1680 ; White_Space # Zs OGHAM SPACE MARK
179 // 180E ; White_Space # Zs MONGOLIAN VOWEL SEPARATOR
180 // 2000..200A ; White_Space # Zs EN QUAD..HAIR SPACE 179 // 2000..200A ; White_Space # Zs EN QUAD..HAIR SPACE
181 // 2028 ; White_Space # Zl LINE SEPARATOR 180 // 2028 ; White_Space # Zl LINE SEPARATOR
182 // 2029 ; White_Space # Zp PARAGRAPH SEPARATOR 181 // 2029 ; White_Space # Zp PARAGRAPH SEPARATOR
183 // 202F ; White_Space # Zs NARROW NO-BREAK SPACE 182 // 202F ; White_Space # Zs NARROW NO-BREAK SPACE
184 // 205F ; White_Space # Zs MEDIUM MATHEMATICAL SPACE 183 // 205F ; White_Space # Zs MEDIUM MATHEMATICAL SPACE
185 // 3000 ; White_Space # Zs IDEOGRAPHIC SPACE 184 // 3000 ; White_Space # Zs IDEOGRAPHIC SPACE
186 // 185 //
187 // BOM: 0xFEFF 186 // BOM: 0xFEFF
188 static bool _isWhitespace(int codeUnit) { 187 static bool _isWhitespace(int codeUnit) {
189 // Most codeUnits should be less than 256. Special case with a smaller 188 // Most codeUnits should be less than 256. Special case with a smaller
190 // switch. 189 // switch.
191 if (codeUnit < 256) { 190 if (codeUnit < 256) {
192 switch (codeUnit) { 191 switch (codeUnit) {
193 case 0x09: 192 case 0x09:
194 case 0x0A: 193 case 0x0A:
195 case 0x0B: 194 case 0x0B:
196 case 0x0C: 195 case 0x0C:
197 case 0x0D: 196 case 0x0D:
198 case 0x20: 197 case 0x20:
199 case 0x85: 198 case 0x85:
200 case 0xA0: 199 case 0xA0:
201 return true; 200 return true;
202 default: 201 default:
203 return false; 202 return false;
204 } 203 }
205 } 204 }
206 switch (codeUnit) { 205 switch (codeUnit) {
207 case 0x1680: 206 case 0x1680:
208 case 0x180E:
209 case 0x2000: 207 case 0x2000:
210 case 0x2001: 208 case 0x2001:
211 case 0x2002: 209 case 0x2002:
212 case 0x2003: 210 case 0x2003:
213 case 0x2004: 211 case 0x2004:
214 case 0x2005: 212 case 0x2005:
215 case 0x2006: 213 case 0x2006:
216 case 0x2007: 214 case 0x2007:
217 case 0x2008: 215 case 0x2008:
218 case 0x2009: 216 case 0x2009:
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
467 Type get runtimeType => String; 465 Type get runtimeType => String;
468 466
469 int get length => JS('int', r'#.length', this); 467 int get length => JS('int', r'#.length', this);
470 468
471 String operator [](int index) { 469 String operator [](int index) {
472 if (index is !int) throw diagnoseIndexError(this, index); 470 if (index is !int) throw diagnoseIndexError(this, index);
473 if (index >= length || index < 0) throw diagnoseIndexError(this, index); 471 if (index >= length || index < 0) throw diagnoseIndexError(this, index);
474 return JS('String', '#[#]', this, index); 472 return JS('String', '#[#]', this, index);
475 } 473 }
476 } 474 }
OLDNEW
« no previous file with comments | « no previous file | tests/corelib/corelib.status » ('j') | tests/corelib_strong/string_trim2_test.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698