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

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

Issue 17301008: Remove =List in JS, use JSExtendableArray instead. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sdk/lib/_internal/lib/js_string.dart ('k') | sdk/lib/_internal/lib/native_helper.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/_internal/lib/json_patch.dart
===================================================================
--- sdk/lib/_internal/lib/json_patch.dart (revision 24309)
+++ sdk/lib/_internal/lib/json_patch.dart (working copy)
@@ -5,6 +5,7 @@
// Patch file for dart:json library.
import 'dart:_foreign_helper' show JS;
+import 'dart:_interceptors' show JSExtendableArray;
/**
* Parses [json] and builds the corresponding parsed JSON value.
@@ -27,7 +28,9 @@
var parsed;
try {
- parsed = JS('=Object|=List|Null|bool|num|String', 'JSON.parse(#)', json);
+ parsed = JS('=Object|JSExtendableArray|Null|bool|num|String',
+ 'JSON.parse(#)',
+ json);
} catch (e) {
throw new FormatException(JS('String', 'String(#)', e));
}
@@ -54,7 +57,7 @@
// TODO(sra): Replace this test with cheaper '#.constructor === Array' when
// bug 621 below is fixed.
if (JS('bool', 'Object.getPrototypeOf(#) === Array.prototype', e)) {
- var list = JS('=List', '#', e); // Teach compiler the type is known.
+ var list = JS('JSExtendableArray', '#', e); // Teach compiler the type is known.
// In-place update of the elements since JS Array is a Dart List.
for (int i = 0; i < list.length; i++) {
// Use JS indexing to avoid range checks. We know this is the only
@@ -69,7 +72,7 @@
}
// Otherwise it is a plain Object, so copy to a Map.
- var keys = JS('=List', 'Object.keys(#)', e);
+ var keys = JS('JSExtendableArray', 'Object.keys(#)', e);
Map map = {};
for (int i = 0; i < keys.length; i++) {
String key = keys[i];
« no previous file with comments | « sdk/lib/_internal/lib/js_string.dart ('k') | sdk/lib/_internal/lib/native_helper.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698