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

@ -29,7 +29,7 @@ loft(sketches: [Sketch], data?: LoftData) -> Solid
```js
// Loft a square and a triangle.
const squareSketch = startSketchOn('XY')
squareSketch = startSketchOn('XY')
|> startProfileAt([-100, 200], %)
|> line([200, 0], %)
|> line([0, -200], %)
@ -37,7 +37,7 @@ const squareSketch = startSketchOn('XY')
|> lineTo([profileStartX(%), profileStartY(%)], %)
|> close(%)
const triangleSketch = startSketchOn(offsetPlane('XY', 75))
triangleSketch = startSketchOn(offsetPlane('XY', 75))
|> startProfileAt([0, 125], %)
|> line([-15, -30], %)
|> line([30, 0], %)
@ -51,7 +51,7 @@ loft([squareSketch, triangleSketch])
```js
// Loft a square, a circle, and another circle.
const squareSketch = startSketchOn('XY')
squareSketch = startSketchOn('XY')
|> startProfileAt([-100, 200], %)
|> line([200, 0], %)
|> line([0, -200], %)
@ -59,10 +59,10 @@ const squareSketch = startSketchOn('XY')
|> lineTo([profileStartX(%), profileStartY(%)], %)
|> close(%)
const circleSketch0 = startSketchOn(offsetPlane('XY', 75))
circleSketch0 = startSketchOn(offsetPlane('XY', 75))
|> circle({ center: [0, 100], radius: 50 }, %)
const circleSketch1 = startSketchOn(offsetPlane('XY', 150))
circleSketch1 = startSketchOn(offsetPlane('XY', 150))
|> circle({ center: [0, 100], radius: 20 }, %)
loft([
@ -76,7 +76,7 @@ loft([
```js
// Loft a square, a circle, and another circle with options.
const squareSketch = startSketchOn('XY')
squareSketch = startSketchOn('XY')
|> startProfileAt([-100, 200], %)
|> line([200, 0], %)
|> line([0, -200], %)
@ -84,10 +84,10 @@ const squareSketch = startSketchOn('XY')
|> lineTo([profileStartX(%), profileStartY(%)], %)
|> close(%)
const circleSketch0 = startSketchOn(offsetPlane('XY', 75))
circleSketch0 = startSketchOn(offsetPlane('XY', 75))
|> circle({ center: [0, 100], radius: 50 }, %)
const circleSketch1 = startSketchOn(offsetPlane('XY', 150))
circleSketch1 = startSketchOn(offsetPlane('XY', 150))
|> circle({ center: [0, 100], radius: 20 }, %)
loft([