-
Notifications
You must be signed in to change notification settings - Fork 1.7k
[Wildcard Variables] DDC Implementation #55751
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
Comments
Thanks @kallentu
|
Depending on how the CFE lowers the wildcards, and how we want them to appear (or not appear) in the debugger there could likely be some collaboration needed between DDC and DWDS to get it working. |
If there's work for web debugging, I've created an issue to track that: #55752 |
I was under the assumption that the spec specified that wildcard variables won't be bound to a variable and that there will be no way to reference them. Is that not the case? Regardless, I don't think we want them to appear in the debugger, especially since we can have multiple wildcard variables in the same scope. |
Correct - I think the nuance here is that in the code we emit in JavaScript we need to introduce a placeholder name to generate a valid function signature. While our intent was to eventually make dwds model all of its state based on what we know from the dart program, there were cases in the past where it created its internal model based on the Chrome debugger's state of the application. If that is still the case today, we may need to do some work to ensure those synthetic variables are properly ignored/hidden. |
This test is now causing a compiler crash. The error makes it appear that the wildcard variable isn't being given a unique name by the CFE but I'm not sure because it is also touching some of the newly added async logic. Could one of you investigate? |
I think the new async logic just changed the error produced. I haven't pushed the CL to make the names unique yet: https://dart-review.googlesource.com/c/sdk/+/373621 I'll submit it today though. |
I've submitted it now. I'll take a look at test results once they come in. |
Yes, I saw this before I submitted. This was a RuntimeError before, we didn't have anything in the compiler that checked the uniqueness of names within a scope. So the test would compile fine and then throw when the JS got parsed since there was code of the form: Since the new async transform does some funky stuff with scopes and variable declarations, I added an assertion that now catches illegal declarations like that. So now it's a compile time error with compiler assertions on. Thanks for the fix Kallen! |
1d52761 is submitted now. Seemed to land okay and the tests on DDC are now passing. The CFE implementation is now done and if there's anything left for dart2js, ddc, you're free to run with it. |
And with this issue, is there any more work that needs to be done in DDC? Can we close the issue or are we still evaluating? |
Thanks Kallen! We should just verify the behavior of these wildcard variables in the debugger. I think the thing to do here is to hide them but I'm guessing that's not happening by default. I know there is some subset of synthesized variables that the debugger is already hiding by prefixing the variable name with a specific string. We can probably just use a similar pattern here. |
Thanks for checking Ben! Do we want to:
|
I'm surprised that this regex isn't catching these but maybe I'm misunderstanding how it is used. |
The VM actually marks these variables as invisible based on a flag provided in the kernel, so we don't rely on any sort of prefix to filter these variables out. However, I think we'll need to take the prefix approach for DWDS since we won't have access to the kernel. As long as we don't send the variables in service protocol responses, the implementation details shouldn't matter too much. |
I'm wondering if some of Kallen's changes hadn't rolled through to Flutter last time I tried this, but it looks like we're correctly omitting these variables for web applications now: ![]() |
Thanks @bkonyi! I'm going to close this out as work complete with no more known work expected. Anything that comes up now should be considered a bug. |
This issue tracks the work needed for the wildcard variables feature to be supported in DDC.
Spec: https://github.com/dart-lang/language/blob/main/working/wildcards/feature-specification.md
We may need to do some additional work to support multiple wildcard parameters in functions.
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.
The text was updated successfully, but these errors were encountered: