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

Side by Side Diff: sdk/lib/_internal/compiler/js_lib/convert_patch.dart

Issue 1181003005: Use ArgumentError.value in more places in js_lib. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years, 6 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 | sdk/lib/_internal/compiler/js_lib/core_patch.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) 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 argumentErrorValue, 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;
11 import 'dart:collection' show Maps, LinkedHashMap; 11 import 'dart:collection' show Maps, LinkedHashMap;
12 12
13 /** 13 /**
14 * Parses [json] and builds the corresponding parsed JSON value. 14 * Parses [json] and builds the corresponding parsed JSON value.
15 * 15 *
16 * Parsed JSON values Nare of the types [num], [String], [bool], [Null], 16 * Parsed JSON values Nare of the types [num], [String], [bool], [Null],
17 * [List]s of parsed JSON values or [Map]s from [String] to parsed 17 * [List]s of parsed JSON values or [Map]s from [String] to parsed
18 * JSON values. 18 * JSON values.
19 * 19 *
20 * The optional [reviver] function, if provided, is called once for each object 20 * The optional [reviver] function, if provided, is called once for each object
21 * or list property parsed. The arguments are the property name ([String]) or 21 * or list property parsed. The arguments are the property name ([String]) or
22 * list index ([int]), and the value is the parsed value. The return value of 22 * list index ([int]), and the value is the parsed value. The return value of
23 * the reviver will be used as the value of that property instead of the parsed 23 * the reviver will be used as the value of that property instead of the parsed
24 * value. The top level value is passed to the reviver with the empty string as 24 * value. The top level value is passed to the reviver with the empty string as
25 * a key. 25 * a key.
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 argumentErrorValue(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 '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
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after
401 return super.fuse(next); 401 return super.fuse(next);
402 } 402 }
403 403
404 // Currently not intercepting UTF8 decoding. 404 // Currently not intercepting UTF8 decoding.
405 @patch 405 @patch
406 static String _convertIntercepted(bool allowMalformed, List<int> codeUnits, 406 static String _convertIntercepted(bool allowMalformed, List<int> codeUnits,
407 int start, int end) { 407 int start, int end) {
408 return null; // This call was not intercepted. 408 return null; // This call was not intercepted.
409 } 409 }
410 } 410 }
OLDNEW
« no previous file with comments | « no previous file | sdk/lib/_internal/compiler/js_lib/core_patch.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698