Skip to content

fix js-interop tearoffs and optional arguments #25759

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
sigmundch opened this issue Feb 11, 2016 · 3 comments
Open

fix js-interop tearoffs and optional arguments #25759

sigmundch opened this issue Feb 11, 2016 · 3 comments
Assignees
Labels
area-web-js Issues related to JavaScript support for Dart Web, including DDC, dart2js, and JS interop. web-dart2js web-js-interop Issues that impact all js interop

Comments

@sigmundch
Copy link
Member

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:

  • if no default value is specified, omit the argument (like today)
  • if a default value is specified, include it in the call (making direct calls and tearoffs consistent).
  • add a hint/warning that you most likely don't want to specify these default values in the first place
@sigmundch sigmundch added web-dart2js web-js-interop Issues that impact all js interop labels Feb 11, 2016
@sigmundch sigmundch changed the title js-interop tearoffs and optional arguments fix js-interop tearoffs and optional arguments Feb 11, 2016
@jacob314
Copy link
Member

We need to make this an error.

@sigmundch
Copy link
Member Author

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
Copy link
Member

Yep added #25768

@jacob314 jacob314 self-assigned this Jul 7, 2016
@jacob314 jacob314 mentioned this issue Jul 8, 2016
19 tasks
@vsmenon vsmenon added the area-web-js Issues related to JavaScript support for Dart Web, including DDC, dart2js, and JS interop. label Jul 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-web-js Issues related to JavaScript support for Dart Web, including DDC, dart2js, and JS interop. web-dart2js web-js-interop Issues that impact all js interop
Projects
None yet
Development

No branches or pull requests

3 participants