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.11k stars 1.57k forks source link

[Wildcard Variables] Web debugging support #55752

Closed kallentu closed 1 month ago

kallentu commented 4 months ago

This issue tracks the web debugging support needed for the wildcards feature.

References

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.

Originally posted by @sigmundch in #55751

cc. @nshahan @bkonyi

a-siva commented 3 months ago

One potential work item that came up from the discussion between the VM and CFE team this afternoon

It is possible something similar would be needed on the web side too.

nshahan commented 3 months ago

@kallentu It will be helpful if the CFE can provide predicates to identify which variables are created by the lowering for wildcards. We already have other predicates for other lowerings in this file: https://github.com/dart-lang/sdk/blob/main/pkg/front_end/lib/src/api_prototype/lowering_predicates.dart

kallentu commented 3 months ago

@kallentu It will be helpful if the CFE can provide predicates to identify which variables are created by the lowering for wildcards. We already have other predicates for other lowerings in this file: https://github.com/dart-lang/sdk/blob/main/pkg/front_end/lib/src/api_prototype/lowering_predicates.dart

Noted. Haven't changed CFE to have unique lowered names yet. I'll comment on this issue again when I make progress.

kallentu commented 2 months ago

The CL that lowers wildcard variable names into unique names https://github.com/dart-lang/sdk/commit/1d527619505dbce25a2822951f84294a14584b57 has now been submitted.

https://github.com/dart-lang/sdk/blob/main/pkg/front_end/lib/src/kernel/wildcard_lowering.dart are where the wildcard predicates and name conversions are located.

These predicates are exported by https://github.com/dart-lang/sdk/blob/main/pkg/front_end/lib/src/api_prototype/lowering_predicates.dart so you should get them if you already import this file.

kallentu commented 2 months ago

Let me know if you need anything else or anything should be changed. Happy to do so.

Otherwise, CFE implementation is complete and ready for any web debugging work.

bkonyi commented 1 month ago

Looks like wildcards are being hidden correctly on web:

image