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

Side by Side Diff: sdk/lib/convert/utf.dart

Issue 515183002: Make String.fromCharCodes take start/end. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Bug in dart2js version. Created 6 years, 3 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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 dart.convert; 5 part of dart.convert;
6 6
7 /** The Unicode Replacement character `U+FFFD` (�). */ 7 /** The Unicode Replacement character `U+FFFD` (�). */
8 const int UNICODE_REPLACEMENT_CHARACTER_RUNE = 0xFFFD; 8 const int UNICODE_REPLACEMENT_CHARACTER_RUNE = 0xFFFD;
9 9
10 /** The Unicode Byte Order Marker (BOM) character `U+FEFF`. */ 10 /** The Unicode Byte Order Marker (BOM) character `U+FEFF`. */
(...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after
429 for (var i = from; i < to; i++) { 429 for (var i = from; i < to; i++) {
430 final unit = units[i]; 430 final unit = units[i];
431 if ((unit & mask) != unit) return i - from; 431 if ((unit & mask) != unit) return i - from;
432 } 432 }
433 return to - from; 433 return to - from;
434 } 434 }
435 435
436 void addSingleBytes(int from, int to) { 436 void addSingleBytes(int from, int to) {
437 assert(from >= startIndex && from <= endIndex); 437 assert(from >= startIndex && from <= endIndex);
438 assert(to >= startIndex && to <= endIndex); 438 assert(to >= startIndex && to <= endIndex);
439 if (from == 0 && to == codeUnits.length) { 439 _stringSink.write(new String.fromCharCodes(codeUnits, from, to));
440 _stringSink.write(new String.fromCharCodes(codeUnits)); 440 // if (from == 0 && to == codeUnits.length) {
floitsch 2014/08/29 11:13:20 dead code?
Søren Gjesse 2014/08/29 11:16:04 Code in comment.
441 } else { 441 // _stringSink.write(new String.fromCharCodes(codeUnits));
442 _stringSink.write( 442 // } else {
443 new String.fromCharCodes(codeUnits.sublist(from, to))); 443 // _stringSink.write(
444 } 444 // new String.fromCharCodes(codeUnits.sublist(from, to)));
445 // }
445 } 446 }
446 447
447 int i = startIndex; 448 int i = startIndex;
448 loop: while (true) { 449 loop: while (true) {
449 multibyte: if (expectedUnits > 0) { 450 multibyte: if (expectedUnits > 0) {
450 do { 451 do {
451 if (i == endIndex) { 452 if (i == endIndex) {
452 break loop; 453 break loop;
453 } 454 }
454 int unit = codeUnits[i]; 455 int unit = codeUnits[i];
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
541 } 542 }
542 break loop; 543 break loop;
543 } 544 }
544 if (expectedUnits > 0) { 545 if (expectedUnits > 0) {
545 _value = value; 546 _value = value;
546 _expectedUnits = expectedUnits; 547 _expectedUnits = expectedUnits;
547 _extraUnits = extraUnits; 548 _extraUnits = extraUnits;
548 } 549 }
549 } 550 }
550 } 551 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698