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

Side by Side Diff: pkg/fasta/lib/src/quote.dart

Issue 2642763007: Fix bad refactoring in quote.dart. (Closed)
Patch Set: Created 3 years, 11 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
« no previous file with comments | « no previous file | no next file » | 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) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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 library fasta.quote; 5 library fasta.quote;
6 6
7 import 'errors.dart' show 7 import 'errors.dart' show
8 inputError, 8 inputError,
9 internalError; 9 internalError;
10 10
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 code = 0; 211 code = 0;
212 for (int j = 0; j < 7; j++) { 212 for (int j = 0; j < 7; j++) {
213 if (codeUnits.length == ++i) return error(i, incompleteSequence); 213 if (codeUnits.length == ++i) return error(i, incompleteSequence);
214 int digit = codeUnits[i]; 214 int digit = codeUnits[i];
215 if (j != 0 && digit == $CLOSE_CURLY_BRACKET) break; 215 if (j != 0 && digit == $CLOSE_CURLY_BRACKET) break;
216 if (!isHexDigit(digit)) return error(i, invalidCharacter); 216 if (!isHexDigit(digit)) return error(i, invalidCharacter);
217 code = (code << 4) + hexDigitValue(digit); 217 code = (code << 4) + hexDigitValue(digit);
218 } 218 }
219 } else { 219 } else {
220 // Expect exactly 4 hex digits. 220 // Expect exactly 4 hex digits.
221 if (codeUnits.length < i + 4) return error(i, incompleteSequence); 221 if (codeUnits.length <= i + 4) return error(i, incompleteSequence);
222 code = 0; 222 code = 0;
223 for (int j = 0; j < 4; j++) { 223 for (int j = 0; j < 4; j++) {
224 int digit = codeUnits[i]; 224 int digit = codeUnits[++i];
225 if (!isHexDigit(digit)) return error(i, invalidCharacter); 225 if (!isHexDigit(digit)) return error(i, invalidCharacter);
226 code = (code << 4) + hexDigitValue(digit); 226 code = (code << 4) + hexDigitValue(digit);
227 } 227 }
228 } 228 }
229 } else { 229 } else {
230 // Nothing, escaped character is passed through; 230 // Nothing, escaped character is passed through;
231 } 231 }
232 if (code > 0x10FFFF) return error(i, invalidCodePoint); 232 if (code > 0x10FFFF) return error(i, invalidCodePoint);
233 } 233 }
234 result[resultOffset++] = code; 234 result[resultOffset++] = code;
235 } 235 }
236 return new String.fromCharCodes(result, 0, resultOffset); 236 return new String.fromCharCodes(result, 0, resultOffset);
237 } 237 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698