Chromium Code Reviews| Index: pkg/dev_compiler/tool/input_sdk/lib/html/html_common/conversions.dart |
| diff --git a/pkg/dev_compiler/tool/input_sdk/lib/html/html_common/conversions.dart b/pkg/dev_compiler/tool/input_sdk/lib/html/html_common/conversions.dart |
| index de0d423258d971447938882f573cc9e49e86fd09..c12dc5d73f4bfedaedb93e0f91f2a0b5052c9058 100644 |
| --- a/pkg/dev_compiler/tool/input_sdk/lib/html/html_common/conversions.dart |
| +++ b/pkg/dev_compiler/tool/input_sdk/lib/html/html_common/conversions.dart |
| @@ -76,7 +76,7 @@ abstract class _StructuredClone { |
| cleanupSlots() {} // Will be needed if we mark objects with a property. |
| bool cloneNotRequired(object); |
| newJsMap(); |
| - newJsList(length); |
| + List newJsList(length); |
| void putIntoMap(map, key, value); |
| // Returns the input, or a clone of the input. |
| @@ -127,7 +127,7 @@ abstract class _StructuredClone { |
| // non-native properties or methods from interceptors and such, e.g. |
| // an immutability marker. So we had to stop doing that. |
| var slot = findSlot(e); |
| - var copy = readSlot(slot); |
| + var copy = JS('List', '#', readSlot(slot)); |
| if (copy != null) return copy; |
| copy = copyList(e, slot); |
| return copy; |
| @@ -136,7 +136,7 @@ abstract class _StructuredClone { |
| throw new UnimplementedError('structured clone of other type'); |
| } |
| - copyList(List e, int slot) { |
| + List copyList(List e, int slot) { |
| int i = 0; |
| int length = e.length; |
| var copy = newJsList(length); |
| @@ -196,11 +196,11 @@ abstract class _AcceptStructuredClone { |
| writeSlot(int i, x) { copies[i] = x; } |
| /// Iterate over the JS properties. |
| - forEachJsField(object, action); |
| + forEachJsField(object, action(key, value)); |
| /// Create a new Dart list of the given length. May create a native List or |
| /// a JsArray, depending if we're in Dartium or dart2js. |
| - newDartList(length); |
| + List newDartList(length); |
| walk(e) { |
| if (e == null) return e; |
| @@ -235,18 +235,19 @@ abstract class _AcceptStructuredClone { |
| } |
| if (isJavaScriptArray(e)) { |
| - var slot = findSlot(e); |
| - var copy = readSlot(slot); |
| + List l = JS('', '#', e); |
|
vsm
2017/02/01 20:59:43
should be able to move the type to the right here
Jacob
2017/02/01 21:26:45
Done.
|
| + var slot = findSlot(l); |
| + var copy = JS('List', '#', readSlot(slot)); |
| if (copy != null) return copy; |
| - int length = e.length; |
| + int length = l.length; |
| // Since a JavaScript Array is an instance of Dart List, we can modify it |
| // in-place unless we must copy. |
| - copy = mustCopy ? newDartList(length) : e; |
| + copy = mustCopy ? newDartList(length) : l; |
| writeSlot(slot, copy); |
| for (int i = 0; i < length; i++) { |
| - copy[i] = walk(e[i]); |
| + copy[i] = walk(l[i]); |
| } |
| return copy; |
| } |