KCL: Angled line should use keyword args (#5803)

We continue migrating KCL stdlib functions to use keyword arguments. Next up is the `angledLine` family of functions (except `angledLineThatIntersects, which will be a quick follow-up).

Before vs. after:

`angledLine({angle = 90, length = 3}, %, $edge)`
  => `angledLine(angle = 90, length = 3, tag = $edge)`

`angledLineOfXLength({angle = 90, length = 3}, %, $edge)`
  => `angledLine(angle = 90, lengthX = 3, tag = $edge)`

`angledLineOfYLength({angle = 90, length = 3}, %, $edge)`
  => `angledLine(angle = 90, lengthY = 3, tag = $edge)`

`angledLineToX({angle = 90, length = 3}, %, $edge)`
  => `angledLine(angle = 90, endAbsoluteX = 3, tag = $edge)`

`angledLineToY({angle = 90, length = 3}, %, $edge)`
  => `angledLine(angle = 90, endAbsoluteY = 3, tag = $edge)`
This commit is contained in:
Adam Chalmers
2025-04-09 14:55:15 -05:00
committed by GitHub
parent b03ca30379
commit d275995dfe
288 changed files with 36142 additions and 40081 deletions

View File

@ -2,12 +2,19 @@ import type { Binary as BSONBinary } from 'bson'
import { v4 } from 'uuid'
import type { AnyMachineSnapshot } from 'xstate'
import type { SourceRange } from '@src/lang/wasm'
import type { CallExpressionKw, SourceRange } from '@src/lang/wasm'
import { isDesktop } from '@src/lib/isDesktop'
import type { AsyncFn } from '@src/lib/types'
export const uuidv4 = v4
/**
* Get all labels for a keyword call expression.
*/
export function allLabels(callExpression: CallExpressionKw): string[] {
return callExpression.arguments.map((a) => a.label.name)
}
/**
* A safer type guard for arrays since the built-in Array.isArray() asserts `any[]`.
*/