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

Side by Side Diff: sdk/lib/json/json.dart

Issue 12089066: Fix various warnings from the analyzer. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 10 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 | « sdk/lib/core/date_time.dart ('k') | sdk/lib/math/random.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 library dart.json; 5 library dart.json;
6 6
7 // JSON parsing and serialization. 7 // JSON parsing and serialization.
8 8
9 /** 9 /**
10 * Error thrown by JSON serialization if an object cannot be serialized. 10 * Error thrown by JSON serialization if an object cannot be serialized.
(...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after
500 switch (char) { 500 switch (char) {
501 case CHAR_b: char = BACKSPACE; break; 501 case CHAR_b: char = BACKSPACE; break;
502 case CHAR_f: char = FORM_FEED; break; 502 case CHAR_f: char = FORM_FEED; break;
503 case CHAR_n: char = NEWLINE; break; 503 case CHAR_n: char = NEWLINE; break;
504 case CHAR_r: char = CARRIAGE_RETURN; break; 504 case CHAR_r: char = CARRIAGE_RETURN; break;
505 case CHAR_t: char = TAB; break; 505 case CHAR_t: char = TAB; break;
506 case SLASH: 506 case SLASH:
507 case BACKSLASH: 507 case BACKSLASH:
508 case QUOTE: 508 case QUOTE:
509 break; 509 break;
510 case CHAR_u: { 510 case CHAR_u:
511 int hexStart = position - 1; 511 int hexStart = position - 1;
512 int value = 0; 512 int value = 0;
513 for (int i = 0; i < 4; i++) { 513 for (int i = 0; i < 4; i++) {
514 position++; 514 position++;
515 if (position == source.length) { 515 if (position == source.length) {
516 fail(start - 1, "Unterminated string"); 516 fail(start - 1, "Unterminated string");
517 } 517 }
518 char = source.charCodeAt(position); 518 char = source.charCodeAt(position);
519 char -= 0x30; 519 char -= 0x30;
520 if (char < 0) fail(hexStart, "Invalid unicode escape"); 520 if (char < 0) fail(hexStart, "Invalid unicode escape");
521 if (char < 10) { 521 if (char < 10) {
522 value = value * 16 + char; 522 value = value * 16 + char;
523 } else { 523 } else {
524 char = (char | 0x20) - 0x31; 524 char = (char | 0x20) - 0x31;
525 if (char < 0 || char > 5) { 525 if (char < 0 || char > 5) {
526 fail(hexStart, "Invalid unicode escape"); 526 fail(hexStart, "Invalid unicode escape");
527 } 527 }
528 value = value * 16 + char + 10; 528 value = value * 16 + char + 10;
529 } 529 }
530 } 530 }
531 char = value; 531 char = value;
532 break; 532 break;
533 }
534 default: 533 default:
535 if (char < SPACE) fail(position, "Control character in string"); 534 if (char < SPACE) fail(position, "Control character in string");
536 fail(position, "Unrecognized string escape"); 535 fail(position, "Unrecognized string escape");
537 } 536 }
538 do { 537 do {
539 chars.add(char); 538 chars.add(char);
540 position++; 539 position++;
541 if (position == source.length) fail(start - 1, "Unterminated string"); 540 if (position == source.length) fail(start - 1, "Unterminated string");
542 char = source.charCodeAt(position); 541 char = source.charCodeAt(position);
543 if (char == QUOTE) { 542 if (char == QUOTE) {
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
796 first = false; 795 first = false;
797 }); 796 });
798 sb.add('}'); 797 sb.add('}');
799 seen.removeLast(); 798 seen.removeLast();
800 return true; 799 return true;
801 } else { 800 } else {
802 return false; 801 return false;
803 } 802 }
804 } 803 }
805 } 804 }
OLDNEW
« no previous file with comments | « sdk/lib/core/date_time.dart ('k') | sdk/lib/math/random.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698