KCL: No 'let' or 'const' required when declaring vars (#4063)

Previously variable declaration required a keyword, e.g.

```kcl
let x = 4
const x = 4
var x = 4
```

These were all valid, and did the exact same thing. As of this PR, they're all still valid, but the KCL formatter will change them all to just:

```kcl
x = 4
```

which is the new preferred way to declare a constant. 

But the formatter will remove the var/let/const keywords.

Closes https://github.com/KittyCAD/modeling-app/issues/3985
This commit is contained in:
Adam Chalmers
2024-10-02 14:19:40 -05:00
committed by GitHub
parent a24789c236
commit 0c478680cb
160 changed files with 1357 additions and 1360 deletions

View File

@ -63,7 +63,7 @@ async function testingSwapSketchFnCall({
describe('testing swapping out sketch calls with xLine/xLineTo', () => {
const bigExampleArr = [
`const part001 = startSketchOn('XY')`,
`part001 = startSketchOn('XY')`,
` |> startProfileAt([0, 0], %)`,
` |> lineTo([1, 1], %, $abc1)`,
` |> line([-2.04, -0.7], %, $abc2)`,
@ -252,14 +252,14 @@ describe('testing swapping out sketch calls with xLine/xLineTo', () => {
describe('testing swapping out sketch calls with xLine/xLineTo while keeping variable/identifiers intact', () => {
// Enable rotations #152
const variablesExampleArr = [
`const lineX = -1`,
`const lineToX = -1.3`,
`const angledLineAngle = 207`,
`const angledLineOfXLengthX = 0.8`,
`const angledLineOfYLengthY = 0.89`,
`const angledLineToXx = -1.86`,
`const angledLineToYy = -0.76`,
`const part001 = startSketchOn('XY')`,
`lineX = -1`,
`lineToX = -1.3`,
`angledLineAngle = 207`,
`angledLineOfXLengthX = 0.8`,
`angledLineOfYLengthY = 0.89`,
`angledLineToXx = -1.86`,
`angledLineToYy = -0.76`,
`part001 = startSketchOn('XY')`,
` |> startProfileAt([0, 0], %)`,
// ` |> rx(90, %)`,
` |> lineTo([1, 1], %)`,
@ -353,7 +353,7 @@ describe('testing swapping out sketch calls with xLine/xLineTo while keeping var
describe('testing getSketchSegmentIndexFromSourceRange', () => {
const code = `
const part001 = startSketchOn('XY')
part001 = startSketchOn('XY')
|> startProfileAt([0, 0.04], %) // segment-in-start
|> line([0, 0.4], %)
|> xLine(3.48, %)