Compare commits
1 Commits
franknoiro
...
remove-the
Author | SHA1 | Date | |
---|---|---|---|
f46edcddf3 |
@ -534,7 +534,7 @@ export class SceneEntities {
|
|||||||
segmentName: 'line' | 'tangentialArcTo' = 'line',
|
segmentName: 'line' | 'tangentialArcTo' = 'line',
|
||||||
shouldTearDown = true
|
shouldTearDown = true
|
||||||
) => {
|
) => {
|
||||||
const _ast = JSON.parse(JSON.stringify(kclManager.ast))
|
const _ast = kclManager.ast
|
||||||
|
|
||||||
const _node1 = getNodeFromPath<VariableDeclaration>(
|
const _node1 = getNodeFromPath<VariableDeclaration>(
|
||||||
_ast,
|
_ast,
|
||||||
@ -692,7 +692,7 @@ export class SceneEntities {
|
|||||||
sketchOrigin: [number, number, number],
|
sketchOrigin: [number, number, number],
|
||||||
rectangleOrigin: [x: number, y: number]
|
rectangleOrigin: [x: number, y: number]
|
||||||
) => {
|
) => {
|
||||||
let _ast = JSON.parse(JSON.stringify(kclManager.ast))
|
let _ast = kclManager.ast
|
||||||
|
|
||||||
const _node1 = getNodeFromPath<VariableDeclaration>(
|
const _node1 = getNodeFromPath<VariableDeclaration>(
|
||||||
_ast,
|
_ast,
|
||||||
@ -723,7 +723,9 @@ export class SceneEntities {
|
|||||||
...getRectangleCallExpressions(rectangleOrigin, tags),
|
...getRectangleCallExpressions(rectangleOrigin, tags),
|
||||||
])
|
])
|
||||||
|
|
||||||
_ast = parse(recast(_ast))
|
let result = parse(recast(_ast))
|
||||||
|
if (trap(result)) return Promise.reject(result)
|
||||||
|
_ast = result
|
||||||
|
|
||||||
const { programMemoryOverride, truncatedAst } = await this.setupSketch({
|
const { programMemoryOverride, truncatedAst } = await this.setupSketch({
|
||||||
sketchPathToNode,
|
sketchPathToNode,
|
||||||
@ -737,7 +739,7 @@ export class SceneEntities {
|
|||||||
sceneInfra.setCallbacks({
|
sceneInfra.setCallbacks({
|
||||||
onMove: async (args) => {
|
onMove: async (args) => {
|
||||||
// Update the width and height of the draft rectangle
|
// Update the width and height of the draft rectangle
|
||||||
const pathToNodeTwo = JSON.parse(JSON.stringify(sketchPathToNode))
|
const pathToNodeTwo = sketchPathToNode
|
||||||
pathToNodeTwo[1][0] = 0
|
pathToNodeTwo[1][0] = 0
|
||||||
|
|
||||||
const _node = getNodeFromPath<VariableDeclaration>(
|
const _node = getNodeFromPath<VariableDeclaration>(
|
||||||
@ -799,7 +801,9 @@ export class SceneEntities {
|
|||||||
if (sketchInit.type === 'PipeExpression') {
|
if (sketchInit.type === 'PipeExpression') {
|
||||||
updateRectangleSketch(sketchInit, x, y, tags[0])
|
updateRectangleSketch(sketchInit, x, y, tags[0])
|
||||||
|
|
||||||
_ast = parse(recast(_ast))
|
let result = parse(recast(_ast))
|
||||||
|
if (trap(result)) return Promise.reject(result)
|
||||||
|
_ast = result
|
||||||
|
|
||||||
// Update the primary AST and unequip the rectangle tool
|
// Update the primary AST and unequip the rectangle tool
|
||||||
await kclManager.executeAstMock(_ast)
|
await kclManager.executeAstMock(_ast)
|
||||||
@ -1003,10 +1007,8 @@ export class SceneEntities {
|
|||||||
PROFILE_START,
|
PROFILE_START,
|
||||||
])
|
])
|
||||||
if (!group) return
|
if (!group) return
|
||||||
const pathToNode: PathToNode = JSON.parse(
|
const pathToNode: PathToNode = group.userData.pathToNode
|
||||||
JSON.stringify(group.userData.pathToNode)
|
const varDecIndex: number = pathToNode[1][0] as number
|
||||||
)
|
|
||||||
const varDecIndex = JSON.parse(JSON.stringify(pathToNode[1][0]))
|
|
||||||
if (draftInfo) {
|
if (draftInfo) {
|
||||||
pathToNode[1][0] = 0
|
pathToNode[1][0] = 0
|
||||||
}
|
}
|
||||||
@ -1719,7 +1721,7 @@ function prepareTruncatedMemoryAndAst(
|
|||||||
}
|
}
|
||||||
| Error {
|
| Error {
|
||||||
const bodyIndex = Number(sketchPathToNode?.[1]?.[0]) || 0
|
const bodyIndex = Number(sketchPathToNode?.[1]?.[0]) || 0
|
||||||
const _ast = JSON.parse(JSON.stringify(ast))
|
const _ast = ast
|
||||||
|
|
||||||
const _node = getNodeFromPath<VariableDeclaration>(
|
const _node = getNodeFromPath<VariableDeclaration>(
|
||||||
_ast,
|
_ast,
|
||||||
@ -1778,7 +1780,7 @@ function prepareTruncatedMemoryAndAst(
|
|||||||
}
|
}
|
||||||
const truncatedAst: Program = {
|
const truncatedAst: Program = {
|
||||||
..._ast,
|
..._ast,
|
||||||
body: [JSON.parse(JSON.stringify(_ast.body[bodyIndex]))],
|
body: [_ast.body[bodyIndex]],
|
||||||
}
|
}
|
||||||
const programMemoryOverride = programMemoryInit()
|
const programMemoryOverride = programMemoryInit()
|
||||||
if (err(programMemoryOverride)) return programMemoryOverride
|
if (err(programMemoryOverride)) return programMemoryOverride
|
||||||
@ -1804,7 +1806,7 @@ function prepareTruncatedMemoryAndAst(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (value.type === 'TagIdentifier') {
|
if (value.type === 'TagIdentifier') {
|
||||||
programMemoryOverride.root[key] = JSON.parse(JSON.stringify(value))
|
programMemoryOverride.root[key] = value
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1819,7 +1821,7 @@ function prepareTruncatedMemoryAndAst(
|
|||||||
if (!memoryItem) {
|
if (!memoryItem) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
programMemoryOverride.root[name] = JSON.parse(JSON.stringify(memoryItem))
|
programMemoryOverride.root[name] = memoryItem
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
truncatedAst,
|
truncatedAst,
|
||||||
|
@ -151,9 +151,7 @@ export function useCalc({
|
|||||||
ast,
|
ast,
|
||||||
engineCommandManager,
|
engineCommandManager,
|
||||||
useFakeExecutor: true,
|
useFakeExecutor: true,
|
||||||
programMemoryOverride: JSON.parse(
|
programMemoryOverride: kclManager.programMemory,
|
||||||
JSON.stringify(kclManager.programMemory)
|
|
||||||
),
|
|
||||||
}).then(({ programMemory }) => {
|
}).then(({ programMemory }) => {
|
||||||
const resultDeclaration = ast.body.find(
|
const resultDeclaration = ast.body.find(
|
||||||
(a) =>
|
(a) =>
|
||||||
|
@ -513,7 +513,7 @@ export const ModelingMachineProvider = ({
|
|||||||
services: {
|
services: {
|
||||||
'AST-undo-startSketchOn': async ({ sketchDetails }) => {
|
'AST-undo-startSketchOn': async ({ sketchDetails }) => {
|
||||||
if (!sketchDetails) return
|
if (!sketchDetails) return
|
||||||
const newAst: Program = JSON.parse(JSON.stringify(kclManager.ast))
|
const newAst: Program = kclManager.ast
|
||||||
const varDecIndex = sketchDetails.sketchPathToNode[1][0]
|
const varDecIndex = sketchDetails.sketchPathToNode[1][0]
|
||||||
// remove body item at varDecIndex
|
// remove body item at varDecIndex
|
||||||
newAst.body = newAst.body.filter((_, i) => i !== varDecIndex)
|
newAst.body = newAst.body.filter((_, i) => i !== varDecIndex)
|
||||||
|
@ -145,7 +145,7 @@ export async function applyConstraintIntersect({
|
|||||||
const { transforms, forcedSelectionRanges } = info
|
const { transforms, forcedSelectionRanges } = info
|
||||||
|
|
||||||
const transform1 = transformSecondarySketchLinesTagFirst({
|
const transform1 = transformSecondarySketchLinesTagFirst({
|
||||||
ast: JSON.parse(JSON.stringify(kclManager.ast)),
|
ast: kclManager.ast,
|
||||||
selectionRanges: forcedSelectionRanges,
|
selectionRanges: forcedSelectionRanges,
|
||||||
transformInfos: transforms,
|
transformInfos: transforms,
|
||||||
programMemory: kclManager.programMemory,
|
programMemory: kclManager.programMemory,
|
||||||
|
@ -106,7 +106,7 @@ export async function applyConstraintAbsDistance({
|
|||||||
const transformInfos = info.transforms
|
const transformInfos = info.transforms
|
||||||
|
|
||||||
const transform1 = transformAstSketchLines({
|
const transform1 = transformAstSketchLines({
|
||||||
ast: JSON.parse(JSON.stringify(kclManager.ast)),
|
ast: kclManager.ast,
|
||||||
selectionRanges: selectionRanges,
|
selectionRanges: selectionRanges,
|
||||||
transformInfos,
|
transformInfos,
|
||||||
programMemory: kclManager.programMemory,
|
programMemory: kclManager.programMemory,
|
||||||
@ -128,7 +128,7 @@ export async function applyConstraintAbsDistance({
|
|||||||
)
|
)
|
||||||
|
|
||||||
const transform2 = transformAstSketchLines({
|
const transform2 = transformAstSketchLines({
|
||||||
ast: JSON.parse(JSON.stringify(kclManager.ast)),
|
ast: kclManager.ast,
|
||||||
selectionRanges: selectionRanges,
|
selectionRanges: selectionRanges,
|
||||||
transformInfos,
|
transformInfos,
|
||||||
programMemory: kclManager.programMemory,
|
programMemory: kclManager.programMemory,
|
||||||
@ -176,7 +176,7 @@ export function applyConstraintAxisAlign({
|
|||||||
let finalValue = createIdentifier('ZERO')
|
let finalValue = createIdentifier('ZERO')
|
||||||
|
|
||||||
return transformAstSketchLines({
|
return transformAstSketchLines({
|
||||||
ast: JSON.parse(JSON.stringify(kclManager.ast)),
|
ast: kclManager.ast,
|
||||||
selectionRanges: selectionRanges,
|
selectionRanges: selectionRanges,
|
||||||
transformInfos,
|
transformInfos,
|
||||||
programMemory: kclManager.programMemory,
|
programMemory: kclManager.programMemory,
|
||||||
|
@ -100,7 +100,7 @@ export async function applyConstraintAngleBetween({
|
|||||||
const transformInfos = info.transforms
|
const transformInfos = info.transforms
|
||||||
|
|
||||||
const transformed1 = transformSecondarySketchLinesTagFirst({
|
const transformed1 = transformSecondarySketchLinesTagFirst({
|
||||||
ast: JSON.parse(JSON.stringify(kclManager.ast)),
|
ast: kclManager.ast,
|
||||||
selectionRanges,
|
selectionRanges,
|
||||||
transformInfos,
|
transformInfos,
|
||||||
programMemory: kclManager.programMemory,
|
programMemory: kclManager.programMemory,
|
||||||
|
@ -108,7 +108,7 @@ export async function applyConstraintHorzVertDistance({
|
|||||||
if (err(info)) return Promise.reject(info)
|
if (err(info)) return Promise.reject(info)
|
||||||
const transformInfos = info.transforms
|
const transformInfos = info.transforms
|
||||||
const transformed = transformSecondarySketchLinesTagFirst({
|
const transformed = transformSecondarySketchLinesTagFirst({
|
||||||
ast: JSON.parse(JSON.stringify(kclManager.ast)),
|
ast: kclManager.ast,
|
||||||
selectionRanges,
|
selectionRanges,
|
||||||
transformInfos,
|
transformInfos,
|
||||||
programMemory: kclManager.programMemory,
|
programMemory: kclManager.programMemory,
|
||||||
|
@ -84,7 +84,7 @@ export async function applyConstraintAngleLength({
|
|||||||
|
|
||||||
const { transforms } = angleLength
|
const { transforms } = angleLength
|
||||||
const sketched = transformAstSketchLines({
|
const sketched = transformAstSketchLines({
|
||||||
ast: JSON.parse(JSON.stringify(kclManager.ast)),
|
ast: kclManager.ast,
|
||||||
selectionRanges,
|
selectionRanges,
|
||||||
transformInfos: transforms,
|
transformInfos: transforms,
|
||||||
programMemory: kclManager.programMemory,
|
programMemory: kclManager.programMemory,
|
||||||
@ -139,7 +139,7 @@ export async function applyConstraintAngleLength({
|
|||||||
}
|
}
|
||||||
|
|
||||||
const retval = transformAstSketchLines({
|
const retval = transformAstSketchLines({
|
||||||
ast: JSON.parse(JSON.stringify(kclManager.ast)),
|
ast: kclManager.ast,
|
||||||
selectionRanges,
|
selectionRanges,
|
||||||
transformInfos: transforms,
|
transformInfos: transforms,
|
||||||
programMemory: kclManager.programMemory,
|
programMemory: kclManager.programMemory,
|
||||||
|
@ -42,9 +42,8 @@ function registerServerCapability(
|
|||||||
serverCapabilities: ServerCapabilities,
|
serverCapabilities: ServerCapabilities,
|
||||||
registration: Registration
|
registration: Registration
|
||||||
): ServerCapabilities | Error {
|
): ServerCapabilities | Error {
|
||||||
const serverCapabilitiesCopy = JSON.parse(
|
const serverCapabilitiesCopy =
|
||||||
JSON.stringify(serverCapabilities)
|
serverCapabilities as IFlexibleServerCapabilities
|
||||||
) as IFlexibleServerCapabilities
|
|
||||||
const { method, registerOptions } = registration
|
const { method, registerOptions } = registration
|
||||||
const providerName = ServerCapabilitiesProviders[method]
|
const providerName = ServerCapabilitiesProviders[method]
|
||||||
|
|
||||||
@ -52,10 +51,7 @@ function registerServerCapability(
|
|||||||
if (!registerOptions) {
|
if (!registerOptions) {
|
||||||
serverCapabilitiesCopy[providerName] = true
|
serverCapabilitiesCopy[providerName] = true
|
||||||
} else {
|
} else {
|
||||||
serverCapabilitiesCopy[providerName] = Object.assign(
|
serverCapabilitiesCopy[providerName] = Object.assign({}, registerOptions)
|
||||||
{},
|
|
||||||
JSON.parse(JSON.stringify(registerOptions))
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return new Error('Could not register server capability.')
|
return new Error('Could not register server capability.')
|
||||||
@ -68,9 +64,8 @@ function unregisterServerCapability(
|
|||||||
serverCapabilities: ServerCapabilities,
|
serverCapabilities: ServerCapabilities,
|
||||||
unregistration: Unregistration
|
unregistration: Unregistration
|
||||||
): ServerCapabilities {
|
): ServerCapabilities {
|
||||||
const serverCapabilitiesCopy = JSON.parse(
|
const serverCapabilitiesCopy =
|
||||||
JSON.stringify(serverCapabilities)
|
serverCapabilities as IFlexibleServerCapabilities
|
||||||
) as IFlexibleServerCapabilities
|
|
||||||
const { method } = unregistration
|
const { method } = unregistration
|
||||||
const providerName = ServerCapabilitiesProviders[method]
|
const providerName = ServerCapabilitiesProviders[method]
|
||||||
|
|
||||||
|
@ -710,7 +710,7 @@ export function moveValueIntoNewVariablePath(
|
|||||||
programMemory,
|
programMemory,
|
||||||
pathToNode
|
pathToNode
|
||||||
)
|
)
|
||||||
let _node = JSON.parse(JSON.stringify(ast))
|
let _node = ast
|
||||||
const boop = replacer(_node, variableName)
|
const boop = replacer(_node, variableName)
|
||||||
if (trap(boop)) return { modifiedAst: ast }
|
if (trap(boop)) return { modifiedAst: ast }
|
||||||
|
|
||||||
@ -742,7 +742,7 @@ export function moveValueIntoNewVariable(
|
|||||||
programMemory,
|
programMemory,
|
||||||
sourceRange
|
sourceRange
|
||||||
)
|
)
|
||||||
let _node = JSON.parse(JSON.stringify(ast))
|
let _node = ast
|
||||||
const replaced = replacer(_node, variableName)
|
const replaced = replacer(_node, variableName)
|
||||||
if (trap(replaced)) return { modifiedAst: ast }
|
if (trap(replaced)) return { modifiedAst: ast }
|
||||||
|
|
||||||
@ -767,7 +767,7 @@ export function deleteSegmentFromPipeExpression(
|
|||||||
code: string,
|
code: string,
|
||||||
pathToNode: PathToNode
|
pathToNode: PathToNode
|
||||||
): Program | Error {
|
): Program | Error {
|
||||||
let _modifiedAst: Program = JSON.parse(JSON.stringify(modifiedAst))
|
let _modifiedAst: Program = modifiedAst
|
||||||
|
|
||||||
dependentRanges.forEach((range) => {
|
dependentRanges.forEach((range) => {
|
||||||
const path = getNodePathFromSourceRange(_modifiedAst, range)
|
const path = getNodePathFromSourceRange(_modifiedAst, range)
|
||||||
@ -884,7 +884,7 @@ export async function deleteFromSelection(
|
|||||||
getFaceDetails: (id: string) => Promise<Models['FaceIsPlanar_type']> = () =>
|
getFaceDetails: (id: string) => Promise<Models['FaceIsPlanar_type']> = () =>
|
||||||
({} as any)
|
({} as any)
|
||||||
): Promise<Program | Error> {
|
): Promise<Program | Error> {
|
||||||
const astClone = JSON.parse(JSON.stringify(ast))
|
const astClone = ast
|
||||||
const range = selection.range
|
const range = selection.range
|
||||||
const path = getNodePathFromSourceRange(ast, range)
|
const path = getNodePathFromSourceRange(ast, range)
|
||||||
const varDec = getNodeFromPath<VariableDeclarator>(
|
const varDec = getNodeFromPath<VariableDeclarator>(
|
||||||
|
@ -87,10 +87,7 @@ const yo2 = hmm([identifierGuy + 5])`
|
|||||||
expect(result.isSafe).toBe(true)
|
expect(result.isSafe).toBe(true)
|
||||||
expect(result.value?.type).toBe('BinaryExpression')
|
expect(result.value?.type).toBe('BinaryExpression')
|
||||||
expect(code.slice(result.value.start, result.value.end)).toBe('100 + 100')
|
expect(code.slice(result.value.start, result.value.end)).toBe('100 + 100')
|
||||||
const replaced = result.replacer(
|
const replaced = result.replacer(ast, 'replaceName')
|
||||||
JSON.parse(JSON.stringify(ast)),
|
|
||||||
'replaceName'
|
|
||||||
)
|
|
||||||
if (err(replaced)) throw replaced
|
if (err(replaced)) throw replaced
|
||||||
const outCode = recast(replaced.modifiedAst)
|
const outCode = recast(replaced.modifiedAst)
|
||||||
expect(outCode).toContain(`angledLine([replaceName, 3.09], %)`)
|
expect(outCode).toContain(`angledLine([replaceName, 3.09], %)`)
|
||||||
@ -114,10 +111,7 @@ const yo2 = hmm([identifierGuy + 5])`
|
|||||||
expect(result.isSafe).toBe(true)
|
expect(result.isSafe).toBe(true)
|
||||||
expect(result.value?.type).toBe('CallExpression')
|
expect(result.value?.type).toBe('CallExpression')
|
||||||
expect(code.slice(result.value.start, result.value.end)).toBe("def('yo')")
|
expect(code.slice(result.value.start, result.value.end)).toBe("def('yo')")
|
||||||
const replaced = result.replacer(
|
const replaced = result.replacer(ast, 'replaceName')
|
||||||
JSON.parse(JSON.stringify(ast)),
|
|
||||||
'replaceName'
|
|
||||||
)
|
|
||||||
if (err(replaced)) throw replaced
|
if (err(replaced)) throw replaced
|
||||||
const outCode = recast(replaced.modifiedAst)
|
const outCode = recast(replaced.modifiedAst)
|
||||||
expect(outCode).toContain(`angledLine([replaceName, 3.09], %)`)
|
expect(outCode).toContain(`angledLine([replaceName, 3.09], %)`)
|
||||||
@ -154,10 +148,7 @@ const yo2 = hmm([identifierGuy + 5])`
|
|||||||
expect(result.isSafe).toBe(true)
|
expect(result.isSafe).toBe(true)
|
||||||
expect(result.value?.type).toBe('BinaryExpression')
|
expect(result.value?.type).toBe('BinaryExpression')
|
||||||
expect(code.slice(result.value.start, result.value.end)).toBe('5 + 6')
|
expect(code.slice(result.value.start, result.value.end)).toBe('5 + 6')
|
||||||
const replaced = result.replacer(
|
const replaced = result.replacer(ast, 'replaceName')
|
||||||
JSON.parse(JSON.stringify(ast)),
|
|
||||||
'replaceName'
|
|
||||||
)
|
|
||||||
if (err(replaced)) throw replaced
|
if (err(replaced)) throw replaced
|
||||||
const outCode = recast(replaced.modifiedAst)
|
const outCode = recast(replaced.modifiedAst)
|
||||||
expect(outCode).toContain(`const yo = replaceName`)
|
expect(outCode).toContain(`const yo = replaceName`)
|
||||||
@ -173,10 +164,7 @@ const yo2 = hmm([identifierGuy + 5])`
|
|||||||
expect(code.slice(result.value.start, result.value.end)).toBe(
|
expect(code.slice(result.value.start, result.value.end)).toBe(
|
||||||
"jkl('yo') + 2"
|
"jkl('yo') + 2"
|
||||||
)
|
)
|
||||||
const replaced = result.replacer(
|
const replaced = result.replacer(ast, 'replaceName')
|
||||||
JSON.parse(JSON.stringify(ast)),
|
|
||||||
'replaceName'
|
|
||||||
)
|
|
||||||
if (err(replaced)) throw replaced
|
if (err(replaced)) throw replaced
|
||||||
const { modifiedAst } = replaced
|
const { modifiedAst } = replaced
|
||||||
const outCode = recast(modifiedAst)
|
const outCode = recast(modifiedAst)
|
||||||
@ -195,10 +183,7 @@ const yo2 = hmm([identifierGuy + 5])`
|
|||||||
expect(code.slice(result.value.start, result.value.end)).toBe(
|
expect(code.slice(result.value.start, result.value.end)).toBe(
|
||||||
'identifierGuy + 5'
|
'identifierGuy + 5'
|
||||||
)
|
)
|
||||||
const replaced = result.replacer(
|
const replaced = result.replacer(ast, 'replaceName')
|
||||||
JSON.parse(JSON.stringify(ast)),
|
|
||||||
'replaceName'
|
|
||||||
)
|
|
||||||
if (err(replaced)) throw replaced
|
if (err(replaced)) throw replaced
|
||||||
const { modifiedAst } = replaced
|
const { modifiedAst } = replaced
|
||||||
const outCode = recast(modifiedAst)
|
const outCode = recast(modifiedAst)
|
||||||
|
@ -520,8 +520,8 @@ export function isNodeSafeToReplacePath(
|
|||||||
const replaceNodeWithIdentifier: ReplacerFn = (_ast, varName) => {
|
const replaceNodeWithIdentifier: ReplacerFn = (_ast, varName) => {
|
||||||
const identifier = createIdentifier(varName)
|
const identifier = createIdentifier(varName)
|
||||||
const last = finPath[finPath.length - 1]
|
const last = finPath[finPath.length - 1]
|
||||||
const pathToReplaced = JSON.parse(JSON.stringify(finPath))
|
const pathToReplaced = finPath
|
||||||
pathToReplaced[1][0] = pathToReplaced[1][0] + 1
|
pathToReplaced[1][0] = (pathToReplaced[1][0] as number) + 1
|
||||||
const startPath = finPath.slice(0, -1)
|
const startPath = finPath.slice(0, -1)
|
||||||
const _nodeToReplace = getNodeFromPath(_ast, startPath)
|
const _nodeToReplace = getNodeFromPath(_ast, startPath)
|
||||||
if (err(_nodeToReplace)) return _nodeToReplace
|
if (err(_nodeToReplace)) return _nodeToReplace
|
||||||
|
@ -1496,7 +1496,7 @@ export function transformSecondarySketchLinesTagFirst({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
| Error {
|
| Error {
|
||||||
// let node = JSON.parse(JSON.stringify(ast))
|
// let node = ast
|
||||||
const primarySelection = selectionRanges.codeBasedSelections[0].range
|
const primarySelection = selectionRanges.codeBasedSelections[0].range
|
||||||
|
|
||||||
const _tag = giveSketchFnCallTag(ast, primarySelection, forceSegName)
|
const _tag = giveSketchFnCallTag(ast, primarySelection, forceSegName)
|
||||||
@ -1565,7 +1565,7 @@ export function transformAstSketchLines({
|
|||||||
}
|
}
|
||||||
| Error {
|
| Error {
|
||||||
// deep clone since we are mutating in a loop, of which any could fail
|
// deep clone since we are mutating in a loop, of which any could fail
|
||||||
let node = JSON.parse(JSON.stringify(ast))
|
let node = ast
|
||||||
let _valueUsedInTransform // TODO should this be an array?
|
let _valueUsedInTransform // TODO should this be an array?
|
||||||
const pathToNodeMap: PathToNodeMap = {}
|
const pathToNodeMap: PathToNodeMap = {}
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ export function updatePathToNodeFromMap(
|
|||||||
oldPath: PathToNode,
|
oldPath: PathToNode,
|
||||||
pathToNodeMap: { [key: number]: PathToNode }
|
pathToNodeMap: { [key: number]: PathToNode }
|
||||||
): PathToNode {
|
): PathToNode {
|
||||||
const updatedPathToNode = JSON.parse(JSON.stringify(oldPath))
|
const updatedPathToNode = oldPath
|
||||||
let max = 0
|
let max = 0
|
||||||
Object.values(pathToNodeMap).forEach((path) => {
|
Object.values(pathToNodeMap).forEach((path) => {
|
||||||
const index = Number(path[1][0])
|
const index = Number(path[1][0])
|
||||||
|
@ -96,9 +96,7 @@ export function useCalculateKclExpression({
|
|||||||
ast,
|
ast,
|
||||||
engineCommandManager,
|
engineCommandManager,
|
||||||
useFakeExecutor: true,
|
useFakeExecutor: true,
|
||||||
programMemoryOverride: JSON.parse(
|
programMemoryOverride: kclManager.programMemory,
|
||||||
JSON.stringify(kclManager.programMemory)
|
|
||||||
),
|
|
||||||
})
|
})
|
||||||
const resultDeclaration = ast.body.find(
|
const resultDeclaration = ast.body.find(
|
||||||
(a) =>
|
(a) =>
|
||||||
|
Reference in New Issue
Block a user