Fix test 'should recognize that sketch001 has been extruded'
This commit is contained in:
committed by
Nick Cameron
parent
81e2fd201d
commit
ff71250d5d
@ -585,7 +585,7 @@ sketch002 = startSketchOn(plane001)
|
|||||||
const extrudable = doesSceneHaveSweepableSketch(ast, 2)
|
const extrudable = doesSceneHaveSweepableSketch(ast, 2)
|
||||||
expect(extrudable).toBeTruthy()
|
expect(extrudable).toBeTruthy()
|
||||||
})
|
})
|
||||||
it('find sketch002 NOT pipe to be extruded', async () => {
|
it('should recognize that sketch001 has been extruded', async () => {
|
||||||
const exampleCode = `sketch001 = startSketchOn('XZ')
|
const exampleCode = `sketch001 = startSketchOn('XZ')
|
||||||
|> startProfileAt([3.29, 7.86], %)
|
|> startProfileAt([3.29, 7.86], %)
|
||||||
|> line(end = [2.48, 2.44])
|
|> line(end = [2.48, 2.44])
|
||||||
|
@ -1002,21 +1002,31 @@ export function doesSceneHaveSweepableSketch(ast: Node<Program>, count = 1) {
|
|||||||
let hasCircle = false
|
let hasCircle = false
|
||||||
for (const pipe of node.init.body) {
|
for (const pipe of node.init.body) {
|
||||||
if (
|
if (
|
||||||
pipe.type === 'CallExpression' &&
|
(pipe.type === 'CallExpressionKw' ||
|
||||||
|
pipe.type === 'CallExpression') &&
|
||||||
pipe.callee.name === 'startProfileAt'
|
pipe.callee.name === 'startProfileAt'
|
||||||
) {
|
) {
|
||||||
hasStartProfileAt = true
|
hasStartProfileAt = true
|
||||||
}
|
}
|
||||||
if (
|
if (
|
||||||
pipe.type === 'CallExpression' &&
|
(pipe.type === 'CallExpressionKw' ||
|
||||||
|
pipe.type === 'CallExpression') &&
|
||||||
pipe.callee.name === 'startSketchOn'
|
pipe.callee.name === 'startSketchOn'
|
||||||
) {
|
) {
|
||||||
hasStartSketchOn = true
|
hasStartSketchOn = true
|
||||||
}
|
}
|
||||||
if (pipe.type === 'CallExpression' && pipe.callee.name === 'close') {
|
if (
|
||||||
|
(pipe.type === 'CallExpressionKw' ||
|
||||||
|
pipe.type === 'CallExpression') &&
|
||||||
|
pipe.callee.name === 'close'
|
||||||
|
) {
|
||||||
hasClose = true
|
hasClose = true
|
||||||
}
|
}
|
||||||
if (pipe.type === 'CallExpression' && pipe.callee.name === 'circle') {
|
if (
|
||||||
|
(pipe.type === 'CallExpressionKw' ||
|
||||||
|
pipe.type === 'CallExpression') &&
|
||||||
|
pipe.callee.name === 'circle'
|
||||||
|
) {
|
||||||
hasCircle = true
|
hasCircle = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1034,6 +1044,13 @@ export function doesSceneHaveSweepableSketch(ast: Node<Program>, count = 1) {
|
|||||||
theMap?.[node?.arguments?.[1]?.name]
|
theMap?.[node?.arguments?.[1]?.name]
|
||||||
) {
|
) {
|
||||||
delete theMap[node.arguments[1].name]
|
delete theMap[node.arguments[1].name]
|
||||||
|
} else if (
|
||||||
|
node.type === 'CallExpressionKw' &&
|
||||||
|
(node.callee.name === 'extrude' || node.callee.name === 'revolve') &&
|
||||||
|
node.unlabeled?.type === 'Identifier' &&
|
||||||
|
theMap?.[node?.unlabeled?.name]
|
||||||
|
) {
|
||||||
|
delete theMap[node.unlabeled.name]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
Reference in New Issue
Block a user