Fixing debugger inspector that wasn't updating when the debugger entered a new optimized scope #472
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #450 .
When the debugger entered/left an inlined block with a step, the debugger inspector wouldn't update. As a consequence, if new temporaries were declared in this optimized scope, their values wouldn't be displayed in the inspector (unless this context was deselected and then selected again in the stack).
To fix that, in the debugger action model, before performing a step I store the AST scope of the context we step into/over/through.
Then, after updating the stack of the
StDebugger
, I compare if the interrupted context after stepping is still the context that was selected before stepping. If this is the case, I ask the raw inspection presenter to update its nodes from the old AST scope with the nodes from the current AST scope.To do that, I use methods on collections to remove all temp nodes that were in the old scope and that aren't anymore in the new scope (in case we leave an inlined block) and I also add all temp nodes that are in the new scope and that were not in the old scope (in case we enter an inlined block).
Using methods on collections allows to do nothing in case both scopes are the same or in case both scopes aren't the same but have the same temps.