OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 file for dart:convert library. | 5 // Patch file for dart:convert library. |
6 | 6 |
7 import 'dart:_js_helper' show patch; | 7 import 'dart:_js_helper' show patch; |
8 import 'dart:_foreign_helper' show JS; | 8 import 'dart:_foreign_helper' show JS; |
9 import 'dart:_interceptors' show JSExtendableArray; | 9 import 'dart:_interceptors' show JSExtendableArray; |
10 import 'dart:_internal' show MappedIterable, ListIterable; | 10 import 'dart:_internal' show MappedIterable, ListIterable; |
(...skipping 15 matching lines...) Expand all Loading... |
26 * | 26 * |
27 * Throws [FormatException] if the input is not valid JSON text. | 27 * Throws [FormatException] if the input is not valid JSON text. |
28 */ | 28 */ |
29 @patch | 29 @patch |
30 _parseJson(String source, reviver(key, value)) { | 30 _parseJson(String source, reviver(key, value)) { |
31 if (source is! String) throw new ArgumentError(source); | 31 if (source is! String) throw new ArgumentError(source); |
32 | 32 |
33 var parsed; | 33 var parsed; |
34 try { | 34 try { |
35 parsed = JS('=Object|JSExtendableArray|Null|bool|num|String', | 35 parsed = JS('=Object|JSExtendableArray|Null|bool|num|String', |
36 'JSON.parse(#)', | 36 'dart.global.JSON.parse(#)', |
37 source); | 37 source); |
38 } catch (e) { | 38 } catch (e) { |
39 throw new FormatException(JS('String', 'String(#)', e)); | 39 throw new FormatException(JS('String', 'String(#)', e)); |
40 } | 40 } |
41 | 41 |
42 if (reviver == null) { | 42 if (reviver == null) { |
43 return _convertJsonToDartLazy(parsed); | 43 return _convertJsonToDartLazy(parsed); |
44 } else { | 44 } else { |
45 return _convertJsonToDart(parsed, reviver); | 45 return _convertJsonToDart(parsed, reviver); |
46 } | 46 } |
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
394 _sink.close(); | 394 _sink.close(); |
395 } | 395 } |
396 } | 396 } |
397 | 397 |
398 @patch class Utf8Decoder { | 398 @patch class Utf8Decoder { |
399 @patch | 399 @patch |
400 Converter<List<int>,dynamic> fuse(Converter<String, dynamic> next) { | 400 Converter<List<int>,dynamic> fuse(Converter<String, dynamic> next) { |
401 return super.fuse(next); | 401 return super.fuse(next); |
402 } | 402 } |
403 } | 403 } |
OLD | NEW |