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

Breakpoints don't work on wrapped variable assignments #56932

Open DanTup opened 6 hours ago

DanTup commented 6 hours ago

A change was recently made to prevent breakpoints from jumping to different lines than the one where they were added if the location was invalid (https://github.com/dart-lang/sdk/issues/56820). While I think the idea is right, it seems to have impacted some kinds of code I hadn't considered and I'm not sure it's a good experience.

Consider this code:

image

I wanted to step into ElementLocator.locate so I put a breakpoint on line 78 expecting it to be the correct one (because I wanted to stop on this statement). However, line 78 is not a valid location to stop, so now we don't pause at all and it feels like a bug.

I'm not sure I could define rules that would fix this without reverting the change for https://github.com/dart-lang/sdk/issues/56820, but perhaps someone more familiar with the internals could.

@bkonyi @derekxu16

dart-github-bot commented 6 hours ago

Summary: Breakpoints are not working on variable assignments wrapped in parentheses, preventing stepping into functions called within the assignment. This issue arises from a recent change intended to improve breakpoint behavior, but it seems to have unintended consequences for certain code patterns.