dart-lang / dart-lang/webdev

Debugger shows multiple versions of a shadowed variable in locals when running on the web

Open
#2,341 0 comments 0 reactions 0 assignees View on GitHub
P3 package:dwds triaged
Dominant language
Dart
Stars
224
Forks
94
Avg merge
4d 3h
Merged PRs (30d)
2

Description

When debugging with vscode.
```dart
main() {
var x = 40;
if (x > 10) {
var x = 'hello';
if (x.isNotEmpty) {
var x = Duration.zero;
print(x);
}
}
}
```

Observe the local variables in the debugger pane.

VM:
Screenshot 2024-01-12 at 3 16 54 PM

Web:
Screenshot 2024-01-12 at 3 13 59 PM

Getting the shadowed variable using expression evaluation works as expected though.

Contributor guide

Open the contributing guide

Research direction

Reproduce the nested shadowing example in VS Code and compare the VM and web debugger locals panes, then trace the web debugger's local-variable handling. No source file or test is named in the issue. Done means the web locals present the shadowed variables consistently with the expected debugger behavior while expression evaluation continues to work.

Written by the indexing model from the issue text.

Assessment

Tech stack
dart, vscode
Domain
devtools, web-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.