sdk icon indicating copy to clipboard operation
sdk copied to clipboard

[Wildcard Variables] Web debugging support

Open kallentu opened this issue 1 year ago • 3 comments

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

kallentu avatar May 16 '24 21:05 kallentu

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

  • wildcard locals would have to be filtered out when sending information about local variables to the client as part of the vm service reply

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

a-siva avatar Jun 24 '24 21:06 a-siva

@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

nshahan avatar Jun 28 '24 20:06 nshahan

@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 avatar Jun 28 '24 20:06 kallentu

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 avatar Jul 31 '24 16:07 kallentu

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.

kallentu avatar Jul 31 '24 16:07 kallentu

Looks like wildcards are being hidden correctly on web:

image

bkonyi avatar Aug 19 '24 18:08 bkonyi