safe parse (#996)

* safe parse

* use safe parse on mouse up, stream
This commit is contained in:
Kurt Hutten
2023-11-06 17:47:45 +11:00
committed by GitHub
parent 6b2603b1c4
commit 4bd08f7444
2 changed files with 24 additions and 5 deletions

View File

@ -342,7 +342,8 @@ export const Stream = ({ className = '' }) => {
// update artifact map ranges now that we have updated the ast.
code = recast(modded.modifiedAst)
const astWithCurrentRanges = parse(code)
const astWithCurrentRanges = kclManager.safeParse(code)
if (!astWithCurrentRanges) return
const updateNode = getNodeFromPath<CallExpression>(
astWithCurrentRanges,
modded.pathToNode