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

Side by Side Diff: client/json/dart_json.dart

Issue 9188050: TBR fix for an unresolved reference in the dartc build (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | frog/server/dart_json.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) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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("json"); 5 #library("json");
6 6
7 // Pure Dart implementation of JSON protocol. 7 // Pure Dart implementation of JSON protocol.
8 8
9 /** 9 /**
10 * Utility class to parse JSON and serialize objects to JSON. 10 * Utility class to parse JSON and serialize objects to JSON.
(...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after
506 final int length = s.length; 506 final int length = s.length;
507 bool needsEscape = false; 507 bool needsEscape = false;
508 final charCodes = new List<int>(); 508 final charCodes = new List<int>();
509 for (int i = 0; i < length; i++) { 509 for (int i = 0; i < length; i++) {
510 int charCode = s.charCodeAt(i); 510 int charCode = s.charCodeAt(i);
511 if (_needsEscape(charCode)) { 511 if (_needsEscape(charCode)) {
512 charCodes.add(JsonTokenizer.BACKSLASH); 512 charCodes.add(JsonTokenizer.BACKSLASH);
513 needsEscape = true; 513 needsEscape = true;
514 514
515 if (JsonTokenizer.NEW_LINE == charCode) { 515 if (JsonTokenizer.NEW_LINE == charCode) {
516 charCode = N_SMALL; 516 charCode = JsonTokenizer.N_SMALL;
517 } else if (JsonTokenizer.LINE_FEED == charCode) { 517 } else if (JsonTokenizer.LINE_FEED == charCode) {
518 charCode = R_SMALL; 518 charCode = JsonTokenizer.R_SMALL;
519 } 519 }
520 } 520 }
521 charCodes.add(charCode); 521 charCodes.add(charCode);
522 } 522 }
523 sb.add(needsEscape ? new String.fromCharCodes(charCodes) : s); 523 sb.add(needsEscape ? new String.fromCharCodes(charCodes) : s);
524 } 524 }
525 525
526 void _checkCycle(final object) { 526 void _checkCycle(final object) {
527 // TODO: use Iterables. 527 // TODO: use Iterables.
528 for (int i = 0; i < _seen.length; i++) { 528 for (int i = 0; i < _seen.length; i++) {
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
592 }); 592 });
593 _sb.add('}'); 593 _sb.add('}');
594 _seen.removeLast(); 594 _seen.removeLast();
595 return; 595 return;
596 596
597 default: 597 default:
598 throw const JsonUnsupportedObjectType(); 598 throw const JsonUnsupportedObjectType();
599 } 599 }
600 } 600 }
601 } 601 }
OLDNEW
« no previous file with comments | « no previous file | frog/server/dart_json.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698