Skip to content

[Wildcard Variables] Dart2JS Implementation #55750

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

Closed
Tracked by #55673
kallentu opened this issue May 16, 2024 · 3 comments
Closed
Tracked by #55673

[Wildcard Variables] Dart2JS Implementation #55750

kallentu opened this issue May 16, 2024 · 3 comments
Assignees
Labels
area-web-js Issues related to JavaScript support for Dart Web, including DDC, dart2js, and JS interop. feature-wildcard-variables Implementation of the wildcard variables feature web-dart2js

Comments

@kallentu
Copy link
Member

This issue tracks the work needed for the wildcard variables feature to be supported in Dart2JS.

We may need to do some additional work to support multiple wildcard parameters in functions.

class A {
  int add(int a, int b) => 3;
}

class C implements A {
  int add(int _, int _) => 3;
}

cc. @sigmundch Feel free to tag or reassign as you see fit.
I'd also appreciate more details so we don't lose that context.

@kallentu kallentu added the area-web-js Issues related to JavaScript support for Dart Web, including DDC, dart2js, and JS interop. label May 16, 2024
@sigmundch
Copy link
Member

Thanks @kallentu, similar comments to what I posted in the DDC issue:

  • the work here depends a lot on what kind of lowering we end up doing in the CFE
  • the lowering will likely convert the wildcard variables into something, potentially a variable declaration that is never read.
  • if the lowering uses the existing representation of variable declarations and guarantees uniqueness of variable names like today parameters have, then the backend may not need to do anything special for it to generate valid JavaScript. However, if the variable is represented by a new kernel node or a node that breaks current invariants, we may need some relatively small amount of work to emit valid JavaScript function declarations. The work could be similar to what DDC already does for temporary variables in Let expressions.

@kallentu kallentu added the feature-wildcard-variables Implementation of the wildcard variables feature label May 17, 2024
@kallentu
Copy link
Member Author

kallentu commented Aug 9, 2024

Following up, is there any work to be done here? Could we close this ticket for Dart2JS?
cc @sigmundch @natebiggs

@biggs0125
Copy link

It looks like all the dart2js tests are passing. I think with your change to add the unique names, dart2js should be good to go. Closing this out.

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. feature-wildcard-variables Implementation of the wildcard variables feature web-dart2js
Projects
None yet
Development

No branches or pull requests

3 participants