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

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

Issue 9387007: Make lists parsed by JSON untyped. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 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 | « 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) 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 397 matching lines...) Expand 10 before | Expand all | Expand 10 after
408 token = _tokenizer.next(); 408 token = _tokenizer.next();
409 final value = _parseValue(token); 409 final value = _parseValue(token);
410 410
411 object[key] = value; 411 object[key] = value;
412 }); 412 });
413 413
414 return object; 414 return object;
415 } 415 }
416 416
417 _parseList() { 417 _parseList() {
418 List<Object> list = new List<Object>(); 418 List list = new List();
antonm 2012/02/14 12:30:55 actually, I wrote this code. This days I would wr
Anders Johnsen 2012/02/14 12:48:04 I'm fine with "var list = []"! Right now, the lis
antonm 2012/02/14 13:04:06 I too prefer []/{}, but curious: I thought that Li
Anders Johnsen 2012/02/14 13:13:14 List<double> myList = fromJson["list"]; // of type
419 419
420 _parseSequence(JsonToken.RBRACKET, (JsonToken token) { 420 _parseSequence(JsonToken.RBRACKET, (JsonToken token) {
421 final value = _parseValue(token); 421 final value = _parseValue(token);
422 list.add(value); 422 list.add(value);
423 }); 423 });
424 424
425 return list; 425 return list;
426 } 426 }
427 427
428 void _parseSequence(int endTokenKind, void parseElement(JsonToken token)) { 428 void _parseSequence(int endTokenKind, void parseElement(JsonToken token)) {
(...skipping 163 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 | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698