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:
@ -85,7 +85,7 @@ import { isArray, isOverlap, roundOff } from 'lib/utils'
|
||||
import {
|
||||
createArrayExpression,
|
||||
createCallExpressionStdLib,
|
||||
createIdentifier,
|
||||
createLocalName,
|
||||
createCallExpressionStdLibKw,
|
||||
createLabeledArg,
|
||||
createLiteral,
|
||||
@ -750,7 +750,7 @@ export class SceneEntities {
|
||||
['CallExpression', 'CallExpressionKw']
|
||||
)
|
||||
if (err(_node1)) return
|
||||
const callExpName = _node1.node?.callee?.name
|
||||
const callExpName = _node1.node?.callee?.name.name
|
||||
|
||||
const initSegment =
|
||||
segment.type === 'TangentialArcTo'
|
||||
@ -1151,7 +1151,7 @@ export class SceneEntities {
|
||||
createLiteral(roundOff(rectangleOrigin[0])),
|
||||
createLiteral(roundOff(rectangleOrigin[1])),
|
||||
]),
|
||||
createIdentifier(varDec.node.id.name),
|
||||
createLocalName(varDec.node.id.name),
|
||||
])
|
||||
)
|
||||
|
||||
@ -1349,7 +1349,7 @@ export class SceneEntities {
|
||||
createLiteral(roundOff(rectangleOrigin[0])),
|
||||
createLiteral(roundOff(rectangleOrigin[1])),
|
||||
]),
|
||||
createIdentifier(varDec.node.id.name),
|
||||
createLocalName(varDec.node.id.name),
|
||||
])
|
||||
)
|
||||
const insertIndex = getInsertIndex(sketchNodePaths, planeNodePath, 'end')
|
||||
@ -2205,16 +2205,20 @@ export class SceneEntities {
|
||||
const varName = findUniqueName(_ast, 'profile')
|
||||
const newExpression = createVariableDeclaration(
|
||||
varName,
|
||||
createCallExpressionStdLibKw('circle', varDec.node.id, [
|
||||
createLabeledArg(
|
||||
'center',
|
||||
createArrayExpression([
|
||||
createLiteral(roundOff(circleCenter[0])),
|
||||
createLiteral(roundOff(circleCenter[1])),
|
||||
])
|
||||
),
|
||||
createLabeledArg('radius', createLiteral(1)),
|
||||
])
|
||||
createCallExpressionStdLibKw(
|
||||
'circle',
|
||||
createLocalName(varDec.node.id.name),
|
||||
[
|
||||
createLabeledArg(
|
||||
'center',
|
||||
createArrayExpression([
|
||||
createLiteral(roundOff(circleCenter[0])),
|
||||
createLiteral(roundOff(circleCenter[1])),
|
||||
])
|
||||
),
|
||||
createLabeledArg('radius', createLiteral(1)),
|
||||
]
|
||||
)
|
||||
)
|
||||
|
||||
const insertIndex = getInsertIndex(sketchNodePaths, planeNodePath, 'end')
|
||||
|
Reference in New Issue
Block a user