dev_compiler icon indicating copy to clipboard operation
dev_compiler copied to clipboard

extension method (or all List?) tear offs are broken

Open jmesserly opened this issue 10 years ago • 1 comments

e.g. this call site:

let list = [];
dart.dsend(f(), 'forEach', dart.bind(list, dartx.add));

Here list is just a normal array. It assets in dart.bind because it couldn't find the type info using the symbol as lookup key. Not sure if it would've worked with 'add' ... if I try:

_methodSig // verify this is in scope: Symbol(sig)
obj.__proto__.constructor[_methodSig]

where obj is list, it still doesn't find anything, so maybe we just have no signatures for JsArray methods?

jmesserly avatar Jul 24 '15 22:07 jmesserly

btw, the code came from here in async_star_test.dart:


    test("call delays", () {
      var list = [];
      f() async* { list.add(1); yield 2; }
      var res = f().forEach(list.add);
      list.add(0);
      return res.whenComplete(() {
        expect(list, equals([0, 1, 2]));
      });
    });

jmesserly avatar Jul 24 '15 22:07 jmesserly