Skip to content

Commit

Permalink
Update on "[compiler] rfc: Include location information in identifier…
Browse files Browse the repository at this point in the history
…s and reactive scopes for debugging"

Summary: Using the change detection code to debug codebases that violate the rules of react is a lot easier when we have a source location corresponding to the value that has changed inappropriately. I didn't see an easy way to track that information in the existing data structures at the point of codegen, so this PR adds locations to identifiers and reactive scopes (the location of a reactive scope is the range of the locations of its included identifiers).

I'm interested if there's a better way to do this that I missed!

[ghstack-poisoned]
  • Loading branch information
mvitousek committed May 31, 2024
2 parents 9d9bd74 + 35cbbb4 commit 819c414
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@ function Component(props) {
let condition = $[0] !== props.value;
if (!condition) {
let old$x = $[1];
$structuralCheck(old$x, x, "x", "Component", "cached");
$structuralCheck(old$x, x, "x", "Component", "cached", "(3:6)");
}
$[0] = props.value;
$[1] = x;
if (condition) {
x = [];
x.push(props.value);
$structuralCheck($[1], x, "x", "Component", "recomputed");
$structuralCheck($[1], x, "x", "Component", "recomputed", "(3:6)");
x = $[1];
}
}
Expand Down

0 comments on commit 819c414

Please sign in to comment.