Make tag last optional param everywhere (#1739)

* Make tag last optional param

* Update all test assertions with correct tag format

* Format ts

* Some progress on tests and code mods

* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)

* More sketch fixes

* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)

* Only 1 test left

* Clean up console.log

* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)

* Fix last ts test

* Clean up fmt

* Fix clippy too

* Update docs and fix small oversight on angled lines

* Fix more rust tests

* Make typescript happy

* Fmt

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Jess Frazelle <jessfraz@users.noreply.github.com>
This commit is contained in:
Adam Sunderland
2024-03-15 17:03:42 -04:00
committed by GitHub
parent 4987965731
commit 816870253e
60 changed files with 934 additions and 1539 deletions

View File

@ -60,11 +60,12 @@ function createCallWrapper(
tag?: Value,
valueUsedInTransform?: number
): ReturnType<TransformCallback> {
const args = [createFirstArg(a, val), createPipeSubstitution()]
if (tag) {
args.push(tag)
}
return {
callExp: createCallExpression(a, [
createFirstArg(a, val, tag),
createPipeSubstitution(),
]),
callExp: createCallExpression(a, args),
valueUsedInTransform,
}
}
@ -89,14 +90,15 @@ function intersectCallWrapper({
offset: offsetVal,
intersectTag,
}
const args: Value[] = [
createObjectExpression(firstArg),
createPipeSubstitution(),
]
if (tag) {
firstArg['tag'] = tag
args.push(tag)
}
return {
callExp: createCallExpression(fnName, [
createObjectExpression(firstArg),
createPipeSubstitution(),
]),
callExp: createCallExpression(fnName, args),
valueUsedInTransform,
}
}
@ -1419,7 +1421,8 @@ export function transformAstSketchLines({
const callExp = getNode<CallExpression>('CallExpression')?.node
const varDec = getNode<VariableDeclarator>('VariableDeclarator').node
const { val, tag: callBackTag } = getFirstArg(callExp)
const { val } = getFirstArg(callExp)
const callBackTag = callExp.arguments[2]
const _referencedSegmentNameVal =
callExp.arguments[0]?.type === 'ObjectExpression' &&
callExp.arguments[0].properties?.find(