-
Notifications
You must be signed in to change notification settings - Fork 26
Array-like types in the DOM do not support index access #173
Comments
#138 might help here. But not sure if we consider indexer methods as extension ones or not. |
what's going wrong here is a bit complex, here's some thoughts. First off, static dispatch. We never generate Here's how NodeList is defined (warning, big file: dom.dart#L10158) @JsName()
class NodeList {
external NodeList();
external num get length;
external set length(num _);
external Node item(num index);
external Node operator [](num index);
external void operator []=(num index, Node);
} if we statically know it's a native [] operator, two options:
I'd lean towards the latter. Compiler shouldn't make up a bounds check function without user asking for it. That said, we could make something that a type can opt-in to, and perhaps use that in |
Another wrinkle: for the dart:core types, we want to assume that all methods will be Dart defined, and native methods are all hidden from dynamic dispatch. That is, extension methods are all or nothing as we currently use them. For dart:html types, I presume we want most native methods to appear, some hidden, and some extensions? That will make things a little more complicated. We can probably make it work though |
https://codereview.chromium.org/1145833004/ makes it possible to define native JS indexers on the |
This reverts commit 8dc1eee. Review URL: https://codereview.chromium.org/1160343003
I'm going to wait for the fix big #138 patch (https://codereview.chromium.org/1153003003/) to land and then take another look here. |
rebased against that fix, should be good to go |
When we access raw JS versions of Array-like or Dictionary-like types - NodeList, NamedNodeMap, DOMTokenList - we hit an error:
DDC generates
list.get(0)
for the above - which does not exist for these types.@jacob314
The text was updated successfully, but these errors were encountered: