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

Unified Diff: sdk/lib/_internal/lib/convert_patch.dart

Issue 23554004: Made old dart:json library use convert to parse JSON. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Addres review comments. Created 7 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/vm.gypi ('k') | sdk/lib/_internal/lib/json_patch.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/_internal/lib/convert_patch.dart
diff --git a/sdk/lib/_internal/lib/json_patch.dart b/sdk/lib/_internal/lib/convert_patch.dart
similarity index 92%
rename from sdk/lib/_internal/lib/json_patch.dart
rename to sdk/lib/_internal/lib/convert_patch.dart
index ad22ae7d1aa4d8f71b957e8076a147f697bce517..1c369e0aef9efa58c6d4610c9bb9316df4464145 100644
--- a/sdk/lib/_internal/lib/json_patch.dart
+++ b/sdk/lib/_internal/lib/convert_patch.dart
@@ -10,7 +10,7 @@ import 'dart:_interceptors' show JSExtendableArray;
/**
* Parses [json] and builds the corresponding parsed JSON value.
*
- * Parsed JSON values are of the types [num], [String], [bool], [Null],
+ * Parsed JSON values Nare of the types [num], [String], [bool], [Null],
* [List]s of parsed JSON values or [Map]s from [String] to parsed
* JSON values.
*
@@ -23,14 +23,14 @@ import 'dart:_interceptors' show JSExtendableArray;
*
* Throws [FormatException] if the input is not valid JSON text.
*/
-patch parse(String json, [reviver(var key, var value)]) {
- if (json is! String) throw new ArgumentError(json);
+patch _parseJson(String source, reviver(var key, var value)) {
+ if (source is! String) throw new ArgumentError(source);
var parsed;
try {
parsed = JS('=Object|JSExtendableArray|Null|bool|num|String',
'JSON.parse(#)',
- json);
+ source);
} catch (e) {
throw new FormatException(JS('String', 'String(#)', e));
}
@@ -90,5 +90,5 @@ _convertJsonToDart(json, reviver(key, value)) {
return map;
}
- return revive('', walk(json));
+ return revive("", walk(json));
}
« no previous file with comments | « runtime/vm/vm.gypi ('k') | sdk/lib/_internal/lib/json_patch.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698