js_facade_gen icon indicating copy to clipboard operation
js_facade_gen copied to clipboard

`maybeEmitFakeConstructor` considered harmful

Open ditman opened this issue 5 years ago • 8 comments

Generated fakeConstructor$ do not work and can't be called in dart2js, hence they probably shouldn't be generated anymore.

This should be removed.

ditman avatar Mar 12 '20 21:03 ditman

cc/ @natebosch who knows way more about this than I do.

ditman avatar Mar 12 '20 21:03 ditman

This is a PR where the autogenerated code had to be removed: https://github.com/flutter/plugins/pull/2602

ditman avatar Mar 12 '20 21:03 ditman

I have never seen the errors this code claims to solve. @jacob314 - do you know the specifics? How can I repro?

My first preference would be to remove this altogether, I don't understand the problem it solves.

If we can't remove this altogether we can consider adding an external keyword.

natebosch avatar Mar 12 '20 21:03 natebosch

they were never intended to be called. They were only around to placate the anlayzer for the hard to predict cases where you had a sublcass with a constructor but the base class didn't have the appropriate constructor. I forget the exact details.

jacob314 avatar Mar 12 '20 21:03 jacob314

Let's drop them. I haven't seen a case where they are necessary. If someone complains we can revisit.

natebosch avatar Mar 12 '20 21:03 natebosch

sgtm

jacob314 avatar Mar 12 '20 21:03 jacob314

I can get this done tomorrow. I think I'm one of the main users of the script for now :P

ditman avatar Mar 12 '20 21:03 ditman

Happy to review any PR requests you send my way :)

jacob314 avatar Mar 13 '20 19:03 jacob314