diff --git a/src/lang/std/sketch.test.ts b/src/lang/std/sketch.test.ts index 34c8338a0..04ab9ec6b 100644 --- a/src/lang/std/sketch.test.ts +++ b/src/lang/std/sketch.test.ts @@ -881,7 +881,7 @@ describe('testing getConstraintInfo', () => { offset = 0 + 0 }, %) |> tangentialArcTo([3.14 + 0, 13.14 + 0], %)` - test.each([ + test.only.each([ [ 'line', [ @@ -929,7 +929,7 @@ describe('testing getConstraintInfo', () => { ], ], [ - 'lineTo', + 'line(endAbsolute', [ { type: 'xAbsolute', @@ -938,7 +938,7 @@ describe('testing getConstraintInfo', () => { sourceRange: [expect.any(Number), expect.any(Number), true], argPosition: { type: 'arrayItem', index: 0 }, pathToNode: expect.any(Array), - stdLibFnName: 'lineTo', + stdLibFnName: 'line', }, { type: 'yAbsolute', @@ -947,7 +947,7 @@ describe('testing getConstraintInfo', () => { sourceRange: [expect.any(Number), expect.any(Number), true], argPosition: { type: 'arrayItem', index: 1 }, pathToNode: expect.any(Array), - stdLibFnName: 'lineTo', + stdLibFnName: 'line', }, ], ], diff --git a/src/lang/std/sketch.ts b/src/lang/std/sketch.ts index 6279b3f4f..cddf6cd0f 100644 --- a/src/lang/std/sketch.ts +++ b/src/lang/std/sketch.ts @@ -631,7 +631,7 @@ export const lineTo: SketchLineHelperKw = { getConstraintInfo: (callExp, ...args) => commonConstraintInfoHelper( callExp, - ['xRelative', 'yRelative'], + ['xAbsolute', 'yAbsolute'], 'line', [{ arrayInput: 0 }, { arrayInput: 1 }], ...args @@ -2053,8 +2053,10 @@ export function getConstraintInfoKw( pathToNode: PathToNode ): ConstrainInfo[] { const fnName = callExpression?.callee?.name || '' + const isAbsolute = findKwArg('endAbsolute', callExpression) !== undefined if (!(fnName in sketchLineHelperMapKw)) return [] - return sketchLineHelperMapKw[fnName].getConstraintInfo( + const correctFnName = fnName === 'line' && isAbsolute ? 'lineTo' : fnName + return sketchLineHelperMapKw[correctFnName].getConstraintInfo( callExpression, code, pathToNode diff --git a/src/lang/wasm.ts b/src/lang/wasm.ts index 6e4a01ea1..96e8c5158 100644 --- a/src/lang/wasm.ts +++ b/src/lang/wasm.ts @@ -245,6 +245,7 @@ export const parse = (code: string | Error): ParseResult | Error => { return new ParseResult(parsed[0], errs.errors, errs.warnings) } catch (e: any) { // throw e + console.error(e.toString()) const parsed: RustKclError = JSON.parse(e.toString()) return new KCLError( parsed.kind,