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..f58e5742abb09a3bfe4b43dc620608abbe104b90 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); |
| + List copy = JS('List', '#', readSlot(slot)); |
|
vsm
2017/02/01 18:37:13
var copy = JS('List', ...)
should get handled the
Jacob
2017/02/01 20:33:48
Done.
|
| 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); |
|
Jacob
2017/02/01 02:17:39
This is a fairly frequently called helper so elimi
|
| + var slot = findSlot(l); |
| + List copy = JS('', '#', 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; |
| } |