Fix to not duplicate arg labels on constrained sketches (#6337)
This commit is contained in:
@ -227,6 +227,8 @@ export function addSketchTo(
|
||||
Set the keyword argument to the given value.
|
||||
Returns true if it overwrote an existing argument.
|
||||
Returns false if no argument with the label existed before.
|
||||
Returns 'no-mutate' if the label was found, but the value is constrained and not
|
||||
mutated.
|
||||
Also do some checks to see if it's actually trying to set a constraint on
|
||||
a sketch line that's already fully constrained, and if so, duplicates the arg.
|
||||
WILL BE FIXED SOON.
|
||||
@ -235,7 +237,7 @@ export function mutateKwArg(
|
||||
label: string,
|
||||
node: CallExpressionKw,
|
||||
val: Expr
|
||||
): boolean {
|
||||
): boolean | 'no-mutate' {
|
||||
for (let i = 0; i < node.arguments.length; i++) {
|
||||
const arg = node.arguments[i]
|
||||
if (arg.label.name === label) {
|
||||
@ -254,6 +256,8 @@ export function mutateKwArg(
|
||||
})
|
||||
return true
|
||||
}
|
||||
// The label was found, but the value is not a literal or static.
|
||||
return 'no-mutate'
|
||||
}
|
||||
}
|
||||
node.arguments.push(createLabeledArg(label, val))
|
||||
|
||||
Reference in New Issue
Block a user