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

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

Issue 608213002: Fix bad call of RangeError.value in String.fromCharCodes. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 2 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
« no previous file with comments | « no previous file | sdk/lib/_internal/compiler/js_lib/core_patch.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 [int start = 0, int end]) { 7 [int start = 0, int end]) {
8 return _StringBase.createFromCharCodes(charCodes, start, end); 8 return _StringBase.createFromCharCodes(charCodes, start, end);
9 } 9 }
10 10
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 bool isOneByteString = false; 62 bool isOneByteString = false;
63 if ((ccid != ClassID.cidArray) && 63 if ((ccid != ClassID.cidArray) &&
64 (ccid != ClassID.cidGrowableObjectArray) && 64 (ccid != ClassID.cidGrowableObjectArray) &&
65 (ccid != ClassID.cidImmutableArray)) { 65 (ccid != ClassID.cidImmutableArray)) {
66 if (charCodes is Uint8List) { 66 if (charCodes is Uint8List) {
67 isOneByteString = true; 67 isOneByteString = true;
68 } else { 68 } else {
69 // Treat charCodes as Iterable. 69 // Treat charCodes as Iterable.
70 if (start < 0) throw new RangeError.range(start, 0, charCodes.length); 70 if (start < 0) throw new RangeError.range(start, 0, charCodes.length);
71 if (end != null && end < start) { 71 if (end != null && end < start) {
72 throw new RangeError.value(end, start, charCodes.length); 72 throw new RangeError.range(end, start, charCodes.length);
73 } 73 }
74 var it = charCodes.iterator; 74 var it = charCodes.iterator;
75 for (int i = 0; i < start; i++) { 75 for (int i = 0; i < start; i++) {
76 if (!it.moveNext()) { 76 if (!it.moveNext()) {
77 throw new RangeError.range(start, 0, i); 77 throw new RangeError.range(start, 0, i);
78 } 78 }
79 } 79 }
80 int bits = 0; // Bitwise or of all char codes in list. 80 int bits = 0; // Bitwise or of all char codes in list.
81 var list = []; 81 var list = [];
82 if (end == null) { 82 if (end == null) {
(...skipping 984 matching lines...) Expand 10 before | Expand all | Expand 10 after
1067 class _CodeUnits extends Object with ListMixin<int>, 1067 class _CodeUnits extends Object with ListMixin<int>,
1068 UnmodifiableListMixin<int> { 1068 UnmodifiableListMixin<int> {
1069 /** The string that this is the code units of. */ 1069 /** The string that this is the code units of. */
1070 String _string; 1070 String _string;
1071 1071
1072 _CodeUnits(this._string); 1072 _CodeUnits(this._string);
1073 1073
1074 int get length => _string.length; 1074 int get length => _string.length;
1075 int operator[](int i) => _string.codeUnitAt(i); 1075 int operator[](int i) => _string.codeUnitAt(i);
1076 } 1076 }
OLDNEW
« no previous file with comments | « no previous file | sdk/lib/_internal/compiler/js_lib/core_patch.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698