dart-lang / sdk

The Dart SDK, including the VM, JS and Wasm compilers, analysis, core libraries, and more.
https://dart.dev
BSD 3-Clause "New" or "Revised" License
10.07k stars 1.56k forks source link

fix js-interop tearoffs and optional arguments #25759

Open sigmundch opened 8 years ago

sigmundch commented 8 years ago

The current behavior in the new js-interop is to omit default arguments that were not specified when making an interop call. This is so that the JS side can fill in default values. The SSA implementation does this even when default values are specified. This doesn't work however when using a tearoff of the function: in that case we do include the default arguments (in dart2js).

It might be possible to fix tearoffs, but the behavior might still be confusing. @jacob314 - what do you think about changing things as follows:

jacob314 commented 8 years ago

We need to make this an error.

sigmundch commented 8 years ago

sounds good to make it an error - in Dartium, we likely want to pass the arguments that have a default value so that the default behavior is consistent (if users choose to ignore the error message).

Should we file a separate bug for dartium on this?

jacob314 commented 8 years ago

Yep added https://github.com/dart-lang/sdk/issues/25768