Support paths to names rather than just raw idents (#5778)

* Support paths to names rather than just raw idents

Signed-off-by: Nick Cameron <nrc@ncameron.org>

* A snapshot a day keeps the bugs away! 📷🐛

* A snapshot a day keeps the bugs away! 📷🐛

* A snapshot a day keeps the bugs away! 📷🐛

* A snapshot a day keeps the bugs away! 📷🐛

---------

Signed-off-by: Nick Cameron <nrc@ncameron.org>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
This commit is contained in:
Nick Cameron
2025-03-24 20:58:55 +13:00
committed by GitHub
parent cfbb03765e
commit dddcd5ff46
221 changed files with 71261 additions and 16926 deletions

View File

@ -47,8 +47,8 @@ import {
addOffsetPlane,
addShell,
addSweep,
createIdentifier,
createLiteral,
createLocalName,
extrudeSketch,
insertNamedConstant,
loftSketches,
@ -2235,7 +2235,7 @@ export const modelingMachine = setup({
}
const { tag } = tagResult
expr = createIdentifier(tag)
expr = createLocalName(tag)
} else {
return new Error('Artifact is neither a cap nor a wall')
}
@ -4133,25 +4133,26 @@ export function isEditingExistingSketch({
if (
(maybePipeExpression.type === 'CallExpression' ||
maybePipeExpression.type === 'CallExpressionKw') &&
(maybePipeExpression.callee.name === 'startProfileAt' ||
maybePipeExpression.callee.name === 'circle' ||
maybePipeExpression.callee.name === 'circleThreePoint')
(maybePipeExpression.callee.name.name === 'startProfileAt' ||
maybePipeExpression.callee.name.name === 'circle' ||
maybePipeExpression.callee.name.name === 'circleThreePoint')
)
return true
if (maybePipeExpression.type !== 'PipeExpression') return false
const hasStartProfileAt = maybePipeExpression.body.some(
(item) =>
item.type === 'CallExpression' && item.callee.name === 'startProfileAt'
item.type === 'CallExpression' &&
item.callee.name.name === 'startProfileAt'
)
const hasCircle =
maybePipeExpression.body.some(
(item) =>
item.type === 'CallExpressionKw' && item.callee.name === 'circle'
item.type === 'CallExpressionKw' && item.callee.name.name === 'circle'
) ||
maybePipeExpression.body.some(
(item) =>
item.type === 'CallExpressionKw' &&
item.callee.name === 'circleThreePoint'
item.callee.name.name === 'circleThreePoint'
)
return (hasStartProfileAt && maybePipeExpression.body.length > 1) || hasCircle
}
@ -4171,7 +4172,8 @@ export function pipeHasCircle({
const pipeExpression = variableDeclaration.node.init
if (pipeExpression.type !== 'PipeExpression') return false
const hasCircle = pipeExpression.body.some(
(item) => item.type === 'CallExpressionKw' && item.callee.name === 'circle'
(item) =>
item.type === 'CallExpressionKw' && item.callee.name.name === 'circle'
)
return hasCircle
}
@ -4210,6 +4212,6 @@ export function isClosedSketch({
return node.node.declaration.init.body.some(
(node) =>
(node.type === 'CallExpression' || node.type === 'CallExpressionKw') &&
(node.callee.name === 'close' || node.callee.name === 'circle')
(node.callee.name.name === 'close' || node.callee.name.name === 'circle')
)
}