Fix to cache correct PathToNode in artifact graph (#6632)

* Add NodePath to artifact graph

Since this is cached, this should make PathToNode computation correct
even when code is formatted, whitespace changes, and source ranges
are different.

* Remove dead code

* Add unit tests

* Add tests for PathToNode conversion

* Remove unused parameter

* Add missing PathToNode cases

* Fix to handle unlabeled arg

* Cherry pick unlabeled arg fix

* Change PathToNode comment to match TS implementation
This commit is contained in:
Jonathan Tran
2025-05-01 23:55:12 -04:00
committed by GitHub
parent 02a37e207f
commit 819ee23565
12 changed files with 767 additions and 67 deletions

View File

@ -87,7 +87,7 @@ export default class RustContext {
JSON.stringify(settings)
)
/* Set the default planes, safe to call after execute. */
const outcome = execStateFromRust(result, node)
const outcome = execStateFromRust(result)
this._defaultPlanes = outcome.defaultPlanes
@ -161,29 +161,13 @@ export default class RustContext {
): Promise<ExecState> {
const instance = await this._checkInstance()
const ast: Node<Program> = {
body: [],
shebang: null,
start: 0,
end: 0,
moduleId: 0,
nonCodeMeta: {
nonCodeNodes: {},
startNodes: [],
},
innerAttrs: [],
outerAttrs: [],
preComments: [],
commentStart: 0,
}
try {
const result = await instance.bustCacheAndResetScene(
JSON.stringify(settings),
path
)
/* Set the default planes, safe to call after execute. */
const outcome = execStateFromRust(result, ast)
const outcome = execStateFromRust(result)
this._defaultPlanes = outcome.defaultPlanes