Compare commits
18 Commits
nrc-refact
...
mike/engin
Author | SHA1 | Date | |
---|---|---|---|
5bea90ad9a | |||
d23ddc19eb | |||
4bd7e02271 | |||
26042790b6 | |||
af74f3bb05 | |||
0bdedf5854 | |||
d2c6b5cf3a | |||
e65358f635 | |||
0a1201e680 | |||
9db013e672 | |||
0196d72a2d | |||
e6af4078bd | |||
2b233dc705 | |||
b11e8af9c7 | |||
c017847d7b | |||
9635eea8c1 | |||
5a2df642b1 | |||
621e41080e |
BIN
..env.development.local.swp
Normal file
BIN
..env.development.local.swp
Normal file
Binary file not shown.
@ -1,3 +1,4 @@
|
||||
src/wasm-lib/*
|
||||
src/lib/engine-utils/engine.js
|
||||
*.typegen.ts
|
||||
packages/codemirror-lsp-client/dist/*
|
||||
|
4
.gitignore
vendored
4
.gitignore
vendored
@ -66,3 +66,7 @@ venv
|
||||
|
||||
# electron
|
||||
out/
|
||||
|
||||
# engine wasm utils
|
||||
src/lib/engine-utils/engine.wasm
|
||||
src/lib/engine-utils/engine.js
|
||||
|
@ -9,7 +9,7 @@ Draw a line segment relative to the current origin using the polar
|
||||
measure of some angle and distance.
|
||||
|
||||
```js
|
||||
angledLine(data: AngledLineData, sketch: Sketch, tag?: TagNode) -> Sketch
|
||||
angledLine(data: AngledLineData, sketch: Sketch, tag?: TagDeclarator) -> Sketch
|
||||
```
|
||||
|
||||
|
||||
@ -19,7 +19,7 @@ angledLine(data: AngledLineData, sketch: Sketch, tag?: TagNode) -> Sketch
|
||||
|----------|------|-------------|----------|
|
||||
| `data` | [`AngledLineData`](/docs/kcl/types/AngledLineData) | Data to draw an angled line. | Yes |
|
||||
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | A sketch is a collection of paths. | Yes |
|
||||
| `tag` | [`TagNode`](/docs/kcl/types/TagNode) | | No |
|
||||
| `tag` | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | | No |
|
||||
|
||||
### Returns
|
||||
|
||||
|
@ -9,7 +9,7 @@ Create a line segment from the current 2-dimensional sketch origin
|
||||
along some angle (in degrees) for some relative length in the 'x' dimension.
|
||||
|
||||
```js
|
||||
angledLineOfXLength(data: AngledLineData, sketch: Sketch, tag?: TagNode) -> Sketch
|
||||
angledLineOfXLength(data: AngledLineData, sketch: Sketch, tag?: TagDeclarator) -> Sketch
|
||||
```
|
||||
|
||||
|
||||
@ -19,7 +19,7 @@ angledLineOfXLength(data: AngledLineData, sketch: Sketch, tag?: TagNode) -> Sket
|
||||
|----------|------|-------------|----------|
|
||||
| `data` | [`AngledLineData`](/docs/kcl/types/AngledLineData) | Data to draw an angled line. | Yes |
|
||||
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | A sketch is a collection of paths. | Yes |
|
||||
| `tag` | [`TagNode`](/docs/kcl/types/TagNode) | | No |
|
||||
| `tag` | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | | No |
|
||||
|
||||
### Returns
|
||||
|
||||
|
@ -9,7 +9,7 @@ Create a line segment from the current 2-dimensional sketch origin
|
||||
along some angle (in degrees) for some relative length in the 'y' dimension.
|
||||
|
||||
```js
|
||||
angledLineOfYLength(data: AngledLineData, sketch: Sketch, tag?: TagNode) -> Sketch
|
||||
angledLineOfYLength(data: AngledLineData, sketch: Sketch, tag?: TagDeclarator) -> Sketch
|
||||
```
|
||||
|
||||
|
||||
@ -19,7 +19,7 @@ angledLineOfYLength(data: AngledLineData, sketch: Sketch, tag?: TagNode) -> Sket
|
||||
|----------|------|-------------|----------|
|
||||
| `data` | [`AngledLineData`](/docs/kcl/types/AngledLineData) | Data to draw an angled line. | Yes |
|
||||
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | A sketch is a collection of paths. | Yes |
|
||||
| `tag` | [`TagNode`](/docs/kcl/types/TagNode) | | No |
|
||||
| `tag` | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | | No |
|
||||
|
||||
### Returns
|
||||
|
||||
|
@ -9,7 +9,7 @@ Draw an angled line from the current origin, constructing a line segment
|
||||
such that the newly created line intersects the desired target line segment.
|
||||
|
||||
```js
|
||||
angledLineThatIntersects(data: AngledLineThatIntersectsData, sketch: Sketch, tag?: TagNode) -> Sketch
|
||||
angledLineThatIntersects(data: AngledLineThatIntersectsData, sketch: Sketch, tag?: TagDeclarator) -> Sketch
|
||||
```
|
||||
|
||||
|
||||
@ -19,7 +19,7 @@ angledLineThatIntersects(data: AngledLineThatIntersectsData, sketch: Sketch, tag
|
||||
|----------|------|-------------|----------|
|
||||
| `data` | [`AngledLineThatIntersectsData`](/docs/kcl/types/AngledLineThatIntersectsData) | Data for drawing an angled line that intersects with a given line. | Yes |
|
||||
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | A sketch is a collection of paths. | Yes |
|
||||
| `tag` | [`TagNode`](/docs/kcl/types/TagNode) | | No |
|
||||
| `tag` | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | | No |
|
||||
|
||||
### Returns
|
||||
|
||||
|
@ -9,7 +9,7 @@ Create a line segment from the current 2-dimensional sketch origin
|
||||
along some angle (in degrees) for some length, ending at the provided value in the 'x' dimension.
|
||||
|
||||
```js
|
||||
angledLineToX(data: AngledLineToData, sketch: Sketch, tag?: TagNode) -> Sketch
|
||||
angledLineToX(data: AngledLineToData, sketch: Sketch, tag?: TagDeclarator) -> Sketch
|
||||
```
|
||||
|
||||
|
||||
@ -19,7 +19,7 @@ angledLineToX(data: AngledLineToData, sketch: Sketch, tag?: TagNode) -> Sketch
|
||||
|----------|------|-------------|----------|
|
||||
| `data` | [`AngledLineToData`](/docs/kcl/types/AngledLineToData) | Data to draw an angled line to a point. | Yes |
|
||||
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | A sketch is a collection of paths. | Yes |
|
||||
| `tag` | [`TagNode`](/docs/kcl/types/TagNode) | | No |
|
||||
| `tag` | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | | No |
|
||||
|
||||
### Returns
|
||||
|
||||
|
@ -9,7 +9,7 @@ Create a line segment from the current 2-dimensional sketch origin
|
||||
along some angle (in degrees) for some length, ending at the provided value in the 'y' dimension.
|
||||
|
||||
```js
|
||||
angledLineToY(data: AngledLineToData, sketch: Sketch, tag?: TagNode) -> Sketch
|
||||
angledLineToY(data: AngledLineToData, sketch: Sketch, tag?: TagDeclarator) -> Sketch
|
||||
```
|
||||
|
||||
|
||||
@ -19,7 +19,7 @@ angledLineToY(data: AngledLineToData, sketch: Sketch, tag?: TagNode) -> Sketch
|
||||
|----------|------|-------------|----------|
|
||||
| `data` | [`AngledLineToData`](/docs/kcl/types/AngledLineToData) | Data to draw an angled line to a point. | Yes |
|
||||
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | A sketch is a collection of paths. | Yes |
|
||||
| `tag` | [`TagNode`](/docs/kcl/types/TagNode) | | No |
|
||||
| `tag` | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | | No |
|
||||
|
||||
### Returns
|
||||
|
||||
|
@ -11,7 +11,7 @@ The arc is constructed such that the current position of the sketch is placed al
|
||||
Unless this makes a lot of sense and feels like what you're looking for to construct your shape, you're likely looking for tangentialArc.
|
||||
|
||||
```js
|
||||
arc(data: ArcData, sketch: Sketch, tag?: TagNode) -> Sketch
|
||||
arc(data: ArcData, sketch: Sketch, tag?: TagDeclarator) -> Sketch
|
||||
```
|
||||
|
||||
|
||||
@ -21,7 +21,7 @@ arc(data: ArcData, sketch: Sketch, tag?: TagNode) -> Sketch
|
||||
|----------|------|-------------|----------|
|
||||
| `data` | [`ArcData`](/docs/kcl/types/ArcData) | Data to draw an arc. | Yes |
|
||||
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | A sketch is a collection of paths. | Yes |
|
||||
| `tag` | [`TagNode`](/docs/kcl/types/TagNode) | | No |
|
||||
| `tag` | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | | No |
|
||||
|
||||
### Returns
|
||||
|
||||
|
@ -9,7 +9,7 @@ Draw a smooth, continuous, curved line segment from the current origin to
|
||||
the desired (x, y), using a number of control points to shape the curve's shape.
|
||||
|
||||
```js
|
||||
bezierCurve(data: BezierData, sketch: Sketch, tag?: TagNode) -> Sketch
|
||||
bezierCurve(data: BezierData, sketch: Sketch, tag?: TagDeclarator) -> Sketch
|
||||
```
|
||||
|
||||
|
||||
@ -19,7 +19,7 @@ bezierCurve(data: BezierData, sketch: Sketch, tag?: TagNode) -> Sketch
|
||||
|----------|------|-------------|----------|
|
||||
| `data` | [`BezierData`](/docs/kcl/types/BezierData) | Data to draw a bezier curve. | Yes |
|
||||
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | A sketch is a collection of paths. | Yes |
|
||||
| `tag` | [`TagNode`](/docs/kcl/types/TagNode) | | No |
|
||||
| `tag` | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | | No |
|
||||
|
||||
### Returns
|
||||
|
||||
|
@ -9,7 +9,7 @@ Cut a straight transitional edge along a tagged path.
|
||||
Chamfer is similar in function and use to a fillet, except a fillet will blend the transition along an edge, rather than cut a sharp, straight transitional edge.
|
||||
|
||||
```js
|
||||
chamfer(data: ChamferData, solid: Solid, tag?: TagNode) -> Solid
|
||||
chamfer(data: ChamferData, solid: Solid, tag?: TagDeclarator) -> Solid
|
||||
```
|
||||
|
||||
|
||||
@ -19,7 +19,7 @@ chamfer(data: ChamferData, solid: Solid, tag?: TagNode) -> Solid
|
||||
|----------|------|-------------|----------|
|
||||
| `data` | [`ChamferData`](/docs/kcl/types/ChamferData) | Data for chamfers. | Yes |
|
||||
| `solid` | [`Solid`](/docs/kcl/types/Solid) | An solid is a collection of extrude surfaces. | Yes |
|
||||
| `tag` | [`TagNode`](/docs/kcl/types/TagNode) | | No |
|
||||
| `tag` | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | | No |
|
||||
|
||||
### Returns
|
||||
|
||||
|
@ -9,7 +9,7 @@ Construct a 2-dimensional circle, of the specified radius, centered at
|
||||
the provided (x, y) origin point.
|
||||
|
||||
```js
|
||||
circle(data: CircleData, sketch_surface_or_group: SketchOrSurface, tag?: TagNode) -> Sketch
|
||||
circle(data: CircleData, sketch_surface_or_group: SketchOrSurface, tag?: TagDeclarator) -> Sketch
|
||||
```
|
||||
|
||||
|
||||
@ -19,7 +19,7 @@ circle(data: CircleData, sketch_surface_or_group: SketchOrSurface, tag?: TagNode
|
||||
|----------|------|-------------|----------|
|
||||
| `data` | [`CircleData`](/docs/kcl/types/CircleData) | Data for drawing an circle | Yes |
|
||||
| `sketch_surface_or_group` | [`SketchOrSurface`](/docs/kcl/types/SketchOrSurface) | A sketch surface or a sketch. | Yes |
|
||||
| `tag` | [`TagNode`](/docs/kcl/types/TagNode) | | No |
|
||||
| `tag` | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | | No |
|
||||
|
||||
### Returns
|
||||
|
||||
|
@ -9,7 +9,7 @@ Construct a line segment from the current origin back to the profile's
|
||||
origin, ensuring the resulting 2-dimensional sketch is not open-ended.
|
||||
|
||||
```js
|
||||
close(sketch: Sketch, tag?: TagNode) -> Sketch
|
||||
close(sketch: Sketch, tag?: TagDeclarator) -> Sketch
|
||||
```
|
||||
|
||||
|
||||
@ -18,7 +18,7 @@ close(sketch: Sketch, tag?: TagNode) -> Sketch
|
||||
| Name | Type | Description | Required |
|
||||
|----------|------|-------------|----------|
|
||||
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | A sketch is a collection of paths. | Yes |
|
||||
| `tag` | [`TagNode`](/docs/kcl/types/TagNode) | | No |
|
||||
| `tag` | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | | No |
|
||||
|
||||
### Returns
|
||||
|
||||
|
@ -9,7 +9,7 @@ Blend a transitional edge along a tagged path, smoothing the sharp edge.
|
||||
Fillet is similar in function and use to a chamfer, except a chamfer will cut a sharp transition along an edge while fillet will smoothly blend the transition.
|
||||
|
||||
```js
|
||||
fillet(data: FilletData, solid: Solid, tag?: TagNode) -> Solid
|
||||
fillet(data: FilletData, solid: Solid, tag?: TagDeclarator) -> Solid
|
||||
```
|
||||
|
||||
|
||||
@ -19,7 +19,7 @@ fillet(data: FilletData, solid: Solid, tag?: TagNode) -> Solid
|
||||
|----------|------|-------------|----------|
|
||||
| `data` | [`FilletData`](/docs/kcl/types/FilletData) | Data for fillets. | Yes |
|
||||
| `solid` | [`Solid`](/docs/kcl/types/Solid) | An solid is a collection of extrude surfaces. | Yes |
|
||||
| `tag` | [`TagNode`](/docs/kcl/types/TagNode) | | No |
|
||||
| `tag` | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | | No |
|
||||
|
||||
### Returns
|
||||
|
||||
|
@ -9,7 +9,7 @@ Draw a line relative to the current origin to a specified (x, y) away
|
||||
from the current position.
|
||||
|
||||
```js
|
||||
line(delta: [number], sketch: Sketch, tag?: TagNode) -> Sketch
|
||||
line(delta: [number], sketch: Sketch, tag?: TagDeclarator) -> Sketch
|
||||
```
|
||||
|
||||
|
||||
@ -19,7 +19,7 @@ line(delta: [number], sketch: Sketch, tag?: TagNode) -> Sketch
|
||||
|----------|------|-------------|----------|
|
||||
| `delta` | `[number]` | | Yes |
|
||||
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | A sketch is a collection of paths. | Yes |
|
||||
| `tag` | [`TagNode`](/docs/kcl/types/TagNode) | | No |
|
||||
| `tag` | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | | No |
|
||||
|
||||
### Returns
|
||||
|
||||
|
@ -9,7 +9,7 @@ Draw a line from the current origin to some absolute (x, y) point.
|
||||
|
||||
|
||||
```js
|
||||
lineTo(to: [number], sketch: Sketch, tag?: TagNode) -> Sketch
|
||||
lineTo(to: [number], sketch: Sketch, tag?: TagDeclarator) -> Sketch
|
||||
```
|
||||
|
||||
|
||||
@ -19,7 +19,7 @@ lineTo(to: [number], sketch: Sketch, tag?: TagNode) -> Sketch
|
||||
|----------|------|-------------|----------|
|
||||
| `to` | `[number]` | | Yes |
|
||||
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | A sketch is a collection of paths. | Yes |
|
||||
| `tag` | [`TagNode`](/docs/kcl/types/TagNode) | | No |
|
||||
| `tag` | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | | No |
|
||||
|
||||
### Returns
|
||||
|
||||
|
@ -9,7 +9,7 @@ Start a new profile at a given point.
|
||||
|
||||
|
||||
```js
|
||||
startProfileAt(to: [number], sketch_surface: SketchSurface, tag?: TagNode) -> Sketch
|
||||
startProfileAt(to: [number], sketch_surface: SketchSurface, tag?: TagDeclarator) -> Sketch
|
||||
```
|
||||
|
||||
|
||||
@ -19,7 +19,7 @@ startProfileAt(to: [number], sketch_surface: SketchSurface, tag?: TagNode) -> Sk
|
||||
|----------|------|-------------|----------|
|
||||
| `to` | `[number]` | | Yes |
|
||||
| `sketch_surface` | [`SketchSurface`](/docs/kcl/types/SketchSurface) | A sketch type. | Yes |
|
||||
| `tag` | [`TagNode`](/docs/kcl/types/TagNode) | | No |
|
||||
| `tag` | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | | No |
|
||||
|
||||
### Returns
|
||||
|
||||
|
15819
docs/kcl/std.json
15819
docs/kcl/std.json
File diff suppressed because it is too large
Load Diff
@ -9,7 +9,7 @@ Draw a curved line segment along part of an imaginary circle.
|
||||
The arc is constructed such that the last line segment is placed tangent to the imaginary circle of the specified radius. The resulting arc is the segment of the imaginary circle from that tangent point for 'offset' degrees along the imaginary circle.
|
||||
|
||||
```js
|
||||
tangentialArc(data: TangentialArcData, sketch: Sketch, tag?: TagNode) -> Sketch
|
||||
tangentialArc(data: TangentialArcData, sketch: Sketch, tag?: TagDeclarator) -> Sketch
|
||||
```
|
||||
|
||||
|
||||
@ -19,7 +19,7 @@ tangentialArc(data: TangentialArcData, sketch: Sketch, tag?: TagNode) -> Sketch
|
||||
|----------|------|-------------|----------|
|
||||
| `data` | [`TangentialArcData`](/docs/kcl/types/TangentialArcData) | Data to draw a tangential arc. | Yes |
|
||||
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | A sketch is a collection of paths. | Yes |
|
||||
| `tag` | [`TagNode`](/docs/kcl/types/TagNode) | | No |
|
||||
| `tag` | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | | No |
|
||||
|
||||
### Returns
|
||||
|
||||
|
@ -9,7 +9,7 @@ Starting at the current sketch's origin, draw a curved line segment along
|
||||
some part of an imaginary circle until it reaches the desired (x, y) coordinates.
|
||||
|
||||
```js
|
||||
tangentialArcTo(to: [number], sketch: Sketch, tag?: TagNode) -> Sketch
|
||||
tangentialArcTo(to: [number], sketch: Sketch, tag?: TagDeclarator) -> Sketch
|
||||
```
|
||||
|
||||
|
||||
@ -19,7 +19,7 @@ tangentialArcTo(to: [number], sketch: Sketch, tag?: TagNode) -> Sketch
|
||||
|----------|------|-------------|----------|
|
||||
| `to` | `[number]` | | Yes |
|
||||
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | A sketch is a collection of paths. | Yes |
|
||||
| `tag` | [`TagNode`](/docs/kcl/types/TagNode) | | No |
|
||||
| `tag` | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | | No |
|
||||
|
||||
### Returns
|
||||
|
||||
|
@ -9,7 +9,7 @@ Starting at the current sketch's origin, draw a curved line segment along
|
||||
some part of an imaginary circle until it reaches a point the given (x, y) distance away.
|
||||
|
||||
```js
|
||||
tangentialArcToRelative(delta: [number], sketch: Sketch, tag?: TagNode) -> Sketch
|
||||
tangentialArcToRelative(delta: [number], sketch: Sketch, tag?: TagDeclarator) -> Sketch
|
||||
```
|
||||
|
||||
|
||||
@ -19,7 +19,7 @@ tangentialArcToRelative(delta: [number], sketch: Sketch, tag?: TagNode) -> Sketc
|
||||
|----------|------|-------------|----------|
|
||||
| `delta` | `[number]` | | Yes |
|
||||
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | A sketch is a collection of paths. | Yes |
|
||||
| `tag` | [`TagNode`](/docs/kcl/types/TagNode) | | No |
|
||||
| `tag` | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | | No |
|
||||
|
||||
### Returns
|
||||
|
||||
|
@ -18,7 +18,7 @@ A base path.
|
||||
|----------|------|-------------|----------|
|
||||
| `from` |`[number, number]`| The from point. | No |
|
||||
| `to` |`[number, number]`| The to point. | No |
|
||||
| `tag` |[`TagNode`](/docs/kcl/types/TagNode)| The tag of the path. | No |
|
||||
| `tag` |[`TagDeclarator`](/docs/kcl/types#tag-declaration)| The tag of the path. | No |
|
||||
| `__geoMeta` |[`GeoMeta`](/docs/kcl/types/GeoMeta)| Metadata. | No |
|
||||
|
||||
|
||||
|
@ -22,10 +22,12 @@ layout: manual
|
||||
|
||||
| Property | Type | Description | Required |
|
||||
|----------|------|-------------|----------|
|
||||
| `type` |enum: [`Literal`](/docs/kcl/types/Literal)| | No |
|
||||
| `kind` |[`Literal`](/docs/kcl/types/Literal)| | No |
|
||||
| `type` |enum: `Literal`| | No |
|
||||
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||
| `end` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||
| `value` |[`LiteralValue`](/docs/kcl/types/LiteralValue)| | No |
|
||||
| `raw` |`string`| | No |
|
||||
| `digest` |`[, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`]`| | No |
|
||||
|
||||
|
||||
----
|
||||
@ -41,9 +43,10 @@ layout: manual
|
||||
| Property | Type | Description | Required |
|
||||
|----------|------|-------------|----------|
|
||||
| `type` |enum: [`Identifier`](/docs/kcl/types/Identifier)| | No |
|
||||
| `kind` |[`Identifier`](/docs/kcl/types/Identifier)| | No |
|
||||
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||
| `end` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||
| `name` |`string`| | No |
|
||||
| `digest` |`[, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`]`| | No |
|
||||
|
||||
|
||||
----
|
||||
@ -58,10 +61,13 @@ layout: manual
|
||||
|
||||
| Property | Type | Description | Required |
|
||||
|----------|------|-------------|----------|
|
||||
| `type` |enum: [`BinaryExpression`](/docs/kcl/types/BinaryExpression)| | No |
|
||||
| `kind` |[`BinaryExpression`](/docs/kcl/types/BinaryExpression)| | No |
|
||||
| `type` |enum: `BinaryExpression`| | No |
|
||||
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||
| `end` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||
| `operator` |[`BinaryOperator`](/docs/kcl/types/BinaryOperator)| | No |
|
||||
| `left` |[`BinaryPart`](/docs/kcl/types/BinaryPart)| | No |
|
||||
| `right` |[`BinaryPart`](/docs/kcl/types/BinaryPart)| | No |
|
||||
| `digest` |`[, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`]`| | No |
|
||||
|
||||
|
||||
----
|
||||
@ -76,10 +82,13 @@ layout: manual
|
||||
|
||||
| Property | Type | Description | Required |
|
||||
|----------|------|-------------|----------|
|
||||
| `type` |enum: [`CallExpression`](/docs/kcl/types/CallExpression)| | No |
|
||||
| `kind` |[`CallExpression`](/docs/kcl/types/CallExpression)| | No |
|
||||
| `type` |enum: `CallExpression`| | No |
|
||||
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||
| `end` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||
| `callee` |[`Identifier`](/docs/kcl/types/Identifier)| | No |
|
||||
| `arguments` |`[` [`Expr`](/docs/kcl/types/Expr) `]`| | No |
|
||||
| `optional` |`boolean`| | No |
|
||||
| `digest` |`[, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`]`| | No |
|
||||
|
||||
|
||||
----
|
||||
@ -94,10 +103,12 @@ layout: manual
|
||||
|
||||
| Property | Type | Description | Required |
|
||||
|----------|------|-------------|----------|
|
||||
| `type` |enum: [`UnaryExpression`](/docs/kcl/types/UnaryExpression)| | No |
|
||||
| `kind` |[`UnaryExpression`](/docs/kcl/types/UnaryExpression)| | No |
|
||||
| `type` |enum: `UnaryExpression`| | No |
|
||||
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||
| `end` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||
| `operator` |[`UnaryOperator`](/docs/kcl/types/UnaryOperator)| | No |
|
||||
| `argument` |[`BinaryPart`](/docs/kcl/types/BinaryPart)| | No |
|
||||
| `digest` |`[, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`]`| | No |
|
||||
|
||||
|
||||
----
|
||||
@ -112,10 +123,13 @@ layout: manual
|
||||
|
||||
| Property | Type | Description | Required |
|
||||
|----------|------|-------------|----------|
|
||||
| `type` |enum: [`MemberExpression`](/docs/kcl/types/MemberExpression)| | No |
|
||||
| `kind` |[`MemberExpression`](/docs/kcl/types/MemberExpression)| | No |
|
||||
| `type` |enum: `MemberExpression`| | No |
|
||||
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||
| `end` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||
| `object` |[`MemberObject`](/docs/kcl/types/MemberObject)| | No |
|
||||
| `property` |[`LiteralIdentifier`](/docs/kcl/types/LiteralIdentifier)| | No |
|
||||
| `computed` |`boolean`| | No |
|
||||
| `digest` |`[, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`]`| | No |
|
||||
|
||||
|
||||
----
|
||||
@ -130,10 +144,14 @@ layout: manual
|
||||
|
||||
| Property | Type | Description | Required |
|
||||
|----------|------|-------------|----------|
|
||||
| `type` |enum: [`IfExpression`](/docs/kcl/types/IfExpression)| | No |
|
||||
| `kind` |[`IfExpression`](/docs/kcl/types/IfExpression)| | No |
|
||||
| `type` |enum: `IfExpression`| | No |
|
||||
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||
| `end` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||
| `cond` |[`Expr`](/docs/kcl/types/Expr)| | No |
|
||||
| `then_val` |[`Program`](/docs/kcl/types/Program)| | No |
|
||||
| `else_ifs` |`[` [`ElseIf`](/docs/kcl/types/ElseIf) `]`| | No |
|
||||
| `final_else` |[`Program`](/docs/kcl/types/Program)| | No |
|
||||
| `digest` |`[, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`]`| | No |
|
||||
|
||||
|
||||
----
|
||||
|
@ -22,10 +22,13 @@ layout: manual
|
||||
|
||||
| Property | Type | Description | Required |
|
||||
|----------|------|-------------|----------|
|
||||
| `type` |enum: [`ImportStatement`](/docs/kcl/types/ImportStatement)| | No |
|
||||
| `kind` |[`ImportStatement`](/docs/kcl/types/ImportStatement)| | No |
|
||||
| `type` |enum: `ImportStatement`| | No |
|
||||
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||
| `end` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||
| `items` |`[` [`ImportItem`](/docs/kcl/types/ImportItem) `]`| | No |
|
||||
| `path` |`string`| | No |
|
||||
| `raw_path` |`string`| | No |
|
||||
| `digest` |`[, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`]`| | No |
|
||||
|
||||
|
||||
----
|
||||
@ -40,10 +43,11 @@ layout: manual
|
||||
|
||||
| Property | Type | Description | Required |
|
||||
|----------|------|-------------|----------|
|
||||
| `type` |enum: [`ExpressionStatement`](/docs/kcl/types/ExpressionStatement)| | No |
|
||||
| `kind` |[`ExpressionStatement`](/docs/kcl/types/ExpressionStatement)| | No |
|
||||
| `type` |enum: `ExpressionStatement`| | No |
|
||||
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||
| `end` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||
| `expression` |[`Expr`](/docs/kcl/types/Expr)| | No |
|
||||
| `digest` |`[, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`]`| | No |
|
||||
|
||||
|
||||
----
|
||||
@ -58,10 +62,13 @@ layout: manual
|
||||
|
||||
| Property | Type | Description | Required |
|
||||
|----------|------|-------------|----------|
|
||||
| `type` |enum: [`VariableDeclaration`](/docs/kcl/types/VariableDeclaration)| | No |
|
||||
| `kind` |[`VariableDeclaration`](/docs/kcl/types/VariableDeclaration)| | No |
|
||||
| `type` |enum: `VariableDeclaration`| | No |
|
||||
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||
| `end` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||
| `declarations` |`[` [`VariableDeclarator`](/docs/kcl/types/VariableDeclarator) `]`| | No |
|
||||
| `visibility` |[`ItemVisibility`](/docs/kcl/types/ItemVisibility)| | No |
|
||||
| `kind` |[`VariableKind`](/docs/kcl/types/VariableKind)| | No |
|
||||
| `digest` |`[, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`]`| | No |
|
||||
|
||||
|
||||
----
|
||||
@ -76,10 +83,11 @@ layout: manual
|
||||
|
||||
| Property | Type | Description | Required |
|
||||
|----------|------|-------------|----------|
|
||||
| `type` |enum: [`ReturnStatement`](/docs/kcl/types/ReturnStatement)| | No |
|
||||
| `kind` |[`ReturnStatement`](/docs/kcl/types/ReturnStatement)| | No |
|
||||
| `type` |enum: `ReturnStatement`| | No |
|
||||
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||
| `end` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||
| `argument` |[`Expr`](/docs/kcl/types/Expr)| | No |
|
||||
| `digest` |`[, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`]`| | No |
|
||||
|
||||
|
||||
----
|
||||
|
@ -28,7 +28,7 @@ A fillet.
|
||||
| `id` |`string`| The id of the engine command that called this fillet. | No |
|
||||
| `radius` |`number`| | No |
|
||||
| `edgeId` |`string`| The engine id of the edge to fillet. | No |
|
||||
| `tag` |[`TagNode`](/docs/kcl/types/TagNode)| | No |
|
||||
| `tag` |[`TagDeclarator`](/docs/kcl/types#tag-declaration)| | No |
|
||||
|
||||
|
||||
----
|
||||
@ -48,7 +48,7 @@ A chamfer.
|
||||
| `id` |`string`| The id of the engine command that called this chamfer. | No |
|
||||
| `length` |`number`| | No |
|
||||
| `edgeId` |`string`| The engine id of the edge to chamfer. | No |
|
||||
| `tag` |[`TagNode`](/docs/kcl/types/TagNode)| | No |
|
||||
| `tag` |[`TagDeclarator`](/docs/kcl/types#tag-declaration)| | No |
|
||||
|
||||
|
||||
----
|
||||
|
@ -15,8 +15,10 @@ layout: manual
|
||||
|
||||
| Property | Type | Description | Required |
|
||||
|----------|------|-------------|----------|
|
||||
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||
| `end` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||
| `cond` |[`Expr`](/docs/kcl/types/Expr)| | No |
|
||||
| `then_val` |[`UnboxedNode_for_Program`](/docs/kcl/types/UnboxedNode_for_Program)| | No |
|
||||
| `then_val` |[`Program`](/docs/kcl/types/Program)| | No |
|
||||
| `digest` |`[, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`]`| | No |
|
||||
|
||||
|
||||
|
@ -23,10 +23,12 @@ An expression can be evaluated to yield a single KCL value.
|
||||
|
||||
| Property | Type | Description | Required |
|
||||
|----------|------|-------------|----------|
|
||||
| `type` |enum: [`Literal`](/docs/kcl/types/Literal)| | No |
|
||||
| `kind` |[`Literal`](/docs/kcl/types/Literal)| An expression can be evaluated to yield a single KCL value. | No |
|
||||
| `type` |enum: `Literal`| | No |
|
||||
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||
| `end` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||
| `value` |[`LiteralValue`](/docs/kcl/types/LiteralValue)| An expression can be evaluated to yield a single KCL value. | No |
|
||||
| `raw` |`string`| | No |
|
||||
| `digest` |`[, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`]`| | No |
|
||||
|
||||
|
||||
----
|
||||
@ -42,9 +44,10 @@ An expression can be evaluated to yield a single KCL value.
|
||||
| Property | Type | Description | Required |
|
||||
|----------|------|-------------|----------|
|
||||
| `type` |enum: [`Identifier`](/docs/kcl/types/Identifier)| | No |
|
||||
| `kind` |[`Identifier`](/docs/kcl/types/Identifier)| An expression can be evaluated to yield a single KCL value. | No |
|
||||
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||
| `end` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||
| `name` |`string`| | No |
|
||||
| `digest` |`[, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`]`| | No |
|
||||
|
||||
|
||||
----
|
||||
@ -60,9 +63,10 @@ An expression can be evaluated to yield a single KCL value.
|
||||
| Property | Type | Description | Required |
|
||||
|----------|------|-------------|----------|
|
||||
| `type` |enum: [`TagDeclarator`](/docs/kcl/types#tag-declaration)| | No |
|
||||
| `kind` |[`TagDeclarator`](/docs/kcl/types#tag-declaration)| An expression can be evaluated to yield a single KCL value. | No |
|
||||
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||
| `end` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||
| `value` |`string`| | No |
|
||||
| `digest` |`[, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`]`| | No |
|
||||
|
||||
|
||||
----
|
||||
@ -77,10 +81,13 @@ An expression can be evaluated to yield a single KCL value.
|
||||
|
||||
| Property | Type | Description | Required |
|
||||
|----------|------|-------------|----------|
|
||||
| `type` |enum: [`BinaryExpression`](/docs/kcl/types/BinaryExpression)| | No |
|
||||
| `kind` |[`BinaryExpression`](/docs/kcl/types/BinaryExpression)| An expression can be evaluated to yield a single KCL value. | No |
|
||||
| `type` |enum: `BinaryExpression`| | No |
|
||||
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||
| `end` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||
| `operator` |[`BinaryOperator`](/docs/kcl/types/BinaryOperator)| An expression can be evaluated to yield a single KCL value. | No |
|
||||
| `left` |[`BinaryPart`](/docs/kcl/types/BinaryPart)| An expression can be evaluated to yield a single KCL value. | No |
|
||||
| `right` |[`BinaryPart`](/docs/kcl/types/BinaryPart)| An expression can be evaluated to yield a single KCL value. | No |
|
||||
| `digest` |`[, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`]`| | No |
|
||||
|
||||
|
||||
----
|
||||
@ -96,9 +103,11 @@ An expression can be evaluated to yield a single KCL value.
|
||||
| Property | Type | Description | Required |
|
||||
|----------|------|-------------|----------|
|
||||
| `type` |enum: [`FunctionExpression`](/docs/kcl/types/FunctionExpression)| | No |
|
||||
| `kind` |[`FunctionExpression`](/docs/kcl/types/FunctionExpression)| An expression can be evaluated to yield a single KCL value. | No |
|
||||
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||
| `end` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||
| `params` |`[` [`Parameter`](/docs/kcl/types/Parameter) `]`| | No |
|
||||
| `body` |[`Program`](/docs/kcl/types/Program)| An expression can be evaluated to yield a single KCL value. | No |
|
||||
| `digest` |`[, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`]`| | No |
|
||||
|
||||
|
||||
----
|
||||
@ -113,10 +122,13 @@ An expression can be evaluated to yield a single KCL value.
|
||||
|
||||
| Property | Type | Description | Required |
|
||||
|----------|------|-------------|----------|
|
||||
| `type` |enum: [`CallExpression`](/docs/kcl/types/CallExpression)| | No |
|
||||
| `kind` |[`CallExpression`](/docs/kcl/types/CallExpression)| An expression can be evaluated to yield a single KCL value. | No |
|
||||
| `type` |enum: `CallExpression`| | No |
|
||||
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||
| `end` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||
| `callee` |[`Identifier`](/docs/kcl/types/Identifier)| An expression can be evaluated to yield a single KCL value. | No |
|
||||
| `arguments` |`[` [`Expr`](/docs/kcl/types/Expr) `]`| | No |
|
||||
| `optional` |`boolean`| | No |
|
||||
| `digest` |`[, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`]`| | No |
|
||||
|
||||
|
||||
----
|
||||
@ -131,10 +143,12 @@ An expression can be evaluated to yield a single KCL value.
|
||||
|
||||
| Property | Type | Description | Required |
|
||||
|----------|------|-------------|----------|
|
||||
| `type` |enum: [`PipeExpression`](/docs/kcl/types/PipeExpression)| | No |
|
||||
| `kind` |[`PipeExpression`](/docs/kcl/types/PipeExpression)| An expression can be evaluated to yield a single KCL value. | No |
|
||||
| `type` |enum: `PipeExpression`| | No |
|
||||
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||
| `end` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||
| `body` |`[` [`Expr`](/docs/kcl/types/Expr) `]`| | No |
|
||||
| `nonCodeMeta` |[`NonCodeMeta`](/docs/kcl/types/NonCodeMeta)| An expression can be evaluated to yield a single KCL value. | No |
|
||||
| `digest` |`[, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`]`| | No |
|
||||
|
||||
|
||||
----
|
||||
@ -149,10 +163,10 @@ An expression can be evaluated to yield a single KCL value.
|
||||
|
||||
| Property | Type | Description | Required |
|
||||
|----------|------|-------------|----------|
|
||||
| `type` |enum: [`PipeSubstitution`](/docs/kcl/types/PipeSubstitution)| | No |
|
||||
| `kind` |[`PipeSubstitution`](/docs/kcl/types/PipeSubstitution)| An expression can be evaluated to yield a single KCL value. | No |
|
||||
| `type` |enum: `PipeSubstitution`| | No |
|
||||
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||
| `end` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||
| `digest` |`[, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`]`| | No |
|
||||
|
||||
|
||||
----
|
||||
@ -167,10 +181,12 @@ An expression can be evaluated to yield a single KCL value.
|
||||
|
||||
| Property | Type | Description | Required |
|
||||
|----------|------|-------------|----------|
|
||||
| `type` |enum: [`ArrayExpression`](/docs/kcl/types/ArrayExpression)| | No |
|
||||
| `kind` |[`ArrayExpression`](/docs/kcl/types/ArrayExpression)| An expression can be evaluated to yield a single KCL value. | No |
|
||||
| `type` |enum: `ArrayExpression`| | No |
|
||||
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||
| `end` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||
| `elements` |`[` [`Expr`](/docs/kcl/types/Expr) `]`| | No |
|
||||
| `nonCodeMeta` |[`NonCodeMeta`](/docs/kcl/types/NonCodeMeta)| An expression can be evaluated to yield a single KCL value. | No |
|
||||
| `digest` |`[, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`]`| | No |
|
||||
|
||||
|
||||
----
|
||||
@ -185,10 +201,13 @@ An expression can be evaluated to yield a single KCL value.
|
||||
|
||||
| Property | Type | Description | Required |
|
||||
|----------|------|-------------|----------|
|
||||
| `type` |enum: [`ArrayRangeExpression`](/docs/kcl/types/ArrayRangeExpression)| | No |
|
||||
| `kind` |[`ArrayRangeExpression`](/docs/kcl/types/ArrayRangeExpression)| An expression can be evaluated to yield a single KCL value. | No |
|
||||
| `type` |enum: `ArrayRangeExpression`| | No |
|
||||
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||
| `end` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||
| `startElement` |[`Expr`](/docs/kcl/types/Expr)| An expression can be evaluated to yield a single KCL value. | No |
|
||||
| `endElement` |[`Expr`](/docs/kcl/types/Expr)| An expression can be evaluated to yield a single KCL value. | No |
|
||||
| `endInclusive` |`boolean`| Is the `end_element` included in the range? | No |
|
||||
| `digest` |`[, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`]`| | No |
|
||||
|
||||
|
||||
----
|
||||
@ -203,10 +222,12 @@ An expression can be evaluated to yield a single KCL value.
|
||||
|
||||
| Property | Type | Description | Required |
|
||||
|----------|------|-------------|----------|
|
||||
| `type` |enum: [`ObjectExpression`](/docs/kcl/types/ObjectExpression)| | No |
|
||||
| `kind` |[`ObjectExpression`](/docs/kcl/types/ObjectExpression)| An expression can be evaluated to yield a single KCL value. | No |
|
||||
| `type` |enum: `ObjectExpression`| | No |
|
||||
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||
| `end` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||
| `properties` |`[` [`ObjectProperty`](/docs/kcl/types/ObjectProperty) `]`| | No |
|
||||
| `nonCodeMeta` |[`NonCodeMeta`](/docs/kcl/types/NonCodeMeta)| An expression can be evaluated to yield a single KCL value. | No |
|
||||
| `digest` |`[, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`]`| | No |
|
||||
|
||||
|
||||
----
|
||||
@ -221,10 +242,13 @@ An expression can be evaluated to yield a single KCL value.
|
||||
|
||||
| Property | Type | Description | Required |
|
||||
|----------|------|-------------|----------|
|
||||
| `type` |enum: [`MemberExpression`](/docs/kcl/types/MemberExpression)| | No |
|
||||
| `kind` |[`MemberExpression`](/docs/kcl/types/MemberExpression)| An expression can be evaluated to yield a single KCL value. | No |
|
||||
| `type` |enum: `MemberExpression`| | No |
|
||||
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||
| `end` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||
| `object` |[`MemberObject`](/docs/kcl/types/MemberObject)| An expression can be evaluated to yield a single KCL value. | No |
|
||||
| `property` |[`LiteralIdentifier`](/docs/kcl/types/LiteralIdentifier)| An expression can be evaluated to yield a single KCL value. | No |
|
||||
| `computed` |`boolean`| | No |
|
||||
| `digest` |`[, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`]`| | No |
|
||||
|
||||
|
||||
----
|
||||
@ -239,10 +263,12 @@ An expression can be evaluated to yield a single KCL value.
|
||||
|
||||
| Property | Type | Description | Required |
|
||||
|----------|------|-------------|----------|
|
||||
| `type` |enum: [`UnaryExpression`](/docs/kcl/types/UnaryExpression)| | No |
|
||||
| `kind` |[`UnaryExpression`](/docs/kcl/types/UnaryExpression)| An expression can be evaluated to yield a single KCL value. | No |
|
||||
| `type` |enum: `UnaryExpression`| | No |
|
||||
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||
| `end` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||
| `operator` |[`UnaryOperator`](/docs/kcl/types/UnaryOperator)| An expression can be evaluated to yield a single KCL value. | No |
|
||||
| `argument` |[`BinaryPart`](/docs/kcl/types/BinaryPart)| An expression can be evaluated to yield a single KCL value. | No |
|
||||
| `digest` |`[, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`]`| | No |
|
||||
|
||||
|
||||
----
|
||||
@ -257,10 +283,14 @@ An expression can be evaluated to yield a single KCL value.
|
||||
|
||||
| Property | Type | Description | Required |
|
||||
|----------|------|-------------|----------|
|
||||
| `type` |enum: [`IfExpression`](/docs/kcl/types/IfExpression)| | No |
|
||||
| `kind` |[`IfExpression`](/docs/kcl/types/IfExpression)| An expression can be evaluated to yield a single KCL value. | No |
|
||||
| `type` |enum: `IfExpression`| | No |
|
||||
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||
| `end` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||
| `cond` |[`Expr`](/docs/kcl/types/Expr)| An expression can be evaluated to yield a single KCL value. | No |
|
||||
| `then_val` |[`Program`](/docs/kcl/types/Program)| An expression can be evaluated to yield a single KCL value. | No |
|
||||
| `else_ifs` |`[` [`ElseIf`](/docs/kcl/types/ElseIf) `]`| | No |
|
||||
| `final_else` |[`Program`](/docs/kcl/types/Program)| An expression can be evaluated to yield a single KCL value. | No |
|
||||
| `digest` |`[, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`]`| | No |
|
||||
|
||||
|
||||
----
|
||||
|
@ -26,7 +26,7 @@ An extrude plane.
|
||||
|----------|------|-------------|----------|
|
||||
| `type` |enum: `extrudePlane`| | No |
|
||||
| `faceId` |`string`| The face id for the extrude plane. | No |
|
||||
| `tag` |[`TagNode`](/docs/kcl/types/TagNode)| The tag. | No |
|
||||
| `tag` |[`TagDeclarator`](/docs/kcl/types#tag-declaration)| The tag. | No |
|
||||
| `id` |`string`| The id of the geometry. | No |
|
||||
| `sourceRange` |`SourceRange`| The source range. | No |
|
||||
|
||||
@ -46,7 +46,7 @@ An extruded arc.
|
||||
|----------|------|-------------|----------|
|
||||
| `type` |enum: `extrudeArc`| | No |
|
||||
| `faceId` |`string`| The face id for the extrude plane. | No |
|
||||
| `tag` |[`TagNode`](/docs/kcl/types/TagNode)| The tag. | No |
|
||||
| `tag` |[`TagDeclarator`](/docs/kcl/types#tag-declaration)| The tag. | No |
|
||||
| `id` |`string`| The id of the geometry. | No |
|
||||
| `sourceRange` |`SourceRange`| The source range. | No |
|
||||
|
||||
@ -66,7 +66,7 @@ Geometry metadata.
|
||||
|----------|------|-------------|----------|
|
||||
| `type` |enum: `chamfer`| | No |
|
||||
| `faceId` |`string`| The id for the chamfer surface. | No |
|
||||
| `tag` |[`TagNode`](/docs/kcl/types/TagNode)| The tag. | No |
|
||||
| `tag` |[`TagDeclarator`](/docs/kcl/types#tag-declaration)| The tag. | No |
|
||||
| `id` |`string`| The id of the geometry. | No |
|
||||
| `sourceRange` |`SourceRange`| The source range. | No |
|
||||
|
||||
@ -86,7 +86,7 @@ Geometry metadata.
|
||||
|----------|------|-------------|----------|
|
||||
| `type` |enum: `fillet`| | No |
|
||||
| `faceId` |`string`| The id for the fillet surface. | No |
|
||||
| `tag` |[`TagNode`](/docs/kcl/types/TagNode)| The tag. | No |
|
||||
| `tag` |[`TagDeclarator`](/docs/kcl/types#tag-declaration)| The tag. | No |
|
||||
| `id` |`string`| The id of the geometry. | No |
|
||||
| `sourceRange` |`SourceRange`| The source range. | No |
|
||||
|
||||
|
@ -15,8 +15,10 @@ layout: manual
|
||||
|
||||
| Property | Type | Description | Required |
|
||||
|----------|------|-------------|----------|
|
||||
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||
| `end` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||
| `params` |`[` [`Parameter`](/docs/kcl/types/Parameter) `]`| | No |
|
||||
| `body` |[`UnboxedNode_for_Program`](/docs/kcl/types/UnboxedNode_for_Program)| | No |
|
||||
| `body` |[`Program`](/docs/kcl/types/Program)| | No |
|
||||
| `digest` |`[, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`]`| | No |
|
||||
|
||||
|
||||
|
@ -15,6 +15,8 @@ layout: manual
|
||||
|
||||
| Property | Type | Description | Required |
|
||||
|----------|------|-------------|----------|
|
||||
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||
| `end` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||
| `name` |`string`| | No |
|
||||
| `digest` |`[, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`]`| | No |
|
||||
|
||||
|
@ -15,8 +15,10 @@ layout: manual
|
||||
|
||||
| Property | Type | Description | Required |
|
||||
|----------|------|-------------|----------|
|
||||
| `name` |[`UnboxedNode_for_Identifier`](/docs/kcl/types/UnboxedNode_for_Identifier)| Name of the item to import. | No |
|
||||
| `alias` |[`UnboxedNode_for_Identifier`](/docs/kcl/types/UnboxedNode_for_Identifier)| Rename the item using an identifier after "as". | No |
|
||||
| `name` |[`Identifier`](/docs/kcl/types/Identifier)| Name of the item to import. | No |
|
||||
| `alias` |[`Identifier`](/docs/kcl/types/Identifier)| Rename the item using an identifier after "as". | No |
|
||||
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||
| `end` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||
| `digest` |`[, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`]`| | No |
|
||||
|
||||
|
||||
|
@ -59,9 +59,10 @@ Any KCL value.
|
||||
| Property | Type | Description | Required |
|
||||
|----------|------|-------------|----------|
|
||||
| `type` |enum: [`TagDeclarator`](/docs/kcl/types#tag-declaration)| | No |
|
||||
| `kind` |[`TagDeclarator`](/docs/kcl/types#tag-declaration)| Any KCL value. | No |
|
||||
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||
| `end` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||
| `value` |`string`| | No |
|
||||
| `digest` |`[, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`]`| | No |
|
||||
|
||||
|
||||
----
|
||||
@ -182,7 +183,7 @@ Data for an imported geometry.
|
||||
| Property | Type | Description | Required |
|
||||
|----------|------|-------------|----------|
|
||||
| `type` |enum: `Function`| | No |
|
||||
| `expression` |[`UnboxedNode_for_FunctionExpression`](/docs/kcl/types/UnboxedNode_for_FunctionExpression)| Any KCL value. | No |
|
||||
| `expression` |[`FunctionExpression`](/docs/kcl/types/FunctionExpression)| Any KCL value. | No |
|
||||
| `memory` |[`ProgramMemory`](/docs/kcl/types/ProgramMemory)| Any KCL value. | No |
|
||||
| `__meta` |`[` [`Metadata`](/docs/kcl/types/Metadata) `]`| | No |
|
||||
|
||||
|
@ -23,9 +23,10 @@ layout: manual
|
||||
| Property | Type | Description | Required |
|
||||
|----------|------|-------------|----------|
|
||||
| `type` |enum: [`Identifier`](/docs/kcl/types/Identifier)| | No |
|
||||
| `kind` |[`Identifier`](/docs/kcl/types/Identifier)| | No |
|
||||
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||
| `end` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||
| `name` |`string`| | No |
|
||||
| `digest` |`[, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`]`| | No |
|
||||
|
||||
|
||||
----
|
||||
@ -40,10 +41,12 @@ layout: manual
|
||||
|
||||
| Property | Type | Description | Required |
|
||||
|----------|------|-------------|----------|
|
||||
| `type` |enum: [`Literal`](/docs/kcl/types/Literal)| | No |
|
||||
| `kind` |[`Literal`](/docs/kcl/types/Literal)| | No |
|
||||
| `type` |enum: `Literal`| | No |
|
||||
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||
| `end` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||
| `value` |[`LiteralValue`](/docs/kcl/types/LiteralValue)| | No |
|
||||
| `raw` |`string`| | No |
|
||||
| `digest` |`[, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`]`| | No |
|
||||
|
||||
|
||||
----
|
||||
|
@ -22,10 +22,13 @@ layout: manual
|
||||
|
||||
| Property | Type | Description | Required |
|
||||
|----------|------|-------------|----------|
|
||||
| `type` |enum: [`MemberExpression`](/docs/kcl/types/MemberExpression)| | No |
|
||||
| `kind` |[`MemberExpression`](/docs/kcl/types/MemberExpression)| | No |
|
||||
| `type` |enum: `MemberExpression`| | No |
|
||||
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||
| `end` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||
| `object` |[`MemberObject`](/docs/kcl/types/MemberObject)| | No |
|
||||
| `property` |[`LiteralIdentifier`](/docs/kcl/types/LiteralIdentifier)| | No |
|
||||
| `computed` |`boolean`| | No |
|
||||
| `digest` |`[, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`]`| | No |
|
||||
|
||||
|
||||
----
|
||||
@ -41,9 +44,10 @@ layout: manual
|
||||
| Property | Type | Description | Required |
|
||||
|----------|------|-------------|----------|
|
||||
| `type` |enum: [`Identifier`](/docs/kcl/types/Identifier)| | No |
|
||||
| `kind` |[`Identifier`](/docs/kcl/types/Identifier)| | No |
|
||||
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||
| `end` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||
| `name` |`string`| | No |
|
||||
| `digest` |`[, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`]`| | No |
|
||||
|
||||
|
||||
----
|
||||
|
@ -16,7 +16,7 @@ layout: manual
|
||||
| Property | Type | Description | Required |
|
||||
|----------|------|-------------|----------|
|
||||
| `nonCodeNodes` |`object`| | No |
|
||||
| `start` |`[` [`UnboxedNode_for_NonCodeNode`](/docs/kcl/types/UnboxedNode_for_NonCodeNode) `]`| | No |
|
||||
| `start` |`[` [`NonCodeNode`](/docs/kcl/types/NonCodeNode) `]`| | No |
|
||||
| `digest` |`[, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`]`| | No |
|
||||
|
||||
|
||||
|
@ -15,6 +15,8 @@ layout: manual
|
||||
|
||||
| Property | Type | Description | Required |
|
||||
|----------|------|-------------|----------|
|
||||
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||
| `end` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||
| `value` |[`NonCodeValue`](/docs/kcl/types/NonCodeValue)| | No |
|
||||
| `digest` |`[, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`]`| | No |
|
||||
|
||||
|
@ -15,7 +15,9 @@ layout: manual
|
||||
|
||||
| Property | Type | Description | Required |
|
||||
|----------|------|-------------|----------|
|
||||
| `key` |[`UnboxedNode_for_Identifier`](/docs/kcl/types/UnboxedNode_for_Identifier)| | No |
|
||||
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||
| `end` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||
| `key` |[`Identifier`](/docs/kcl/types/Identifier)| | No |
|
||||
| `value` |[`Expr`](/docs/kcl/types/Expr)| | No |
|
||||
| `digest` |`[, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`]`| | No |
|
||||
|
||||
|
@ -16,7 +16,7 @@ Parameter of a KCL function.
|
||||
|
||||
| Property | Type | Description | Required |
|
||||
|----------|------|-------------|----------|
|
||||
| `identifier` |[`UnboxedNode_for_Identifier`](/docs/kcl/types/UnboxedNode_for_Identifier)| The parameter's label or name. | No |
|
||||
| `identifier` |[`Identifier`](/docs/kcl/types/Identifier)| The parameter's label or name. | No |
|
||||
| `optional` |`boolean`| Is the parameter optional? | No |
|
||||
| `digest` |`[, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`]`| | No |
|
||||
|
||||
|
@ -27,7 +27,7 @@ A path that goes to a point.
|
||||
| `type` |enum: `ToPoint`| | No |
|
||||
| `from` |`[number, number]`| The from point. | No |
|
||||
| `to` |`[number, number]`| The to point. | No |
|
||||
| `tag` |[`TagNode`](/docs/kcl/types/TagNode)| The tag of the path. | No |
|
||||
| `tag` |[`TagDeclarator`](/docs/kcl/types#tag-declaration)| The tag of the path. | No |
|
||||
| `__geoMeta` |[`GeoMeta`](/docs/kcl/types/GeoMeta)| Metadata. | No |
|
||||
|
||||
|
||||
@ -49,7 +49,7 @@ A arc that is tangential to the last path segment that goes to a point
|
||||
| `ccw` |`boolean`| arc's direction | No |
|
||||
| `from` |`[number, number]`| The from point. | No |
|
||||
| `to` |`[number, number]`| The to point. | No |
|
||||
| `tag` |[`TagNode`](/docs/kcl/types/TagNode)| The tag of the path. | No |
|
||||
| `tag` |[`TagDeclarator`](/docs/kcl/types#tag-declaration)| The tag of the path. | No |
|
||||
| `__geoMeta` |[`GeoMeta`](/docs/kcl/types/GeoMeta)| Metadata. | No |
|
||||
|
||||
|
||||
@ -71,7 +71,7 @@ A arc that is tangential to the last path segment
|
||||
| `ccw` |`boolean`| arc's direction | No |
|
||||
| `from` |`[number, number]`| The from point. | No |
|
||||
| `to` |`[number, number]`| The to point. | No |
|
||||
| `tag` |[`TagNode`](/docs/kcl/types/TagNode)| The tag of the path. | No |
|
||||
| `tag` |[`TagDeclarator`](/docs/kcl/types#tag-declaration)| The tag of the path. | No |
|
||||
| `__geoMeta` |[`GeoMeta`](/docs/kcl/types/GeoMeta)| Metadata. | No |
|
||||
|
||||
|
||||
@ -94,7 +94,7 @@ a complete arc
|
||||
| `ccw` |`boolean`| arc's direction | No |
|
||||
| `from` |`[number, number]`| The from point. | No |
|
||||
| `to` |`[number, number]`| The to point. | No |
|
||||
| `tag` |[`TagNode`](/docs/kcl/types/TagNode)| The tag of the path. | No |
|
||||
| `tag` |[`TagDeclarator`](/docs/kcl/types#tag-declaration)| The tag of the path. | No |
|
||||
| `__geoMeta` |[`GeoMeta`](/docs/kcl/types/GeoMeta)| Metadata. | No |
|
||||
|
||||
|
||||
@ -115,7 +115,7 @@ A path that is horizontal.
|
||||
| `x` |`number`| The x coordinate. | No |
|
||||
| `from` |`[number, number]`| The from point. | No |
|
||||
| `to` |`[number, number]`| The to point. | No |
|
||||
| `tag` |[`TagNode`](/docs/kcl/types/TagNode)| The tag of the path. | No |
|
||||
| `tag` |[`TagDeclarator`](/docs/kcl/types#tag-declaration)| The tag of the path. | No |
|
||||
| `__geoMeta` |[`GeoMeta`](/docs/kcl/types/GeoMeta)| Metadata. | No |
|
||||
|
||||
|
||||
@ -137,7 +137,7 @@ An angled line to.
|
||||
| `y` |`number`| The y coordinate. | No |
|
||||
| `from` |`[number, number]`| The from point. | No |
|
||||
| `to` |`[number, number]`| The to point. | No |
|
||||
| `tag` |[`TagNode`](/docs/kcl/types/TagNode)| The tag of the path. | No |
|
||||
| `tag` |[`TagDeclarator`](/docs/kcl/types#tag-declaration)| The tag of the path. | No |
|
||||
| `__geoMeta` |[`GeoMeta`](/docs/kcl/types/GeoMeta)| Metadata. | No |
|
||||
|
||||
|
||||
@ -157,7 +157,7 @@ A base path.
|
||||
| `type` |enum: `Base`| | No |
|
||||
| `from` |`[number, number]`| The from point. | No |
|
||||
| `to` |`[number, number]`| The to point. | No |
|
||||
| `tag` |[`TagNode`](/docs/kcl/types/TagNode)| The tag of the path. | No |
|
||||
| `tag` |[`TagDeclarator`](/docs/kcl/types#tag-declaration)| The tag of the path. | No |
|
||||
| `__geoMeta` |[`GeoMeta`](/docs/kcl/types/GeoMeta)| Metadata. | No |
|
||||
|
||||
|
||||
|
@ -16,8 +16,10 @@ A KCL program top level, or function body.
|
||||
|
||||
| Property | Type | Description | Required |
|
||||
|----------|------|-------------|----------|
|
||||
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||
| `end` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||
| `body` |`[` [`BodyItem`](/docs/kcl/types/BodyItem) `]`| | No |
|
||||
| `nonCodeMeta` |[`UnboxedNode_for_NonCodeMeta`](/docs/kcl/types/UnboxedNode_for_NonCodeMeta)| A KCL program top level, or function body. | No |
|
||||
| `nonCodeMeta` |[`NonCodeMeta`](/docs/kcl/types/NonCodeMeta)| A KCL program top level, or function body. | No |
|
||||
| `digest` |`[, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`, `integer`]`| | No |
|
||||
|
||||
|
||||
|
@ -9,7 +9,7 @@ Draw a line relative to the current origin to a specified distance away
|
||||
from the current position along the 'x' axis.
|
||||
|
||||
```js
|
||||
xLine(length: number, sketch: Sketch, tag?: TagNode) -> Sketch
|
||||
xLine(length: number, sketch: Sketch, tag?: TagDeclarator) -> Sketch
|
||||
```
|
||||
|
||||
|
||||
@ -19,7 +19,7 @@ xLine(length: number, sketch: Sketch, tag?: TagNode) -> Sketch
|
||||
|----------|------|-------------|----------|
|
||||
| `length` | `number` | | Yes |
|
||||
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | A sketch is a collection of paths. | Yes |
|
||||
| `tag` | [`TagNode`](/docs/kcl/types/TagNode) | | No |
|
||||
| `tag` | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | | No |
|
||||
|
||||
### Returns
|
||||
|
||||
|
@ -9,7 +9,7 @@ Draw a line parallel to the X axis, that ends at the given X.
|
||||
E.g. if the previous line ended at (1, 1), then xLineTo(4) draws a line from (1, 1) to (4, 1)
|
||||
|
||||
```js
|
||||
xLineTo(to: number, sketch: Sketch, tag?: TagNode) -> Sketch
|
||||
xLineTo(to: number, sketch: Sketch, tag?: TagDeclarator) -> Sketch
|
||||
```
|
||||
|
||||
|
||||
@ -19,7 +19,7 @@ xLineTo(to: number, sketch: Sketch, tag?: TagNode) -> Sketch
|
||||
|----------|------|-------------|----------|
|
||||
| `to` | `number` | | Yes |
|
||||
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | A sketch is a collection of paths. | Yes |
|
||||
| `tag` | [`TagNode`](/docs/kcl/types/TagNode) | | No |
|
||||
| `tag` | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | | No |
|
||||
|
||||
### Returns
|
||||
|
||||
|
@ -9,7 +9,7 @@ Draw a line relative to the current origin to a specified distance away
|
||||
from the current position along the 'y' axis.
|
||||
|
||||
```js
|
||||
yLine(length: number, sketch: Sketch, tag?: TagNode) -> Sketch
|
||||
yLine(length: number, sketch: Sketch, tag?: TagDeclarator) -> Sketch
|
||||
```
|
||||
|
||||
|
||||
@ -19,7 +19,7 @@ yLine(length: number, sketch: Sketch, tag?: TagNode) -> Sketch
|
||||
|----------|------|-------------|----------|
|
||||
| `length` | `number` | | Yes |
|
||||
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | A sketch is a collection of paths. | Yes |
|
||||
| `tag` | [`TagNode`](/docs/kcl/types/TagNode) | | No |
|
||||
| `tag` | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | | No |
|
||||
|
||||
### Returns
|
||||
|
||||
|
@ -9,7 +9,7 @@ Draw a line parallel to the Y axis, that ends at the given Y.
|
||||
E.g. if the previous line ended at (1, 1), then yLineTo(4) draws a line from (1, 1) to (1, 4)
|
||||
|
||||
```js
|
||||
yLineTo(to: number, sketch: Sketch, tag?: TagNode) -> Sketch
|
||||
yLineTo(to: number, sketch: Sketch, tag?: TagDeclarator) -> Sketch
|
||||
```
|
||||
|
||||
|
||||
@ -19,7 +19,7 @@ yLineTo(to: number, sketch: Sketch, tag?: TagNode) -> Sketch
|
||||
|----------|------|-------------|----------|
|
||||
| `to` | `number` | | Yes |
|
||||
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | A sketch is a collection of paths. | Yes |
|
||||
| `tag` | [`TagNode`](/docs/kcl/types/TagNode) | | No |
|
||||
| `tag` | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | | No |
|
||||
|
||||
### Returns
|
||||
|
||||
|
@ -136,6 +136,9 @@ test.describe('when using the file tree to', () => {
|
||||
)
|
||||
await pasteCodeInEditor(kclCube)
|
||||
|
||||
// TODO: We have a timeout of 1s between edits to write to disk. If you reload the page too quickly it won't write to disk.
|
||||
await tronApp.page.waitForTimeout(2000)
|
||||
|
||||
await renameFile(fromFile, toFile)
|
||||
await tronApp.page.reload()
|
||||
|
||||
@ -222,9 +225,11 @@ test.describe('when using the file tree to', () => {
|
||||
)
|
||||
await pasteCodeInEditor(kclCube)
|
||||
|
||||
// TODO: We have a timeout of 1s between edits to write to disk. If you reload the page too quickly it won't write to disk.
|
||||
await tronApp.page.waitForTimeout(2000)
|
||||
|
||||
const kcl1 = 'main.kcl'
|
||||
const kcl2 = '2.kcl'
|
||||
|
||||
await createNewFileAndSelect(kcl2)
|
||||
const kclCylinder = await fsp.readFile(
|
||||
'src/wasm-lib/tests/executor/inputs/cylinder.kcl',
|
||||
@ -232,6 +237,9 @@ test.describe('when using the file tree to', () => {
|
||||
)
|
||||
await pasteCodeInEditor(kclCylinder)
|
||||
|
||||
// TODO: We have a timeout of 1s between edits to write to disk. If you reload the page too quickly it won't write to disk.
|
||||
await tronApp.page.waitForTimeout(2000)
|
||||
|
||||
await renameFile(kcl2, kcl1)
|
||||
|
||||
await test.step(`Postcondition: ${kcl1} still has the original content`, async () => {
|
||||
|
@ -64,6 +64,27 @@ export type ReactCameraProperties =
|
||||
|
||||
const lastCmdDelay = 50
|
||||
|
||||
class CameraRateLimiter {
|
||||
lastSend?: Date = undefined
|
||||
rateLimitMs: number = 16 //60 FPS
|
||||
|
||||
send = (f: () => void) => {
|
||||
let now = new Date()
|
||||
|
||||
if (
|
||||
this.lastSend === undefined ||
|
||||
now.getTime() - this.lastSend.getTime() > this.rateLimitMs
|
||||
) {
|
||||
f()
|
||||
this.lastSend = now
|
||||
}
|
||||
}
|
||||
|
||||
reset = () => {
|
||||
this.lastSend = undefined
|
||||
}
|
||||
}
|
||||
|
||||
export class CameraControls {
|
||||
engineCommandManager: EngineCommandManager
|
||||
syncDirection: 'clientToEngine' | 'engineToClient' = 'engineToClient'
|
||||
@ -77,9 +98,8 @@ export class CameraControls {
|
||||
enableRotate = true
|
||||
enablePan = true
|
||||
enableZoom = true
|
||||
zoomDataFromLastFrame?: number = undefined
|
||||
// holds coordinates, and interaction
|
||||
moveDataFromLastFrame?: [number, number, string] = undefined
|
||||
moveSender: CameraRateLimiter = new CameraRateLimiter()
|
||||
zoomSender: CameraRateLimiter = new CameraRateLimiter()
|
||||
lastPerspectiveFov: number = 45
|
||||
pendingZoom: number | null = null
|
||||
pendingRotation: Vector2 | null = null
|
||||
@ -171,6 +191,36 @@ export class CameraControls {
|
||||
}
|
||||
}
|
||||
|
||||
doMove = (interaction: any, coordinates: any) => {
|
||||
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
||||
this.engineCommandManager.sendSceneCommand({
|
||||
type: 'modeling_cmd_req',
|
||||
cmd: {
|
||||
type: 'camera_drag_move',
|
||||
interaction: interaction,
|
||||
window: {
|
||||
x: coordinates[0],
|
||||
y: coordinates[1],
|
||||
},
|
||||
},
|
||||
cmd_id: uuidv4(),
|
||||
})
|
||||
}
|
||||
|
||||
doZoom = (zoom: number) => {
|
||||
this.handleStart()
|
||||
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
||||
this.engineCommandManager.sendSceneCommand({
|
||||
type: 'modeling_cmd_req',
|
||||
cmd: {
|
||||
type: 'default_camera_zoom',
|
||||
magnitude: (-1 * zoom) / window.devicePixelRatio,
|
||||
},
|
||||
cmd_id: uuidv4(),
|
||||
})
|
||||
this.handleEnd()
|
||||
}
|
||||
|
||||
constructor(
|
||||
isOrtho = false,
|
||||
domElement: HTMLCanvasElement,
|
||||
@ -258,49 +308,6 @@ export class CameraControls {
|
||||
this.onCameraChange()
|
||||
}
|
||||
|
||||
// Our stream is never more than 60fps.
|
||||
// We can get away with capping our "virtual fps" to 60 then.
|
||||
const FPS_VIRTUAL = 60
|
||||
|
||||
const doZoom = () => {
|
||||
if (this.zoomDataFromLastFrame !== undefined) {
|
||||
this.handleStart()
|
||||
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
||||
this.engineCommandManager.sendSceneCommand({
|
||||
type: 'modeling_cmd_req',
|
||||
cmd: {
|
||||
type: 'default_camera_zoom',
|
||||
magnitude:
|
||||
(-1 * this.zoomDataFromLastFrame) / window.devicePixelRatio,
|
||||
},
|
||||
cmd_id: uuidv4(),
|
||||
})
|
||||
this.handleEnd()
|
||||
}
|
||||
this.zoomDataFromLastFrame = undefined
|
||||
}
|
||||
setInterval(doZoom, 1000 / FPS_VIRTUAL)
|
||||
|
||||
const doMove = () => {
|
||||
if (this.moveDataFromLastFrame !== undefined) {
|
||||
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
||||
this.engineCommandManager.sendSceneCommand({
|
||||
type: 'modeling_cmd_req',
|
||||
cmd: {
|
||||
type: 'camera_drag_move',
|
||||
interaction: this.moveDataFromLastFrame[2] as any,
|
||||
window: {
|
||||
x: this.moveDataFromLastFrame[0],
|
||||
y: this.moveDataFromLastFrame[1],
|
||||
},
|
||||
},
|
||||
cmd_id: uuidv4(),
|
||||
})
|
||||
}
|
||||
this.moveDataFromLastFrame = undefined
|
||||
}
|
||||
setInterval(doMove, 1000 / FPS_VIRTUAL)
|
||||
|
||||
setTimeout(() => {
|
||||
this.engineCommandManager.subscribeTo({
|
||||
event: 'camera_drag_end',
|
||||
@ -386,7 +393,9 @@ export class CameraControls {
|
||||
if (interaction === 'none') return
|
||||
|
||||
if (this.syncDirection === 'engineToClient') {
|
||||
this.moveDataFromLastFrame = [event.clientX, event.clientY, interaction]
|
||||
this.moveSender.send(() => {
|
||||
this.doMove(interaction, [event.clientX, event.clientY])
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
@ -459,7 +468,9 @@ export class CameraControls {
|
||||
|
||||
if (this.syncDirection === 'engineToClient') {
|
||||
if (interaction === 'zoom') {
|
||||
this.zoomDataFromLastFrame = event.deltaY
|
||||
this.zoomSender.send(() => {
|
||||
this.doZoom(event.deltaY)
|
||||
})
|
||||
} else {
|
||||
// This case will get handled when we add pan and rotate using Apple trackpad.
|
||||
console.error(
|
||||
|
@ -44,7 +44,6 @@ import {
|
||||
import { ActionButton } from 'components/ActionButton'
|
||||
import { err, reportRejection, trap } from 'lib/trap'
|
||||
import { useCommandsContext } from 'hooks/useCommandsContext'
|
||||
import { UnboxedNode } from 'wasm-lib/kcl/bindings/UnboxedNode'
|
||||
|
||||
function useShouldHideScene(): { hideClient: boolean; hideServer: boolean } {
|
||||
const [isCamMoving, setIsCamMoving] = useState(false)
|
||||
@ -202,7 +201,7 @@ const Overlay = ({
|
||||
let xAlignment = overlay.angle < 0 ? '0%' : '-100%'
|
||||
let yAlignment = overlay.angle < -90 || overlay.angle >= 90 ? '0%' : '-100%'
|
||||
|
||||
const _node1 = getNodeFromPath<UnboxedNode<CallExpression>>(
|
||||
const _node1 = getNodeFromPath<CallExpression>(
|
||||
kclManager.ast,
|
||||
overlay.pathToNode,
|
||||
'CallExpression'
|
||||
@ -382,7 +381,7 @@ export async function deleteSegment({
|
||||
pathToNode: PathToNode
|
||||
sketchDetails: SketchDetails | null
|
||||
}) {
|
||||
let modifiedAst: UnboxedNode<Program> | Error = kclManager.ast
|
||||
let modifiedAst: Program | Error = kclManager.ast
|
||||
const dependentRanges = findUsesOfTagInPipe(modifiedAst, pathToNode)
|
||||
|
||||
const shouldContinueSegDelete = dependentRanges.length
|
||||
|
@ -92,7 +92,6 @@ import { err, reportRejection, trap } from 'lib/trap'
|
||||
import { CSS2DObject } from 'three/examples/jsm/renderers/CSS2DRenderer'
|
||||
import { Point3d } from 'wasm-lib/kcl/bindings/Point3d'
|
||||
import { SegmentInputs } from 'lang/std/stdTypes'
|
||||
import { UnboxedNode } from 'wasm-lib/kcl/bindings/UnboxedNode'
|
||||
|
||||
type DraftSegment = 'line' | 'tangentialArcTo'
|
||||
|
||||
@ -370,14 +369,14 @@ export class SceneEntities {
|
||||
selectionRanges,
|
||||
}: {
|
||||
sketchPathToNode: PathToNode
|
||||
maybeModdedAst: UnboxedNode<Program>
|
||||
maybeModdedAst: Program
|
||||
draftExpressionsIndices?: { start: number; end: number }
|
||||
forward: [number, number, number]
|
||||
up: [number, number, number]
|
||||
position?: [number, number, number]
|
||||
selectionRanges?: Selections
|
||||
}): Promise<{
|
||||
truncatedAst: UnboxedNode<Program>
|
||||
truncatedAst: Program
|
||||
programMemoryOverride: ProgramMemory
|
||||
sketch: Sketch
|
||||
variableDeclarationName: string
|
||||
@ -562,7 +561,7 @@ export class SceneEntities {
|
||||
}
|
||||
updateAstAndRejigSketch = async (
|
||||
sketchPathToNode: PathToNode,
|
||||
modifiedAst: UnboxedNode<Program> | Error,
|
||||
modifiedAst: Program | Error,
|
||||
forward: [number, number, number],
|
||||
up: [number, number, number],
|
||||
origin: [number, number, number]
|
||||
@ -1178,7 +1177,7 @@ export class SceneEntities {
|
||||
}
|
||||
prepareTruncatedMemoryAndAst = (
|
||||
sketchPathToNode: PathToNode,
|
||||
ast?: UnboxedNode<Program>,
|
||||
ast?: Program,
|
||||
draftSegment?: DraftSegment
|
||||
) =>
|
||||
prepareTruncatedMemoryAndAst(
|
||||
@ -1199,7 +1198,7 @@ export class SceneEntities {
|
||||
sketchPathToNode: PathToNode
|
||||
intersects: Intersection<Object3D<Object3DEventMap>>[]
|
||||
draftInfo?: {
|
||||
truncatedAst: UnboxedNode<Program>
|
||||
truncatedAst: Program
|
||||
programMemoryOverride: ProgramMemory
|
||||
variableDeclarationName: string
|
||||
}
|
||||
@ -1235,7 +1234,7 @@ export class SceneEntities {
|
||||
const dragTo: [number, number] = [intersection2d.x, intersection2d.y]
|
||||
let modifiedAst = draftInfo ? draftInfo.truncatedAst : { ...kclManager.ast }
|
||||
|
||||
const _node = getNodeFromPath<UnboxedNode<CallExpression>>(
|
||||
const _node = getNodeFromPath<CallExpression>(
|
||||
modifiedAst,
|
||||
pathToNode,
|
||||
'CallExpression'
|
||||
@ -1247,7 +1246,7 @@ export class SceneEntities {
|
||||
|
||||
let modded:
|
||||
| {
|
||||
modifiedAst: UnboxedNode<Program>
|
||||
modifiedAst: Program
|
||||
pathToNode: PathToNode
|
||||
}
|
||||
| Error
|
||||
@ -1542,7 +1541,7 @@ export class SceneEntities {
|
||||
if (parent?.userData?.pathToNode) {
|
||||
const updatedAst = parse(recast(kclManager.ast))
|
||||
if (trap(updatedAst)) return
|
||||
const _node = getNodeFromPath<UnboxedNode<CallExpression>>(
|
||||
const _node = getNodeFromPath<CallExpression>(
|
||||
updatedAst,
|
||||
parent.userData.pathToNode,
|
||||
'CallExpression'
|
||||
@ -1677,12 +1676,12 @@ export type DefaultPlaneStr = 'XY' | 'XZ' | 'YZ' | '-XY' | '-XZ' | '-YZ'
|
||||
|
||||
function prepareTruncatedMemoryAndAst(
|
||||
sketchPathToNode: PathToNode,
|
||||
ast: UnboxedNode<Program>,
|
||||
ast: Program,
|
||||
programMemory: ProgramMemory,
|
||||
draftSegment?: DraftSegment
|
||||
):
|
||||
| {
|
||||
truncatedAst: UnboxedNode<Program>
|
||||
truncatedAst: Program
|
||||
programMemoryOverride: ProgramMemory
|
||||
variableDeclarationName: string
|
||||
}
|
||||
@ -1690,7 +1689,7 @@ function prepareTruncatedMemoryAndAst(
|
||||
const bodyIndex = Number(sketchPathToNode?.[1]?.[0]) || 0
|
||||
const _ast = structuredClone(ast)
|
||||
|
||||
const _node = getNodeFromPath<UnboxedNode<VariableDeclaration>>(
|
||||
const _node = getNodeFromPath<VariableDeclaration>(
|
||||
_ast,
|
||||
sketchPathToNode || [],
|
||||
'VariableDeclaration'
|
||||
@ -1740,15 +1739,15 @@ function prepareTruncatedMemoryAndAst(
|
||||
).body.slice(-1)[0].start = lastPipeItem.start
|
||||
|
||||
_ast.end = lastPipeItem.end
|
||||
const varDec = _ast.body[bodyIndex] as UnboxedNode<VariableDeclaration>
|
||||
const varDec = _ast.body[bodyIndex] as VariableDeclaration
|
||||
varDec.end = lastPipeItem.end
|
||||
const declarator = varDec.declarations[0]
|
||||
declarator.end = lastPipeItem.end
|
||||
const init = declarator.init as UnboxedNode<PipeExpression>
|
||||
const init = declarator.init as PipeExpression
|
||||
init.end = lastPipeItem.end
|
||||
init.body.slice(-1)[0].end = lastPipeItem.end
|
||||
}
|
||||
const truncatedAst: UnboxedNode<Program> = {
|
||||
const truncatedAst: Program = {
|
||||
..._ast,
|
||||
body: [structuredClone(_ast.body[bodyIndex])],
|
||||
}
|
||||
|
@ -488,6 +488,12 @@ export const FileTreeInner = ({
|
||||
// Refresh the file tree when there are changes.
|
||||
useFileSystemWatcher(
|
||||
async (eventType, path) => {
|
||||
// Our other watcher races with this watcher on the current file changes,
|
||||
// so we need to stop this one from reacting at all, otherwise Bad Things
|
||||
// Happen™.
|
||||
const isCurrentFile = loaderData.file?.path === path
|
||||
const hasChanged = eventType === 'change'
|
||||
if (isCurrentFile && hasChanged) return
|
||||
fileSend({ type: 'Refresh' })
|
||||
},
|
||||
[loaderData?.project?.path, fileContext.selectedDirectory.path].filter(
|
||||
|
@ -69,7 +69,7 @@ import { exportFromEngine } from 'lib/exportFromEngine'
|
||||
import { Models } from '@kittycad/lib/dist/types/src'
|
||||
import toast from 'react-hot-toast'
|
||||
import { EditorSelection, Transaction } from '@codemirror/state'
|
||||
import { useNavigate, useSearchParams } from 'react-router-dom'
|
||||
import { useLoaderData, useNavigate, useSearchParams } from 'react-router-dom'
|
||||
import { letEngineAnimateAndSyncCamAfter } from 'clientSideScene/CameraControls'
|
||||
import { getVarNameModal } from 'hooks/useToolbarGuards'
|
||||
import { err, reportRejection, trap } from 'lib/trap'
|
||||
@ -84,7 +84,7 @@ import {
|
||||
import { submitAndAwaitTextToKcl } from 'lib/textToCad'
|
||||
import { useFileContext } from 'hooks/useFileContext'
|
||||
import { uuidv4 } from 'lib/utils'
|
||||
import { UnboxedNode } from 'wasm-lib/kcl/bindings/UnboxedNode'
|
||||
import { IndexLoaderData } from 'lib/types'
|
||||
|
||||
type MachineContext<T extends AnyStateMachine> = {
|
||||
state: StateFrom<T>
|
||||
@ -117,6 +117,7 @@ export const ModelingMachineProvider = ({
|
||||
} = useSettingsAuthContext()
|
||||
const navigate = useNavigate()
|
||||
const { context, send: fileMachineSend } = useFileContext()
|
||||
const { file } = useLoaderData() as IndexLoaderData
|
||||
const token = auth?.context?.token
|
||||
const streamRef = useRef<HTMLDivElement>(null)
|
||||
const persistedContext = useMemo(() => getPersistedContext(), [])
|
||||
@ -410,12 +411,15 @@ export const ModelingMachineProvider = ({
|
||||
Make: ({ event }) => {
|
||||
if (event.type !== 'Make') return
|
||||
// Check if we already have an export intent.
|
||||
if (engineCommandManager.exportIntent) {
|
||||
if (engineCommandManager.exportInfo) {
|
||||
toast.error('Already exporting')
|
||||
return
|
||||
}
|
||||
// Set the export intent.
|
||||
engineCommandManager.exportIntent = ExportIntent.Make
|
||||
engineCommandManager.exportInfo = {
|
||||
intent: ExportIntent.Make,
|
||||
name: file?.name || '',
|
||||
}
|
||||
|
||||
// Set the current machine.
|
||||
machineManager.currentMachine = event.data.machine
|
||||
@ -444,12 +448,16 @@ export const ModelingMachineProvider = ({
|
||||
},
|
||||
'Engine export': ({ event }) => {
|
||||
if (event.type !== 'Export') return
|
||||
if (engineCommandManager.exportIntent) {
|
||||
if (engineCommandManager.exportInfo) {
|
||||
toast.error('Already exporting')
|
||||
return
|
||||
}
|
||||
// Set the export intent.
|
||||
engineCommandManager.exportIntent = ExportIntent.Save
|
||||
engineCommandManager.exportInfo = {
|
||||
intent: ExportIntent.Save,
|
||||
// This never gets used its only for make.
|
||||
name: '',
|
||||
}
|
||||
|
||||
const format = {
|
||||
...event.data,
|
||||
@ -940,7 +948,7 @@ export const ModelingMachineProvider = ({
|
||||
})
|
||||
let parsed = parse(recast(kclManager.ast))
|
||||
if (trap(parsed)) return Promise.reject(parsed)
|
||||
parsed = parsed as UnboxedNode<Program>
|
||||
parsed = parsed as Program
|
||||
|
||||
const { modifiedAst: _modifiedAst, pathToReplacedNode } =
|
||||
moveValueIntoNewVariablePath(
|
||||
@ -951,7 +959,7 @@ export const ModelingMachineProvider = ({
|
||||
)
|
||||
parsed = parse(recast(_modifiedAst))
|
||||
if (trap(parsed)) return Promise.reject(parsed)
|
||||
parsed = parsed as UnboxedNode<Program>
|
||||
parsed = parsed as Program
|
||||
if (!pathToReplacedNode)
|
||||
return Promise.reject(new Error('No path to replaced node'))
|
||||
|
||||
|
@ -14,7 +14,6 @@ import {
|
||||
import { TransformInfo } from 'lang/std/stdTypes'
|
||||
import { kclManager } from 'lib/singletons'
|
||||
import { err } from 'lib/trap'
|
||||
import { UnboxedNode } from 'wasm-lib/kcl/bindings/UnboxedNode'
|
||||
|
||||
export function setEqualLengthInfo({
|
||||
selectionRanges,
|
||||
@ -87,7 +86,7 @@ export function applyConstraintEqualLength({
|
||||
selectionRanges: Selections
|
||||
}):
|
||||
| {
|
||||
modifiedAst: UnboxedNode<Program>
|
||||
modifiedAst: Program
|
||||
pathToNodeMap: PathToNodeMap
|
||||
}
|
||||
| Error {
|
||||
|
@ -13,7 +13,6 @@ import {
|
||||
import { TransformInfo } from 'lang/std/stdTypes'
|
||||
import { kclManager } from 'lib/singletons'
|
||||
import { err } from 'lib/trap'
|
||||
import { UnboxedNode } from 'wasm-lib/kcl/bindings/UnboxedNode'
|
||||
|
||||
export function horzVertInfo(
|
||||
selectionRanges: Selections,
|
||||
@ -56,11 +55,11 @@ export function horzVertInfo(
|
||||
export function applyConstraintHorzVert(
|
||||
selectionRanges: Selections,
|
||||
horOrVert: 'vertical' | 'horizontal',
|
||||
ast: UnboxedNode<Program>,
|
||||
ast: Program,
|
||||
programMemory: ProgramMemory
|
||||
):
|
||||
| {
|
||||
modifiedAst: UnboxedNode<Program>
|
||||
modifiedAst: Program
|
||||
pathToNodeMap: PathToNodeMap
|
||||
}
|
||||
| Error {
|
||||
|
@ -19,7 +19,6 @@ import { createVariableDeclaration } from '../../lang/modifyAst'
|
||||
import { removeDoubleNegatives } from '../AvailableVarsHelpers'
|
||||
import { kclManager } from 'lib/singletons'
|
||||
import { err } from 'lib/trap'
|
||||
import { UnboxedNode } from 'wasm-lib/kcl/bindings/UnboxedNode'
|
||||
|
||||
const getModalInfo = createInfoModal(GetInfoModal)
|
||||
|
||||
@ -137,7 +136,7 @@ export async function applyConstraintIntersect({
|
||||
}: {
|
||||
selectionRanges: Selections
|
||||
}): Promise<{
|
||||
modifiedAst: UnboxedNode<Program>
|
||||
modifiedAst: Program
|
||||
pathToNodeMap: PathToNodeMap
|
||||
}> {
|
||||
const info = intersectInfo({
|
||||
|
@ -13,7 +13,6 @@ import {
|
||||
import { TransformInfo } from 'lang/std/stdTypes'
|
||||
import { kclManager } from 'lib/singletons'
|
||||
import { err } from 'lib/trap'
|
||||
import { UnboxedNode } from 'wasm-lib/kcl/bindings/UnboxedNode'
|
||||
|
||||
export function removeConstrainingValuesInfo({
|
||||
selectionRanges,
|
||||
@ -78,7 +77,7 @@ export function applyRemoveConstrainingValues({
|
||||
pathToNodes?: Array<PathToNode>
|
||||
}):
|
||||
| {
|
||||
modifiedAst: UnboxedNode<Program>
|
||||
modifiedAst: Program
|
||||
pathToNodeMap: PathToNodeMap
|
||||
}
|
||||
| Error {
|
||||
|
@ -23,7 +23,6 @@ import {
|
||||
import { removeDoubleNegatives } from '../AvailableVarsHelpers'
|
||||
import { kclManager } from 'lib/singletons'
|
||||
import { err } from 'lib/trap'
|
||||
import { UnboxedNode } from 'wasm-lib/kcl/bindings/UnboxedNode'
|
||||
|
||||
const getModalInfo = createSetAngleLengthModal(SetAngleLengthModal)
|
||||
|
||||
@ -162,7 +161,7 @@ export function applyConstraintAxisAlign({
|
||||
constraint: 'snapToYAxis' | 'snapToXAxis'
|
||||
}):
|
||||
| {
|
||||
modifiedAst: UnboxedNode<Program>
|
||||
modifiedAst: Program
|
||||
pathToNodeMap: PathToNodeMap
|
||||
}
|
||||
| Error {
|
||||
|
@ -18,7 +18,6 @@ import { removeDoubleNegatives } from '../AvailableVarsHelpers'
|
||||
import { kclManager } from 'lib/singletons'
|
||||
import { Selections } from 'lib/selections'
|
||||
import { cleanErrs, err } from 'lib/trap'
|
||||
import { UnboxedNode } from 'wasm-lib/kcl/bindings/UnboxedNode'
|
||||
|
||||
const getModalInfo = createInfoModal(GetInfoModal)
|
||||
|
||||
@ -186,7 +185,7 @@ export function applyConstraintHorzVertAlign({
|
||||
constraint: 'setHorzDistance' | 'setVertDistance'
|
||||
}):
|
||||
| {
|
||||
modifiedAst: UnboxedNode<Program>
|
||||
modifiedAst: Program
|
||||
pathToNodeMap: PathToNodeMap
|
||||
}
|
||||
| Error {
|
||||
|
@ -21,10 +21,9 @@ import {
|
||||
import { getNodeFromPath } from './queryAst'
|
||||
import { codeManager, editorManager, sceneInfra } from 'lib/singletons'
|
||||
import { Diagnostic } from '@codemirror/lint'
|
||||
import { UnboxedNode } from 'wasm-lib/kcl/bindings/UnboxedNode'
|
||||
|
||||
interface ExecuteArgs {
|
||||
ast?: UnboxedNode<Program>
|
||||
ast?: Program
|
||||
zoomToFit?: boolean
|
||||
executionId?: number
|
||||
zoomOnRangeAndType?: {
|
||||
@ -34,13 +33,13 @@ interface ExecuteArgs {
|
||||
}
|
||||
|
||||
export class KclManager {
|
||||
private _ast: UnboxedNode<Program> = {
|
||||
private _ast: Program = {
|
||||
body: [],
|
||||
start: 0,
|
||||
end: 0,
|
||||
nonCodeMeta: {
|
||||
nonCodeNodes: {},
|
||||
startNodes: [],
|
||||
start: [],
|
||||
},
|
||||
}
|
||||
private _execState: ExecState = emptyExecState()
|
||||
@ -56,7 +55,7 @@ export class KclManager {
|
||||
engineCommandManager: EngineCommandManager
|
||||
|
||||
private _isExecutingCallback: (arg: boolean) => void = () => {}
|
||||
private _astCallBack: (arg: UnboxedNode<Program>) => void = () => {}
|
||||
private _astCallBack: (arg: Program) => void = () => {}
|
||||
private _programMemoryCallBack: (arg: ProgramMemory) => void = () => {}
|
||||
private _logsCallBack: (arg: string[]) => void = () => {}
|
||||
private _kclErrorsCallBack: (arg: KCLError[]) => void = () => {}
|
||||
@ -182,7 +181,7 @@ export class KclManager {
|
||||
setWasmInitFailed,
|
||||
}: {
|
||||
setProgramMemory: (arg: ProgramMemory) => void
|
||||
setAst: (arg: UnboxedNode<Program>) => void
|
||||
setAst: (arg: Program) => void
|
||||
setLogs: (arg: string[]) => void
|
||||
setKclErrors: (arg: KCLError[]) => void
|
||||
setIsExecuting: (arg: boolean) => void
|
||||
@ -206,12 +205,12 @@ export class KclManager {
|
||||
end: 0,
|
||||
nonCodeMeta: {
|
||||
nonCodeNodes: {},
|
||||
startNodes: [],
|
||||
start: [],
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
safeParse(code: string): UnboxedNode<Program> | null {
|
||||
safeParse(code: string): Program | null {
|
||||
const ast = parse(code)
|
||||
this.lints = []
|
||||
this.kclErrors = []
|
||||
@ -378,7 +377,7 @@ export class KclManager {
|
||||
Array.from(this.engineCommandManager.artifactGraph).forEach(
|
||||
([commandId, artifact]) => {
|
||||
if (!('codeRef' in artifact)) return
|
||||
const _node1 = getNodeFromPath<UnboxedNode<CallExpression>>(
|
||||
const _node1 = getNodeFromPath<CallExpression>(
|
||||
this.ast,
|
||||
artifact.codeRef.pathToNode,
|
||||
'CallExpression'
|
||||
@ -442,7 +441,7 @@ export class KclManager {
|
||||
// but should probably have think about which of the function to keep
|
||||
// This always updates the code state and editor and writes to the file system.
|
||||
async updateAst(
|
||||
ast: UnboxedNode<Program>,
|
||||
ast: Program,
|
||||
execute: boolean,
|
||||
optionalParams?: {
|
||||
focusPath?: Array<PathToNode>
|
||||
@ -453,7 +452,7 @@ export class KclManager {
|
||||
}
|
||||
}
|
||||
): Promise<{
|
||||
newAst: UnboxedNode<Program>
|
||||
newAst: Program
|
||||
selections?: Selections
|
||||
}> {
|
||||
const newCode = recast(ast)
|
||||
@ -589,7 +588,7 @@ export class KclManager {
|
||||
}
|
||||
|
||||
// Determines if there is no KCL code which means it is executing a blank KCL file
|
||||
_isAstEmpty(ast: UnboxedNode<Program>) {
|
||||
_isAstEmpty(ast: Program) {
|
||||
return ast.start === 0 && ast.end === 0 && ast.body.length === 0
|
||||
}
|
||||
}
|
||||
|
@ -18,6 +18,7 @@ export default class CodeManager {
|
||||
#updateState: (arg: string) => void = () => {}
|
||||
private _currentFilePath: string | null = null
|
||||
private _hotkeys: { [key: string]: () => void } = {}
|
||||
private timeoutWriter: ReturnType<typeof setTimeout> | undefined = undefined
|
||||
|
||||
constructor() {
|
||||
if (isDesktop()) {
|
||||
@ -115,7 +116,11 @@ export default class CodeManager {
|
||||
|
||||
async writeToFile() {
|
||||
if (isDesktop()) {
|
||||
setTimeout(() => {
|
||||
// Only write our buffer contents to file once per second. Any faster
|
||||
// and file-system watchers which read, will receive empty data during
|
||||
// writes.
|
||||
clearTimeout(this.timeoutWriter)
|
||||
this.timeoutWriter = setTimeout(() => {
|
||||
// Wait one event loop to give a chance for params to be set
|
||||
// Save the file to disk
|
||||
this._currentFilePath &&
|
||||
@ -126,7 +131,7 @@ export default class CodeManager {
|
||||
console.error('error saving file', err)
|
||||
toast.error('Error saving file, please check file permissions')
|
||||
})
|
||||
})
|
||||
}, 1000)
|
||||
} else {
|
||||
safeLSSetItem(PERSIST_CODE_KEY, this.code)
|
||||
}
|
||||
|
@ -12,7 +12,6 @@ import { EngineCommandManager } from 'lang/std/engineConnection'
|
||||
import { KCLError } from 'lang/errors'
|
||||
import { Diagnostic } from '@codemirror/lint'
|
||||
import { IdGenerator } from 'wasm-lib/kcl/bindings/IdGenerator'
|
||||
import { UnboxedNode } from 'wasm-lib/kcl/bindings/UnboxedNode'
|
||||
|
||||
export type ToolTip =
|
||||
| 'lineTo'
|
||||
@ -53,7 +52,7 @@ export async function executeAst({
|
||||
programMemoryOverride,
|
||||
idGenerator,
|
||||
}: {
|
||||
ast: UnboxedNode<Program>
|
||||
ast: Program
|
||||
engineCommandManager: EngineCommandManager
|
||||
useFakeExecutor?: boolean
|
||||
programMemoryOverride?: ProgramMemory
|
||||
|
@ -21,7 +21,6 @@ import { enginelessExecutor } from '../lib/testHelpers'
|
||||
import { findUsesOfTagInPipe, getNodePathFromSourceRange } from './queryAst'
|
||||
import { err } from 'lib/trap'
|
||||
import { SimplifiedArgDetails } from './std/stdTypes'
|
||||
import { UnboxedNode } from 'wasm-lib/kcl/bindings/UnboxedNode'
|
||||
|
||||
beforeAll(async () => {
|
||||
await initPromise
|
||||
@ -110,7 +109,7 @@ describe('Testing findUniqueName', () => {
|
||||
{ type: 'Identifier', name: 'yo07', start: 0, end: 0 },
|
||||
{ type: 'Identifier', name: 'yo08', start: 0, end: 0 },
|
||||
{ type: 'Identifier', name: 'yo09', start: 0, end: 0 },
|
||||
] satisfies UnboxedNode<Identifier>[]),
|
||||
] satisfies Identifier[]),
|
||||
'yo',
|
||||
2
|
||||
)
|
||||
@ -124,7 +123,7 @@ describe('Testing addSketchTo', () => {
|
||||
body: [],
|
||||
start: 0,
|
||||
end: 0,
|
||||
nonCodeMeta: { nonCodeNodes: {}, startNodes: [] },
|
||||
nonCodeMeta: { nonCodeNodes: {}, start: [] },
|
||||
},
|
||||
'yz'
|
||||
)
|
||||
|
@ -42,13 +42,12 @@ import { SimplifiedArgDetails } from './std/stdTypes'
|
||||
import { TagDeclarator } from 'wasm-lib/kcl/bindings/TagDeclarator'
|
||||
import { Models } from '@kittycad/lib'
|
||||
import { ExtrudeFacePlane } from 'machines/modelingMachine'
|
||||
import { UnboxedNode } from 'wasm-lib/kcl/bindings/UnboxedNode'
|
||||
|
||||
export function startSketchOnDefault(
|
||||
node: UnboxedNode<Program>,
|
||||
node: Program,
|
||||
axis: DefaultPlaneStr,
|
||||
name = ''
|
||||
): { modifiedAst: UnboxedNode<Program>; id: string; pathToNode: PathToNode } {
|
||||
): { modifiedAst: Program; id: string; pathToNode: PathToNode } {
|
||||
const _node = { ...node }
|
||||
const _name =
|
||||
name || findUniqueName(node, KCL_DEFAULT_CONSTANT_PREFIXES.SKETCH)
|
||||
@ -77,10 +76,10 @@ export function startSketchOnDefault(
|
||||
}
|
||||
|
||||
export function addStartProfileAt(
|
||||
node: UnboxedNode<Program>,
|
||||
node: Program,
|
||||
pathToNode: PathToNode,
|
||||
at: [number, number]
|
||||
): { modifiedAst: UnboxedNode<Program>; pathToNode: PathToNode } | Error {
|
||||
): { modifiedAst: Program; pathToNode: PathToNode } | Error {
|
||||
const _node1 = getNodeFromPath<VariableDeclaration>(
|
||||
node,
|
||||
pathToNode,
|
||||
@ -115,7 +114,7 @@ export function addStartProfileAt(
|
||||
}
|
||||
|
||||
export function addSketchTo(
|
||||
node: UnboxedNode<Program>,
|
||||
node: Program,
|
||||
axis: 'xy' | 'xz' | 'yz',
|
||||
name = ''
|
||||
): { modifiedAst: Program; id: string; pathToNode: PathToNode } {
|
||||
@ -211,7 +210,7 @@ export function mutateArrExp(node: Expr, updateWith: ArrayExpression): boolean {
|
||||
|
||||
export function mutateObjExpProp(
|
||||
node: Expr,
|
||||
updateWith: UnboxedNode<Literal> | UnboxedNode<ArrayExpression>,
|
||||
updateWith: Literal | ArrayExpression,
|
||||
key: string
|
||||
): boolean {
|
||||
if (node.type === 'ObjectExpression') {
|
||||
@ -249,13 +248,13 @@ export function mutateObjExpProp(
|
||||
}
|
||||
|
||||
export function extrudeSketch(
|
||||
node: UnboxedNode<Program>,
|
||||
node: Program,
|
||||
pathToNode: PathToNode,
|
||||
shouldPipe = false,
|
||||
distance: Expr = createLiteral(4)
|
||||
):
|
||||
| {
|
||||
modifiedAst: UnboxedNode<Program>
|
||||
modifiedAst: Program
|
||||
pathToNode: PathToNode
|
||||
pathToExtrudeArg: PathToNode
|
||||
}
|
||||
@ -344,13 +343,13 @@ export function extrudeSketch(
|
||||
}
|
||||
|
||||
export function revolveSketch(
|
||||
node: UnboxedNode<Program>,
|
||||
node: Program,
|
||||
pathToNode: PathToNode,
|
||||
shouldPipe = false,
|
||||
angle: Expr = createLiteral(4)
|
||||
):
|
||||
| {
|
||||
modifiedAst: UnboxedNode<Program>
|
||||
modifiedAst: Program
|
||||
pathToNode: PathToNode
|
||||
pathToRevolveArg: PathToNode
|
||||
}
|
||||
@ -440,7 +439,7 @@ export function revolveSketch(
|
||||
}
|
||||
|
||||
export function sketchOnExtrudedFace(
|
||||
node: UnboxedNode<Program>,
|
||||
node: Program,
|
||||
sketchPathToNode: PathToNode,
|
||||
extrudePathToNode: PathToNode,
|
||||
info: ExtrudeFacePlane['faceInfo'] = { type: 'wall' }
|
||||
@ -572,7 +571,7 @@ export function splitPathAtPipeExpression(pathToNode: PathToNode): {
|
||||
return splitPathAtPipeExpression(pathToNode.slice(0, -1))
|
||||
}
|
||||
|
||||
export function createLiteral(value: string | number): UnboxedNode<Literal> {
|
||||
export function createLiteral(value: string | number): Literal {
|
||||
return {
|
||||
type: 'Literal',
|
||||
start: 0,
|
||||
@ -582,7 +581,7 @@ export function createLiteral(value: string | number): UnboxedNode<Literal> {
|
||||
}
|
||||
}
|
||||
|
||||
export function createTagDeclarator(value: string): UnboxedNode<TagDeclarator> {
|
||||
export function createTagDeclarator(value: string): TagDeclarator {
|
||||
return {
|
||||
type: 'TagDeclarator',
|
||||
start: 0,
|
||||
@ -592,7 +591,7 @@ export function createTagDeclarator(value: string): UnboxedNode<TagDeclarator> {
|
||||
}
|
||||
}
|
||||
|
||||
export function createIdentifier(name: string): UnboxedNode<Identifier> {
|
||||
export function createIdentifier(name: string): Identifier {
|
||||
return {
|
||||
type: 'Identifier',
|
||||
start: 0,
|
||||
@ -602,7 +601,7 @@ export function createIdentifier(name: string): UnboxedNode<Identifier> {
|
||||
}
|
||||
}
|
||||
|
||||
export function createPipeSubstitution(): UnboxedNode<PipeSubstitution> {
|
||||
export function createPipeSubstitution(): PipeSubstitution {
|
||||
return {
|
||||
type: 'PipeSubstitution',
|
||||
start: 0,
|
||||
@ -613,7 +612,7 @@ export function createPipeSubstitution(): UnboxedNode<PipeSubstitution> {
|
||||
export function createCallExpressionStdLib(
|
||||
name: string,
|
||||
args: CallExpression['arguments']
|
||||
): UnboxedNode<CallExpression> {
|
||||
): CallExpression {
|
||||
return {
|
||||
type: 'CallExpression',
|
||||
start: 0,
|
||||
@ -633,7 +632,7 @@ export function createCallExpressionStdLib(
|
||||
export function createCallExpression(
|
||||
name: string,
|
||||
args: CallExpression['arguments']
|
||||
): UnboxedNode<CallExpression> {
|
||||
): CallExpression {
|
||||
return {
|
||||
type: 'CallExpression',
|
||||
start: 0,
|
||||
@ -652,7 +651,7 @@ export function createCallExpression(
|
||||
|
||||
export function createArrayExpression(
|
||||
elements: ArrayExpression['elements']
|
||||
): UnboxedNode<ArrayExpression> {
|
||||
): ArrayExpression {
|
||||
return {
|
||||
type: 'ArrayExpression',
|
||||
start: 0,
|
||||
@ -665,7 +664,7 @@ export function createArrayExpression(
|
||||
|
||||
export function createPipeExpression(
|
||||
body: PipeExpression['body']
|
||||
): UnboxedNode<PipeExpression> {
|
||||
): PipeExpression {
|
||||
return {
|
||||
type: 'PipeExpression',
|
||||
start: 0,
|
||||
@ -681,7 +680,7 @@ export function createVariableDeclaration(
|
||||
init: VariableDeclarator['init'],
|
||||
visibility: VariableDeclaration['visibility'] = 'default',
|
||||
kind: VariableDeclaration['kind'] = 'const'
|
||||
): UnboxedNode<VariableDeclaration> {
|
||||
): VariableDeclaration {
|
||||
return {
|
||||
type: 'VariableDeclaration',
|
||||
start: 0,
|
||||
@ -704,7 +703,7 @@ export function createVariableDeclaration(
|
||||
|
||||
export function createObjectExpression(properties: {
|
||||
[key: string]: Expr
|
||||
}): UnboxedNode<ObjectExpression> {
|
||||
}): ObjectExpression {
|
||||
return {
|
||||
type: 'ObjectExpression',
|
||||
start: 0,
|
||||
@ -725,7 +724,7 @@ export function createObjectExpression(properties: {
|
||||
export function createUnaryExpression(
|
||||
argument: UnaryExpression['argument'],
|
||||
operator: UnaryExpression['operator'] = '-'
|
||||
): UnboxedNode<UnaryExpression> {
|
||||
): UnaryExpression {
|
||||
return {
|
||||
type: 'UnaryExpression',
|
||||
start: 0,
|
||||
@ -740,7 +739,7 @@ export function createBinaryExpression([left, operator, right]: [
|
||||
BinaryExpression['left'],
|
||||
BinaryExpression['operator'],
|
||||
BinaryExpression['right']
|
||||
]): UnboxedNode<BinaryExpression> {
|
||||
]): BinaryExpression {
|
||||
return {
|
||||
type: 'BinaryExpression',
|
||||
start: 0,
|
||||
@ -755,19 +754,19 @@ export function createBinaryExpression([left, operator, right]: [
|
||||
export function createBinaryExpressionWithUnary([left, right]: [
|
||||
BinaryExpression['left'],
|
||||
BinaryExpression['right']
|
||||
]): UnboxedNode<BinaryExpression> {
|
||||
]): BinaryExpression {
|
||||
if (right.type === 'UnaryExpression' && right.operator === '-')
|
||||
return createBinaryExpression([left, '-', right.argument])
|
||||
return createBinaryExpression([left, '+', right])
|
||||
}
|
||||
|
||||
export function giveSketchFnCallTag(
|
||||
ast: UnboxedNode<Program>,
|
||||
ast: Program,
|
||||
range: Selection['range'],
|
||||
tag?: string
|
||||
):
|
||||
| {
|
||||
modifiedAst: UnboxedNode<Program>
|
||||
modifiedAst: Program
|
||||
tag: string
|
||||
isTagExisting: boolean
|
||||
pathToNode: PathToNode
|
||||
@ -802,7 +801,7 @@ export function giveSketchFnCallTag(
|
||||
}
|
||||
|
||||
export function moveValueIntoNewVariablePath(
|
||||
ast: UnboxedNode<Program>,
|
||||
ast: Program,
|
||||
programMemory: ProgramMemory,
|
||||
pathToNode: PathToNode,
|
||||
variableName: string
|
||||
@ -835,12 +834,12 @@ export function moveValueIntoNewVariablePath(
|
||||
}
|
||||
|
||||
export function moveValueIntoNewVariable(
|
||||
ast: UnboxedNode<Program>,
|
||||
ast: Program,
|
||||
programMemory: ProgramMemory,
|
||||
sourceRange: Selection['range'],
|
||||
variableName: string
|
||||
): {
|
||||
modifiedAst: UnboxedNode<Program>
|
||||
modifiedAst: Program
|
||||
pathToReplacedNode?: PathToNode
|
||||
} {
|
||||
const meta = isNodeSafeToReplace(ast, sourceRange)
|
||||
@ -873,17 +872,17 @@ export function moveValueIntoNewVariable(
|
||||
*/
|
||||
export function deleteSegmentFromPipeExpression(
|
||||
dependentRanges: SourceRange[],
|
||||
modifiedAst: UnboxedNode<Program>,
|
||||
modifiedAst: Program,
|
||||
programMemory: ProgramMemory,
|
||||
code: string,
|
||||
pathToNode: PathToNode
|
||||
): UnboxedNode<Program> | Error {
|
||||
): Program | Error {
|
||||
let _modifiedAst = structuredClone(modifiedAst)
|
||||
|
||||
dependentRanges.forEach((range) => {
|
||||
const path = getNodePathFromSourceRange(_modifiedAst, range)
|
||||
|
||||
const callExp = getNodeFromPath<UnboxedNode<CallExpression>>(
|
||||
const callExp = getNodeFromPath<CallExpression>(
|
||||
_modifiedAst,
|
||||
path,
|
||||
'CallExpression',
|
||||
@ -929,11 +928,11 @@ export function deleteSegmentFromPipeExpression(
|
||||
export function removeSingleConstraintInfo(
|
||||
pathToCallExp: PathToNode,
|
||||
argDetails: SimplifiedArgDetails,
|
||||
ast: UnboxedNode<Program>,
|
||||
ast: Program,
|
||||
programMemory: ProgramMemory
|
||||
):
|
||||
| {
|
||||
modifiedAst: UnboxedNode<Program>
|
||||
modifiedAst: Program
|
||||
pathToNodeMap: PathToNodeMap
|
||||
}
|
||||
| false {
|
||||
@ -955,12 +954,12 @@ export function removeSingleConstraintInfo(
|
||||
}
|
||||
|
||||
export async function deleteFromSelection(
|
||||
ast: UnboxedNode<Program>,
|
||||
ast: Program,
|
||||
selection: Selection,
|
||||
programMemory: ProgramMemory,
|
||||
getFaceDetails: (id: string) => Promise<Models['FaceIsPlanar_type']> = () =>
|
||||
({} as any)
|
||||
): Promise<UnboxedNode<Program> | Error> {
|
||||
): Promise<Program | Error> {
|
||||
const astClone = structuredClone(ast)
|
||||
const range = selection.range
|
||||
const path = getNodePathFromSourceRange(ast, range)
|
||||
@ -1135,5 +1134,5 @@ export async function deleteFromSelection(
|
||||
}
|
||||
|
||||
const nonCodeMetaEmpty = () => {
|
||||
return { nonCodeNodes: {}, startNodes: [], start: 0, end: 0 }
|
||||
return { nonCodeNodes: {}, start: [] }
|
||||
}
|
||||
|
@ -36,12 +36,11 @@ import {
|
||||
getSweepFromSuspectedPath,
|
||||
} from 'lang/std/artifactGraph'
|
||||
import { kclManager, engineCommandManager, editorManager } from 'lib/singletons'
|
||||
import { UnboxedNode } from 'wasm-lib/kcl/bindings/UnboxedNode'
|
||||
|
||||
// Apply Fillet To Selection
|
||||
|
||||
export function applyFilletToSelection(
|
||||
ast: UnboxedNode<Program>,
|
||||
ast: Program,
|
||||
selection: Selections,
|
||||
radius: KclCommandValue
|
||||
): void | Error {
|
||||
@ -56,12 +55,10 @@ export function applyFilletToSelection(
|
||||
}
|
||||
|
||||
export function modifyAstCloneWithFilletAndTag(
|
||||
ast: UnboxedNode<Program>,
|
||||
ast: Program,
|
||||
selection: Selections,
|
||||
radius: KclCommandValue
|
||||
):
|
||||
| { modifiedAst: UnboxedNode<Program>; pathToFilletNode: Array<PathToNode> }
|
||||
| Error {
|
||||
): { modifiedAst: Program; pathToFilletNode: Array<PathToNode> } | Error {
|
||||
let clonedAst = structuredClone(ast)
|
||||
const clonedAstForGetExtrude = structuredClone(ast)
|
||||
|
||||
@ -249,7 +246,7 @@ export function getPathToExtrudeForSegmentSelection(
|
||||
}
|
||||
|
||||
async function updateAstAndFocus(
|
||||
modifiedAst: UnboxedNode<Program>,
|
||||
modifiedAst: Program,
|
||||
pathToFilletNode: Array<PathToNode>
|
||||
) {
|
||||
const updatedAst = await kclManager.updateAst(modifiedAst, true, {
|
||||
@ -261,7 +258,7 @@ async function updateAstAndFocus(
|
||||
}
|
||||
|
||||
function mutateAstWithTagForSketchSegment(
|
||||
astClone: UnboxedNode<Program>,
|
||||
astClone: Program,
|
||||
pathToSegmentNode: PathToNode
|
||||
): { modifiedAst: Program; tag: string } | Error {
|
||||
const segmentNode = getNodeFromPath<CallExpression>(
|
||||
@ -295,7 +292,7 @@ function mutateAstWithTagForSketchSegment(
|
||||
function getEdgeTagCall(
|
||||
tag: string,
|
||||
selectionType: string
|
||||
): UnboxedNode<Identifier | CallExpression> {
|
||||
): Identifier | CallExpression {
|
||||
let tagCall: Expr = createIdentifier(tag)
|
||||
|
||||
// Modify the tag based on selectionType
|
||||
@ -429,7 +426,7 @@ export const hasValidFilletSelection = ({
|
||||
code,
|
||||
}: {
|
||||
selectionRanges: Selections
|
||||
ast: UnboxedNode<Program>
|
||||
ast: Program
|
||||
code: string
|
||||
}) => {
|
||||
// check if there is anything filletable in the scene
|
||||
@ -457,7 +454,7 @@ export const hasValidFilletSelection = ({
|
||||
for (const selection of selectionRanges.codeBasedSelections) {
|
||||
// check if all selections are in sketchLineHelperMap
|
||||
const path = getNodePathFromSourceRange(ast, selection.range)
|
||||
const segmentNode = getNodeFromPath<UnboxedNode<CallExpression>>(
|
||||
const segmentNode = getNodeFromPath<CallExpression>(
|
||||
ast,
|
||||
path,
|
||||
'CallExpression'
|
||||
@ -537,7 +534,7 @@ export const isTagUsedInFillet = ({
|
||||
ast,
|
||||
callExp,
|
||||
}: {
|
||||
ast: UnboxedNode<Program>
|
||||
ast: Program
|
||||
callExp: CallExpression
|
||||
}): Array<EdgeTypes> => {
|
||||
const tag = getTagFromCallExpression(callExp)
|
||||
|
@ -29,7 +29,6 @@ import {
|
||||
} from './std/sketchcombos'
|
||||
import { err } from 'lib/trap'
|
||||
import { ImportStatement } from 'wasm-lib/kcl/bindings/ImportStatement'
|
||||
import { UnboxedNode } from 'wasm-lib/kcl/bindings/UnboxedNode'
|
||||
|
||||
/**
|
||||
* Retrieves a node from a given path within a Program node structure, optionally stopping at a specified node type.
|
||||
@ -122,13 +121,12 @@ export function getNodeFromPathCurry(
|
||||
}
|
||||
|
||||
function moreNodePathFromSourceRange(
|
||||
node: UnboxedNode<
|
||||
node:
|
||||
| Expr
|
||||
| ImportStatement
|
||||
| ExpressionStatement
|
||||
| VariableDeclaration
|
||||
| ReturnStatement
|
||||
>,
|
||||
| ReturnStatement,
|
||||
sourceRange: Selection['range'],
|
||||
previousPath: PathToNode = [['body', '']]
|
||||
): PathToNode {
|
||||
@ -346,16 +344,15 @@ export function getNodePathFromSourceRange(
|
||||
return path
|
||||
}
|
||||
|
||||
type KCLNode = UnboxedNode<
|
||||
type KCLNode =
|
||||
| Expr
|
||||
| ExpressionStatement
|
||||
| VariableDeclaration
|
||||
| VariableDeclarator
|
||||
| ReturnStatement
|
||||
>
|
||||
|
||||
export function traverse(
|
||||
node: KCLNode | UnboxedNode<Program>,
|
||||
node: KCLNode | Program,
|
||||
option: {
|
||||
enter?: (node: KCLNode, pathToNode: PathToNode) => void
|
||||
leave?: (node: KCLNode) => void
|
||||
@ -515,9 +512,9 @@ export function findAllPreviousVariables(
|
||||
}
|
||||
|
||||
type ReplacerFn = (
|
||||
_ast: UnboxedNode<Program>,
|
||||
_ast: Program,
|
||||
varName: string
|
||||
) => { modifiedAst: UnboxedNode<Program>; pathToReplaced: PathToNode } | Error
|
||||
) => { modifiedAst: Program; pathToReplaced: PathToNode } | Error
|
||||
|
||||
export function isNodeSafeToReplacePath(
|
||||
ast: Program,
|
||||
@ -586,12 +583,12 @@ export function isNodeSafeToReplacePath(
|
||||
}
|
||||
|
||||
export function isNodeSafeToReplace(
|
||||
ast: UnboxedNode<Program>,
|
||||
ast: Program,
|
||||
sourceRange: [number, number]
|
||||
):
|
||||
| {
|
||||
isSafe: boolean
|
||||
value: UnboxedNode<Expr>
|
||||
value: Expr
|
||||
replacer: ReplacerFn
|
||||
}
|
||||
| Error {
|
||||
@ -840,7 +837,7 @@ export function findUsesOfTagInPipe(
|
||||
? String(thirdParam.value)
|
||||
: thirdParam.name
|
||||
|
||||
const varDec = getNodeFromPath<UnboxedNode<VariableDeclaration>>(
|
||||
const varDec = getNodeFromPath<VariableDeclaration>(
|
||||
ast,
|
||||
pathToNode,
|
||||
'VariableDeclaration'
|
||||
|
@ -50,6 +50,11 @@ export enum ExportIntent {
|
||||
Make = 'make',
|
||||
}
|
||||
|
||||
export interface ExportInfo {
|
||||
intent: ExportIntent
|
||||
name: string
|
||||
}
|
||||
|
||||
type ClientMetrics = Models['ClientMetrics_type']
|
||||
|
||||
interface WebRTCClientMetrics extends ClientMetrics {
|
||||
@ -1354,7 +1359,7 @@ export class EngineCommandManager extends EventTarget {
|
||||
* export in progress. Otherwise it is an enum value of the intent.
|
||||
* Another export cannot be started if one is already in progress.
|
||||
*/
|
||||
private _exportIntent: ExportIntent | null = null
|
||||
private _exportInfo: ExportInfo | null = null
|
||||
_commandLogCallBack: (command: CommandLog[]) => void = () => {}
|
||||
|
||||
subscriptions: {
|
||||
@ -1410,12 +1415,12 @@ export class EngineCommandManager extends EventTarget {
|
||||
(() => {}) as any
|
||||
kclManager: null | KclManager = null
|
||||
|
||||
set exportIntent(intent: ExportIntent | null) {
|
||||
this._exportIntent = intent
|
||||
set exportInfo(info: ExportInfo | null) {
|
||||
this._exportInfo = info
|
||||
}
|
||||
|
||||
get exportIntent() {
|
||||
return this._exportIntent
|
||||
get exportInfo() {
|
||||
return this._exportInfo
|
||||
}
|
||||
|
||||
start({
|
||||
@ -1607,7 +1612,7 @@ export class EngineCommandManager extends EventTarget {
|
||||
// because in all other cases we send JSON strings. But in the case of
|
||||
// export we send a binary blob.
|
||||
// Pass this to our export function.
|
||||
if (this.exportIntent === null || this.pendingExport === undefined) {
|
||||
if (this.exportInfo === null || this.pendingExport === undefined) {
|
||||
toast.error(
|
||||
'Export intent was not set, but export data was received'
|
||||
)
|
||||
@ -1617,7 +1622,7 @@ export class EngineCommandManager extends EventTarget {
|
||||
return
|
||||
}
|
||||
|
||||
switch (this.exportIntent) {
|
||||
switch (this.exportInfo.intent) {
|
||||
case ExportIntent.Save: {
|
||||
exportSave(event.data, this.pendingExport.toastId).then(() => {
|
||||
this.pendingExport?.resolve(null)
|
||||
@ -1625,21 +1630,22 @@ export class EngineCommandManager extends EventTarget {
|
||||
break
|
||||
}
|
||||
case ExportIntent.Make: {
|
||||
exportMake(event.data, this.pendingExport.toastId).then(
|
||||
(result) => {
|
||||
if (result) {
|
||||
this.pendingExport?.resolve(null)
|
||||
} else {
|
||||
this.pendingExport?.reject('Failed to make export')
|
||||
}
|
||||
},
|
||||
this.pendingExport?.reject
|
||||
)
|
||||
exportMake(
|
||||
event.data,
|
||||
this.exportInfo.name,
|
||||
this.pendingExport.toastId
|
||||
).then((result) => {
|
||||
if (result) {
|
||||
this.pendingExport?.resolve(null)
|
||||
} else {
|
||||
this.pendingExport?.reject('Failed to make export')
|
||||
}
|
||||
}, this.pendingExport?.reject)
|
||||
break
|
||||
}
|
||||
}
|
||||
// Set the export intent back to null.
|
||||
this.exportIntent = null
|
||||
this.exportInfo = null
|
||||
return
|
||||
}
|
||||
|
||||
@ -1953,15 +1959,15 @@ export class EngineCommandManager extends EventTarget {
|
||||
return Promise.resolve(null)
|
||||
} else if (cmd.type === 'export') {
|
||||
const promise = new Promise<null>((resolve, reject) => {
|
||||
if (this.exportIntent === null) {
|
||||
if (this.exportIntent === null) {
|
||||
if (this.exportInfo === null) {
|
||||
if (this.exportInfo === null) {
|
||||
toast.error('Export intent was not set, but export is being sent')
|
||||
console.error('Export intent was not set, but export is being sent')
|
||||
return
|
||||
}
|
||||
}
|
||||
const toastId = toast.loading(
|
||||
this.exportIntent === ExportIntent.Save
|
||||
this.exportInfo.intent === ExportIntent.Save
|
||||
? EXPORT_TOAST_MESSAGES.START
|
||||
: MAKE_TOAST_MESSAGES.START
|
||||
)
|
||||
@ -1975,7 +1981,7 @@ export class EngineCommandManager extends EventTarget {
|
||||
resolve(passThrough)
|
||||
},
|
||||
reject: (reason: string) => {
|
||||
this.exportIntent = null
|
||||
this.exportInfo = null
|
||||
reject(reason)
|
||||
},
|
||||
commandId: command.cmd_id,
|
||||
|
@ -17,7 +17,6 @@ import {
|
||||
import { getNodeFromPath, getNodePathFromSourceRange } from '../queryAst'
|
||||
import { enginelessExecutor } from '../../lib/testHelpers'
|
||||
import { err } from 'lib/trap'
|
||||
import { UnboxedNode } from 'wasm-lib/kcl/bindings/UnboxedNode'
|
||||
|
||||
const eachQuad: [number, [number, number]][] = [
|
||||
[-315, [1, 1]],
|
||||
@ -688,7 +687,7 @@ describe('testing getConstraintInfo', () => {
|
||||
]
|
||||
if (err(ast)) return ast
|
||||
const pathToNode = getNodePathFromSourceRange(ast, sourceRange)
|
||||
const callExp = getNodeFromPath<UnboxedNode<CallExpression>>(
|
||||
const callExp = getNodeFromPath<CallExpression>(
|
||||
ast,
|
||||
pathToNode,
|
||||
'CallExpression'
|
||||
@ -842,7 +841,7 @@ describe('testing getConstraintInfo', () => {
|
||||
]
|
||||
if (err(ast)) return ast
|
||||
const pathToNode = getNodePathFromSourceRange(ast, sourceRange)
|
||||
const callExp = getNodeFromPath<UnboxedNode<CallExpression>>(
|
||||
const callExp = getNodeFromPath<CallExpression>(
|
||||
ast,
|
||||
pathToNode,
|
||||
'CallExpression'
|
||||
@ -1198,7 +1197,7 @@ describe('testing getConstraintInfo', () => {
|
||||
]
|
||||
if (err(ast)) return ast
|
||||
const pathToNode = getNodePathFromSourceRange(ast, sourceRange)
|
||||
const callExp = getNodeFromPath<UnboxedNode<CallExpression>>(
|
||||
const callExp = getNodeFromPath<CallExpression>(
|
||||
ast,
|
||||
pathToNode,
|
||||
'CallExpression'
|
||||
|
@ -55,7 +55,6 @@ import { err } from 'lib/trap'
|
||||
import { perpendicularDistance } from 'sketch-helpers'
|
||||
import { TagDeclarator } from 'wasm-lib/kcl/bindings/TagDeclarator'
|
||||
import { EdgeCutInfo } from 'machines/modelingMachine'
|
||||
import { UnboxedNode } from 'wasm-lib/kcl/bindings/UnboxedNode'
|
||||
|
||||
const STRAIGHT_SEGMENT_ERR = new Error(
|
||||
'Invalid input, expected "straight-segment"'
|
||||
@ -1786,8 +1785,7 @@ export const angledLineThatIntersects: SketchLineHelper = {
|
||||
)
|
||||
}
|
||||
if (intersectTag !== -1) {
|
||||
const tag = firstArg.properties[intersectTag]
|
||||
?.value as UnboxedNode<Identifier>
|
||||
const tag = firstArg.properties[intersectTag]?.value as Identifier
|
||||
const pathToTagProp: PathToNode = [
|
||||
...pathToObjectExp,
|
||||
[intersectTag, 'index'],
|
||||
@ -1827,9 +1825,7 @@ export const updateStartProfileAtArgs: SketchLineHelper['updateArgs'] = ({
|
||||
body: [],
|
||||
|
||||
nonCodeMeta: {
|
||||
start: 0,
|
||||
end: 0,
|
||||
startNodes: [],
|
||||
start: [],
|
||||
nonCodeNodes: [],
|
||||
},
|
||||
},
|
||||
@ -1869,7 +1865,7 @@ export const sketchLineHelperMap: { [key: string]: SketchLineHelper } = {
|
||||
} as const
|
||||
|
||||
export function changeSketchArguments(
|
||||
node: UnboxedNode<Program>,
|
||||
node: Program,
|
||||
programMemory: ProgramMemory,
|
||||
sourceRangeOrPath:
|
||||
| {
|
||||
@ -1881,7 +1877,7 @@ export function changeSketchArguments(
|
||||
pathToNode: PathToNode
|
||||
},
|
||||
input: SegmentInputs
|
||||
): { modifiedAst: UnboxedNode<Program>; pathToNode: PathToNode } | Error {
|
||||
): { modifiedAst: Program; pathToNode: PathToNode } | Error {
|
||||
const _node = { ...node }
|
||||
const thePath =
|
||||
sourceRangeOrPath.type === 'sourceRange'
|
||||
@ -1910,7 +1906,7 @@ export function changeSketchArguments(
|
||||
}
|
||||
|
||||
export function getConstraintInfo(
|
||||
callExpression: UnboxedNode<CallExpression>,
|
||||
callExpression: CallExpression,
|
||||
code: string,
|
||||
pathToNode: PathToNode
|
||||
): ConstrainInfo[] {
|
||||
@ -1948,7 +1944,7 @@ export function compareVec2Epsilon2(
|
||||
}
|
||||
|
||||
interface CreateLineFnCallArgs {
|
||||
node: UnboxedNode<Program>
|
||||
node: Program
|
||||
programMemory: ProgramMemory
|
||||
input: SegmentInputs
|
||||
fnName: ToolTip
|
||||
@ -1965,7 +1961,7 @@ export function addNewSketchLn({
|
||||
spliceBetween = false,
|
||||
}: CreateLineFnCallArgs):
|
||||
| {
|
||||
modifiedAst: UnboxedNode<Program>
|
||||
modifiedAst: Program
|
||||
pathToNode: PathToNode
|
||||
}
|
||||
| Error {
|
||||
@ -1975,12 +1971,8 @@ export function addNewSketchLn({
|
||||
return new Error('not a sketch line helper')
|
||||
}
|
||||
|
||||
getNodeFromPath<UnboxedNode<VariableDeclarator>>(
|
||||
node,
|
||||
pathToNode,
|
||||
'VariableDeclarator'
|
||||
)
|
||||
getNodeFromPath<UnboxedNode<PipeExpression | CallExpression>>(
|
||||
getNodeFromPath<VariableDeclarator>(node, pathToNode, 'VariableDeclarator')
|
||||
getNodeFromPath<PipeExpression | CallExpression>(
|
||||
node,
|
||||
pathToNode,
|
||||
'PipeExpression'
|
||||
@ -1999,13 +1991,13 @@ export function addCallExpressionsToPipe({
|
||||
pathToNode,
|
||||
expressions,
|
||||
}: {
|
||||
node: UnboxedNode<Program>
|
||||
node: Program
|
||||
programMemory: ProgramMemory
|
||||
pathToNode: PathToNode
|
||||
expressions: UnboxedNode<CallExpression>[]
|
||||
expressions: CallExpression[]
|
||||
}) {
|
||||
const _node = { ...node }
|
||||
const pipeExpression = getNodeFromPath<UnboxedNode<PipeExpression>>(
|
||||
const pipeExpression = getNodeFromPath<PipeExpression>(
|
||||
_node,
|
||||
pathToNode,
|
||||
'PipeExpression'
|
||||
@ -2054,7 +2046,7 @@ export function replaceSketchLine({
|
||||
replaceExistingCallback,
|
||||
referencedSegment,
|
||||
}: {
|
||||
node: UnboxedNode<Program>
|
||||
node: Program
|
||||
programMemory: ProgramMemory
|
||||
pathToNode: PathToNode
|
||||
fnName: ToolTip
|
||||
@ -2063,7 +2055,7 @@ export function replaceSketchLine({
|
||||
referencedSegment?: Path
|
||||
}):
|
||||
| {
|
||||
modifiedAst: UnboxedNode<Program>
|
||||
modifiedAst: Program
|
||||
valueUsedInTransform?: number
|
||||
pathToNode: PathToNode
|
||||
}
|
||||
@ -2115,7 +2107,7 @@ function addTagToChamfer(
|
||||
edgeCutMeta: EdgeCutInfo | null
|
||||
):
|
||||
| {
|
||||
modifiedAst: UnboxedNode<Program>
|
||||
modifiedAst: Program
|
||||
tag: string
|
||||
}
|
||||
| Error {
|
||||
@ -2242,7 +2234,7 @@ export function addTagForSketchOnFace(
|
||||
edgeCutMeta: EdgeCutInfo | null
|
||||
):
|
||||
| {
|
||||
modifiedAst: UnboxedNode<Program>
|
||||
modifiedAst: Program
|
||||
tag: string
|
||||
}
|
||||
| Error {
|
||||
@ -2280,14 +2272,12 @@ function isAngleLiteral(lineArugement: Expr): boolean {
|
||||
: false
|
||||
}
|
||||
|
||||
type addTagFn = (
|
||||
a: AddTagInfo
|
||||
) => { modifiedAst: UnboxedNode<Program>; tag: string } | Error
|
||||
type addTagFn = (a: AddTagInfo) => { modifiedAst: Program; tag: string } | Error
|
||||
|
||||
function addTag(tagIndex = 2): addTagFn {
|
||||
return ({ node, pathToNode }) => {
|
||||
const _node = { ...node }
|
||||
const callExpr = getNodeFromPath<UnboxedNode<CallExpression>>(
|
||||
const callExpr = getNodeFromPath<CallExpression>(
|
||||
_node,
|
||||
pathToNode,
|
||||
'CallExpression'
|
||||
|
@ -49,7 +49,6 @@ import {
|
||||
getSketchSegmentFromSourceRange,
|
||||
} from './sketchConstraints'
|
||||
import { getAngle, roundOff, normaliseAngle } from '../../lib/utils'
|
||||
import { UnboxedNode } from 'wasm-lib/kcl/bindings/UnboxedNode'
|
||||
|
||||
export type LineInputsType =
|
||||
| 'xAbsolute'
|
||||
@ -326,7 +325,7 @@ const setHorzVertDistanceCreateNode =
|
||||
if (isUndef(refNum) || err(literalArg)) return REF_NUM_ERR
|
||||
|
||||
const valueUsedInTransform = roundOff(literalArg - refNum, 2)
|
||||
let finalValue: UnboxedNode<Expr> = createBinaryExpressionWithUnary([
|
||||
let finalValue: Expr = createBinaryExpressionWithUnary([
|
||||
createSegEnd(referenceSegName, !index),
|
||||
forceValueUsedInTransform || createLiteral(valueUsedInTransform),
|
||||
])
|
||||
@ -1542,7 +1541,7 @@ export function transformSecondarySketchLinesTagFirst({
|
||||
forceSegName,
|
||||
forceValueUsedInTransform,
|
||||
}: {
|
||||
ast: UnboxedNode<Program>
|
||||
ast: Program
|
||||
selectionRanges: Selections
|
||||
transformInfos: TransformInfo[]
|
||||
programMemory: ProgramMemory
|
||||
@ -1550,7 +1549,7 @@ export function transformSecondarySketchLinesTagFirst({
|
||||
forceValueUsedInTransform?: BinaryPart
|
||||
}):
|
||||
| {
|
||||
modifiedAst: UnboxedNode<Program>
|
||||
modifiedAst: Program
|
||||
valueUsedInTransform?: number
|
||||
pathToNodeMap: PathToNodeMap
|
||||
tagInfo: {
|
||||
@ -1621,7 +1620,7 @@ export function transformAstSketchLines({
|
||||
forceValueUsedInTransform,
|
||||
referencedSegmentRange,
|
||||
}: {
|
||||
ast: UnboxedNode<Program>
|
||||
ast: Program
|
||||
selectionRanges: Selections | PathToNode[]
|
||||
transformInfos: TransformInfo[]
|
||||
programMemory: ProgramMemory
|
||||
@ -1630,7 +1629,7 @@ export function transformAstSketchLines({
|
||||
referencedSegmentRange?: Selection['range']
|
||||
}):
|
||||
| {
|
||||
modifiedAst: UnboxedNode<Program>
|
||||
modifiedAst: Program
|
||||
valueUsedInTransform?: number
|
||||
pathToNodeMap: PathToNodeMap
|
||||
}
|
||||
@ -1648,7 +1647,7 @@ export function transformAstSketchLines({
|
||||
|
||||
const getNode = getNodeFromPathCurry(node, _pathToNode)
|
||||
|
||||
const callExp = getNode<UnboxedNode<CallExpression>>('CallExpression')
|
||||
const callExp = getNode<CallExpression>('CallExpression')
|
||||
if (err(callExp)) return callExp
|
||||
const varDec = getNode<VariableDeclarator>('VariableDeclarator')
|
||||
if (err(varDec)) return varDec
|
||||
@ -1807,16 +1806,13 @@ function createSegAngle(referenceSegName: string): BinaryPart {
|
||||
return createCallExpression('segAng', [createIdentifier(referenceSegName)])
|
||||
}
|
||||
|
||||
function createSegEnd(
|
||||
referenceSegName: string,
|
||||
isX: boolean
|
||||
): UnboxedNode<CallExpression> {
|
||||
function createSegEnd(referenceSegName: string, isX: boolean): CallExpression {
|
||||
return createCallExpression(isX ? 'segEndX' : 'segEndY', [
|
||||
createIdentifier(referenceSegName),
|
||||
])
|
||||
}
|
||||
|
||||
function createLastSeg(isX: boolean): UnboxedNode<CallExpression> {
|
||||
function createLastSeg(isX: boolean): CallExpression {
|
||||
return createCallExpression(isX ? 'lastSegX' : 'lastSegY', [
|
||||
createPipeSubstitution(),
|
||||
])
|
||||
@ -1834,7 +1830,7 @@ export function getConstraintLevelFromSourceRange(
|
||||
ast: Program | Error
|
||||
): Error | { range: [number, number]; level: ConstraintLevel } {
|
||||
if (err(ast)) return ast
|
||||
const nodeMeta = getNodeFromPath<UnboxedNode<CallExpression>>(
|
||||
const nodeMeta = getNodeFromPath<CallExpression>(
|
||||
ast,
|
||||
getNodePathFromSourceRange(ast, cursorRange),
|
||||
'CallExpression'
|
||||
|
@ -11,17 +11,16 @@ import {
|
||||
BinaryPart,
|
||||
} from '../wasm'
|
||||
import { LineInputsType } from './sketchcombos'
|
||||
import { UnboxedNode } from 'wasm-lib/kcl/bindings/UnboxedNode'
|
||||
|
||||
export interface ModifyAstBase {
|
||||
node: UnboxedNode<Program>
|
||||
node: Program
|
||||
// TODO #896: Remove ProgramMemory from this interface
|
||||
previousProgramMemory: ProgramMemory
|
||||
pathToNode: PathToNode
|
||||
}
|
||||
|
||||
export interface AddTagInfo {
|
||||
node: UnboxedNode<Program>
|
||||
node: Program
|
||||
pathToNode: PathToNode
|
||||
}
|
||||
|
||||
@ -135,7 +134,7 @@ type _InputArg<T> =
|
||||
* Which is why a union type is used that can be type narrowed using the {@link RawArg.type} property
|
||||
* {@link RawArg.expr} is common to all of these types
|
||||
*/
|
||||
export type InputArg = _InputArg<UnboxedNode<Expr>>
|
||||
export type InputArg = _InputArg<Expr>
|
||||
|
||||
/**
|
||||
* {@link RawArg.expr} is the literal equivalent of whatever current expression is
|
||||
@ -143,7 +142,7 @@ export type InputArg = _InputArg<UnboxedNode<Expr>>
|
||||
* but of course works for expressions like myVar + someFn() etc too
|
||||
* This is useful in cases where we want to "un-constrain" inputs to segments
|
||||
*/
|
||||
type RawArg = _InputArg<UnboxedNode<Literal>>
|
||||
type RawArg = _InputArg<Literal>
|
||||
|
||||
export type InputArgs = Array<InputArg>
|
||||
|
||||
@ -187,7 +186,7 @@ export type CreateStdLibSketchCallExpr = (args: {
|
||||
inputs: InputArgs
|
||||
rawArgs: RawArgs
|
||||
referenceSegName: string
|
||||
tag?: UnboxedNode<Expr>
|
||||
tag?: Expr
|
||||
forceValueUsedInTransform?: BinaryPart
|
||||
referencedSegment?: Path
|
||||
}) => CreatedSketchExprResult | Error
|
||||
@ -216,26 +215,26 @@ export interface ConstrainInfo {
|
||||
export interface SketchLineHelper {
|
||||
add: (a: addCall) =>
|
||||
| {
|
||||
modifiedAst: UnboxedNode<Program>
|
||||
modifiedAst: Program
|
||||
pathToNode: PathToNode
|
||||
valueUsedInTransform?: number
|
||||
}
|
||||
| Error
|
||||
updateArgs: (a: updateArgs) =>
|
||||
| {
|
||||
modifiedAst: UnboxedNode<Program>
|
||||
modifiedAst: Program
|
||||
pathToNode: PathToNode
|
||||
}
|
||||
| Error
|
||||
getTag: (a: CallExpression) => string | Error
|
||||
addTag: (a: AddTagInfo) =>
|
||||
| {
|
||||
modifiedAst: UnboxedNode<Program>
|
||||
modifiedAst: Program
|
||||
tag: string
|
||||
}
|
||||
| Error
|
||||
getConstraintInfo: (
|
||||
callExp: UnboxedNode<CallExpression>,
|
||||
callExp: CallExpression,
|
||||
code: string,
|
||||
pathToNode: PathToNode
|
||||
) => ConstrainInfo[]
|
||||
|
@ -1,13 +0,0 @@
|
||||
import { err } from 'lib/trap'
|
||||
import { parse } from './wasm'
|
||||
import { enginelessExecutor } from 'lib/testHelpers'
|
||||
|
||||
it('can execute parsed AST', async () => {
|
||||
const code = `x = 1
|
||||
// A comment.`
|
||||
const ast = parse(code)
|
||||
expect(err(ast)).toEqual(false)
|
||||
const execState = await enginelessExecutor(ast)
|
||||
expect(err(ast)).toEqual(false)
|
||||
expect(execState.memory.get('x')).toEqual(1)
|
||||
})
|
@ -42,7 +42,6 @@ import { ExecState as RawExecState } from '../wasm-lib/kcl/bindings/ExecState'
|
||||
import { ProgramMemory as RawProgramMemory } from '../wasm-lib/kcl/bindings/ProgramMemory'
|
||||
import { EnvironmentRef } from '../wasm-lib/kcl/bindings/EnvironmentRef'
|
||||
import { Environment } from '../wasm-lib/kcl/bindings/Environment'
|
||||
import { UnboxedNode } from 'wasm-lib/kcl/bindings/UnboxedNode'
|
||||
|
||||
export type { Program } from '../wasm-lib/kcl/bindings/Program'
|
||||
export type { Expr } from '../wasm-lib/kcl/bindings/Expr'
|
||||
@ -111,6 +110,7 @@ const initialise = async () => {
|
||||
const fullUrl = wasmUrl()
|
||||
const input = await fetch(fullUrl)
|
||||
const buffer = await input.arrayBuffer()
|
||||
|
||||
return await init(buffer)
|
||||
} catch (e) {
|
||||
console.log('Error initialising WASM', e)
|
||||
@ -123,11 +123,11 @@ export const initPromise = initialise()
|
||||
export const rangeTypeFix = (ranges: number[][]): [number, number][] =>
|
||||
ranges.map(([start, end]) => [start, end])
|
||||
|
||||
export const parse = (code: string | Error): UnboxedNode<Program> | Error => {
|
||||
export const parse = (code: string | Error): Program | Error => {
|
||||
if (err(code)) return code
|
||||
|
||||
try {
|
||||
const program: UnboxedNode<Program> = parse_wasm(code)
|
||||
const program: Program = parse_wasm(code)
|
||||
return program
|
||||
} catch (e: any) {
|
||||
// throw e
|
||||
@ -379,7 +379,7 @@ export function sketchFromKclValue(
|
||||
}
|
||||
|
||||
export const executor = async (
|
||||
node: UnboxedNode<Program>,
|
||||
node: Program,
|
||||
programMemory: ProgramMemory | Error = ProgramMemory.empty(),
|
||||
idGenerator: IdGenerator = defaultIdGenerator(),
|
||||
engineCommandManager: EngineCommandManager,
|
||||
@ -403,7 +403,7 @@ export const executor = async (
|
||||
}
|
||||
|
||||
export const _executor = async (
|
||||
node: UnboxedNode<Program>,
|
||||
node: Program,
|
||||
programMemory: ProgramMemory | Error = ProgramMemory.empty(),
|
||||
idGenerator: IdGenerator = defaultIdGenerator(),
|
||||
engineCommandManager: EngineCommandManager,
|
||||
@ -494,13 +494,13 @@ export function lexer(str: string): Token[] | Error {
|
||||
|
||||
export const modifyAstForSketch = async (
|
||||
engineCommandManager: EngineCommandManager,
|
||||
ast: UnboxedNode<Program>,
|
||||
ast: Program,
|
||||
variableName: string,
|
||||
currentPlane: string,
|
||||
engineId: string
|
||||
): Promise<UnboxedNode<Program>> => {
|
||||
): Promise<Program> => {
|
||||
try {
|
||||
const updatedAst: UnboxedNode<Program> = await modify_ast_for_sketch_wasm(
|
||||
const updatedAst: Program = await modify_ast_for_sketch_wasm(
|
||||
engineCommandManager,
|
||||
JSON.stringify(ast),
|
||||
variableName,
|
||||
|
@ -5,7 +5,6 @@ import { Selection } from './selections'
|
||||
import { Identifier, Expr, VariableDeclaration } from 'lang/wasm'
|
||||
import { commandBarMachine } from 'machines/commandBarMachine'
|
||||
import { ReactNode } from 'react'
|
||||
import { UnboxedNode } from 'wasm-lib/kcl/bindings/UnboxedNode'
|
||||
|
||||
type Icon = CustomIconName
|
||||
const PLATFORMS = ['both', 'web', 'desktop'] as const
|
||||
@ -24,8 +23,8 @@ export interface KclExpression {
|
||||
}
|
||||
export interface KclExpressionWithVariable extends KclExpression {
|
||||
variableName: string
|
||||
variableDeclarationAst: UnboxedNode<VariableDeclaration>
|
||||
variableIdentifierAst: UnboxedNode<Identifier>
|
||||
variableDeclarationAst: VariableDeclaration
|
||||
variableIdentifierAst: Identifier
|
||||
insertIndex: number
|
||||
}
|
||||
export type KclCommandValue = KclExpression | KclExpressionWithVariable
|
||||
|
@ -92,6 +92,7 @@ export const MAKE_TOAST_MESSAGES = {
|
||||
NO_MACHINE_API_IP: 'No machine api ip available',
|
||||
NO_CURRENT_MACHINE: 'No current machine available',
|
||||
NO_MACHINE_ID: 'No machine id available',
|
||||
NO_NAME: 'No name provided',
|
||||
ERROR_STARTING_PRINT: 'Error while starting print',
|
||||
SUCCESS: 'Started print successfully',
|
||||
}
|
||||
|
31
src/lib/engineUtils.ts
Normal file
31
src/lib/engineUtils.ts
Normal file
@ -0,0 +1,31 @@
|
||||
import EngineUtils from '@engine-utils'
|
||||
|
||||
type KCEngineUtilsEvaluatePath = {
|
||||
(sketch: string, t: number): string
|
||||
}
|
||||
let kcEngineUtilsEvaluatePath: KCEngineUtilsEvaluatePath
|
||||
|
||||
export async function init() {
|
||||
return await new Promise((resolve, reject) => {
|
||||
try {
|
||||
EngineUtils().then((module) => {
|
||||
kcEngineUtilsEvaluatePath = module.cwrap(
|
||||
'kcEngineUtilsEvaluatePath',
|
||||
'string',
|
||||
['string', 'number']
|
||||
)
|
||||
resolve(true)
|
||||
})
|
||||
} catch (e) {
|
||||
reject(e)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
export async function getTruePathEndPos(sketch: string) {
|
||||
if (!kcEngineUtilsEvaluatePath) {
|
||||
await init()
|
||||
}
|
||||
|
||||
return kcEngineUtilsEvaluatePath(sketch, 1.0)
|
||||
}
|
@ -8,8 +8,15 @@ import { MAKE_TOAST_MESSAGES } from './constants'
|
||||
// Make files locally from an export call.
|
||||
export async function exportMake(
|
||||
data: ArrayBuffer,
|
||||
name: string,
|
||||
toastId: string
|
||||
): Promise<Response | null> {
|
||||
if (name === '') {
|
||||
console.error(MAKE_TOAST_MESSAGES.NO_NAME)
|
||||
toast.error(MAKE_TOAST_MESSAGES.NO_NAME, { id: toastId })
|
||||
return null
|
||||
}
|
||||
|
||||
if (machineManager.machineCount() === 0) {
|
||||
console.error(MAKE_TOAST_MESSAGES.NO_MACHINES)
|
||||
toast.error(MAKE_TOAST_MESSAGES.NO_MACHINES, { id: toastId })
|
||||
@ -39,7 +46,7 @@ export async function exportMake(
|
||||
|
||||
const params: components['schemas']['PrintParameters'] = {
|
||||
machine_id: machineId,
|
||||
job_name: 'Exported Job', // TODO: make this the project name.
|
||||
job_name: name,
|
||||
}
|
||||
try {
|
||||
console.log('params', params)
|
||||
|
@ -36,7 +36,6 @@ import {
|
||||
getWallCodeRef,
|
||||
ArtifactId,
|
||||
} from 'lang/std/artifactGraph'
|
||||
import { UnboxedNode } from 'wasm-lib/kcl/bindings/UnboxedNode'
|
||||
|
||||
export const X_AXIS_UUID = 'ad792545-7fd3-482a-a602-a93924e3055b'
|
||||
export const Y_AXIS_UUID = '680fd157-266f-4b8a-984f-cdf46b8bdf01'
|
||||
@ -245,7 +244,7 @@ export function getEventForSegmentSelection(
|
||||
const updatedAst = parse(codeManager.code)
|
||||
if (err(updatedAst)) return null
|
||||
|
||||
const nodeMeta = getNodeFromPath<UnboxedNode<CallExpression>>(
|
||||
const nodeMeta = getNodeFromPath<CallExpression>(
|
||||
updatedAst,
|
||||
pathToNode,
|
||||
'CallExpression'
|
||||
@ -363,7 +362,7 @@ function updateSceneObjectColors(codeBasedSelections: Selection[]) {
|
||||
|
||||
Object.values(sceneEntitiesManager.activeSegments).forEach((segmentGroup) => {
|
||||
if (!SEGMENT_BODIES_PLUS_PROFILE_START.includes(segmentGroup?.name)) return
|
||||
const nodeMeta = getNodeFromPath<UnboxedNode<CallExpression>>(
|
||||
const nodeMeta = getNodeFromPath<CallExpression>(
|
||||
updated,
|
||||
segmentGroup.userData.pathToNode,
|
||||
'CallExpression'
|
||||
|
@ -17,7 +17,6 @@ import { DefaultPlanes } from 'wasm-lib/kcl/bindings/DefaultPlanes'
|
||||
import { err, reportRejection } from 'lib/trap'
|
||||
import { toSync } from './utils'
|
||||
import { IdGenerator } from 'wasm-lib/kcl/bindings/IdGenerator'
|
||||
import { UnboxedNode } from 'wasm-lib/kcl/bindings/UnboxedNode'
|
||||
|
||||
type WebSocketResponse = Models['WebSocketResponse_type']
|
||||
|
||||
@ -85,7 +84,7 @@ class MockEngineCommandManager {
|
||||
}
|
||||
|
||||
export async function enginelessExecutor(
|
||||
ast: UnboxedNode<Program> | Error,
|
||||
ast: Program | Error,
|
||||
pm: ProgramMemory | Error = ProgramMemory.empty(),
|
||||
idGenerator: IdGenerator = defaultIdGenerator()
|
||||
): Promise<ExecState> {
|
||||
@ -110,7 +109,7 @@ export async function enginelessExecutor(
|
||||
}
|
||||
|
||||
export async function executor(
|
||||
ast: UnboxedNode<Program>,
|
||||
ast: Program,
|
||||
pm: ProgramMemory = ProgramMemory.empty(),
|
||||
idGenerator: IdGenerator = defaultIdGenerator()
|
||||
): Promise<ExecState> {
|
||||
|
12
src/wasm-lib/Cargo.lock
generated
12
src/wasm-lib/Cargo.lock
generated
@ -121,9 +121,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "anyhow"
|
||||
version = "1.0.89"
|
||||
version = "1.0.91"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "86fdf8605db99b54d3cd748a44c6d04df638eb5dafb219b135d0149bd0db01f6"
|
||||
checksum = "c042108f3ed77fd83760a5fd79b53be043192bb3b9dba91d8c574c0ada7850c8"
|
||||
dependencies = [
|
||||
"backtrace",
|
||||
]
|
||||
@ -1684,9 +1684,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "kittycad-modeling-cmds"
|
||||
version = "0.2.68"
|
||||
version = "0.2.70"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7e3aedfcc1d8ea9995ec3eb78a6743c585c9380475c48701797f107489b696aa"
|
||||
checksum = "b135696d07a4fab928e5abace4dd05f4976eafab5d73e5747a85dc5a684b936c"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"chrono",
|
||||
@ -3005,9 +3005,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "serde_json"
|
||||
version = "1.0.128"
|
||||
version = "1.0.132"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6ff5456707a1de34e7e37f2a6fd3d3f808c318259cbd01ab6377795054b483d8"
|
||||
checksum = "d726bfaff4b320266d395898905d0eba0345aae23b54aee3a737e260fd46db03"
|
||||
dependencies = [
|
||||
"indexmap 2.6.0",
|
||||
"itoa",
|
||||
|
@ -72,7 +72,7 @@ members = [
|
||||
[workspace.dependencies]
|
||||
http = "1"
|
||||
kittycad = { version = "0.3.23", default-features = false, features = ["js", "requests"] }
|
||||
kittycad-modeling-cmds = { version = "0.2.68", features = ["websocket"] }
|
||||
kittycad-modeling-cmds = { version = "0.2.70", features = ["websocket"] }
|
||||
|
||||
[[test]]
|
||||
name = "executor"
|
||||
|
@ -1,6 +1,6 @@
|
||||
extern crate alloc;
|
||||
use kcl_lib::ast::types::{
|
||||
BodyItem, Expr, Identifier, ItemVisibility, Literal, LiteralValue, Program, UnboxedNode, VariableDeclaration,
|
||||
BodyItem, Expr, Identifier, ItemVisibility, Literal, LiteralValue, NonCodeMeta, Program, VariableDeclaration,
|
||||
VariableDeclarator, VariableKind,
|
||||
};
|
||||
use kcl_macros::parse;
|
||||
@ -9,46 +9,36 @@ use pretty_assertions::assert_eq;
|
||||
#[test]
|
||||
fn basic() {
|
||||
let actual = parse!("const y = 4");
|
||||
let expected = UnboxedNode {
|
||||
inner: Program {
|
||||
body: vec![BodyItem::VariableDeclaration(UnboxedNode::new(
|
||||
VariableDeclaration {
|
||||
declarations: vec![UnboxedNode::new(
|
||||
VariableDeclarator {
|
||||
id: UnboxedNode::new(
|
||||
Identifier {
|
||||
name: "y".to_owned(),
|
||||
digest: None,
|
||||
},
|
||||
6,
|
||||
7,
|
||||
),
|
||||
init: Expr::Literal(UnboxedNode::new(
|
||||
Literal {
|
||||
value: LiteralValue::IInteger(4),
|
||||
raw: "4".to_owned(),
|
||||
digest: None,
|
||||
},
|
||||
10,
|
||||
11,
|
||||
)),
|
||||
digest: None,
|
||||
},
|
||||
6,
|
||||
11,
|
||||
)],
|
||||
visibility: ItemVisibility::Default,
|
||||
kind: VariableKind::Const,
|
||||
digest: None,
|
||||
},
|
||||
0,
|
||||
11,
|
||||
))],
|
||||
non_code_meta: Default::default(),
|
||||
digest: None,
|
||||
},
|
||||
let expected = Program {
|
||||
start: 0,
|
||||
end: 11,
|
||||
body: vec![BodyItem::VariableDeclaration(Box::new(VariableDeclaration {
|
||||
start: 0,
|
||||
end: 11,
|
||||
declarations: vec![VariableDeclarator {
|
||||
start: 6,
|
||||
end: 11,
|
||||
id: Identifier {
|
||||
start: 6,
|
||||
end: 7,
|
||||
name: "y".to_owned(),
|
||||
digest: None,
|
||||
},
|
||||
init: Expr::Literal(Box::new(Literal {
|
||||
start: 10,
|
||||
end: 11,
|
||||
value: LiteralValue::IInteger(4),
|
||||
raw: "4".to_owned(),
|
||||
digest: None,
|
||||
})),
|
||||
digest: None,
|
||||
}],
|
||||
visibility: ItemVisibility::Default,
|
||||
kind: VariableKind::Const,
|
||||
digest: None,
|
||||
}))],
|
||||
non_code_meta: NonCodeMeta::default(),
|
||||
digest: None,
|
||||
};
|
||||
assert_eq!(expected, actual);
|
||||
}
|
||||
|
@ -68,7 +68,7 @@ tokio-tungstenite = { version = "0.24.0", features = ["rustls-tls-native-roots"]
|
||||
tower-lsp = { version = "0.20.0", features = ["proposed"] }
|
||||
|
||||
[features]
|
||||
default = ["engine"]
|
||||
default = ["engine"] # add wasm-engine-utils here when we're ready
|
||||
cli = ["dep:clap"]
|
||||
# For the lsp server, when run with stdout for rpc we want to disable println.
|
||||
# This is used for editor extensions that use the lsp server.
|
||||
@ -77,6 +77,10 @@ engine = []
|
||||
pyo3 = ["dep:pyo3"]
|
||||
# Helper functions also used in benchmarks.
|
||||
lsp-test-util = []
|
||||
#if enabled, kcl will link directly against a wasm build of the engine utils lib to save latency
|
||||
wasm-engine-utils = []
|
||||
#if enabled, kcl will link directly against a native build of the engine utils lib to save latency (not yet functional)
|
||||
native-engine-utils = []
|
||||
|
||||
tabled = ["dep:tabled"]
|
||||
|
||||
|
@ -16,8 +16,6 @@ use crate::{
|
||||
executor::{Point2d, SourceRange},
|
||||
};
|
||||
|
||||
use super::types::UnboxedNode;
|
||||
|
||||
type Point3d = kcmc::shared::Point3d<f64>;
|
||||
|
||||
#[derive(Debug)]
|
||||
@ -37,7 +35,7 @@ const EPSILON: f64 = 0.015625; // or 2^-6
|
||||
/// a move or a new line.
|
||||
pub async fn modify_ast_for_sketch(
|
||||
engine: &Arc<Box<dyn EngineManager>>,
|
||||
program: &mut UnboxedNode<Program>,
|
||||
program: &mut Program,
|
||||
// The name of the sketch.
|
||||
sketch_name: &str,
|
||||
// The type of plane the sketch is on. `XY` or `XZ`, etc
|
||||
@ -197,7 +195,7 @@ fn create_start_sketch_on(
|
||||
end: [f64; 2],
|
||||
plane: crate::executor::PlaneType,
|
||||
additional_lines: Vec<[f64; 2]>,
|
||||
) -> Result<UnboxedNode<VariableDeclarator>, KclError> {
|
||||
) -> Result<VariableDeclarator, KclError> {
|
||||
let start_sketch_on = CallExpression::new("startSketchOn", vec![Literal::new(plane.to_string().into()).into()])?;
|
||||
let start_profile_at = CallExpression::new(
|
||||
"startProfileAt",
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,10 +1,9 @@
|
||||
use crate::executor::Metadata;
|
||||
use crate::executor::SourceRange;
|
||||
|
||||
use super::impl_value_meta;
|
||||
use super::ConstraintLevel;
|
||||
use super::Hover;
|
||||
use super::Node;
|
||||
use super::NodeList;
|
||||
use super::UnboxedNode;
|
||||
use super::{Digest, Expr};
|
||||
use databake::*;
|
||||
use schemars::JsonSchema;
|
||||
@ -20,10 +19,12 @@ type IfBlock = crate::ast::types::Program;
|
||||
#[ts(export)]
|
||||
#[serde(tag = "type")]
|
||||
pub struct IfExpression {
|
||||
pub start: usize,
|
||||
pub end: usize,
|
||||
pub cond: Box<Expr>,
|
||||
pub then_val: Node<IfBlock>,
|
||||
pub else_ifs: NodeList<ElseIf>,
|
||||
pub final_else: Node<IfBlock>,
|
||||
pub then_val: Box<IfBlock>,
|
||||
pub else_ifs: Vec<ElseIf>,
|
||||
pub final_else: Box<IfBlock>,
|
||||
|
||||
pub digest: Option<Digest>,
|
||||
}
|
||||
@ -33,21 +34,57 @@ pub struct IfExpression {
|
||||
#[ts(export)]
|
||||
#[serde(tag = "type")]
|
||||
pub struct ElseIf {
|
||||
pub start: usize,
|
||||
pub end: usize,
|
||||
pub cond: Expr,
|
||||
pub then_val: Node<IfBlock>,
|
||||
pub then_val: Box<IfBlock>,
|
||||
|
||||
pub digest: Option<Digest>,
|
||||
}
|
||||
|
||||
// Source code metadata
|
||||
|
||||
impl UnboxedNode<IfExpression> {
|
||||
impl_value_meta!(IfExpression);
|
||||
impl_value_meta!(ElseIf);
|
||||
|
||||
impl IfExpression {
|
||||
fn source_ranges(&self) -> Vec<SourceRange> {
|
||||
vec![SourceRange::from(self)]
|
||||
}
|
||||
}
|
||||
|
||||
impl UnboxedNode<ElseIf> {
|
||||
impl From<IfExpression> for Metadata {
|
||||
fn from(value: IfExpression) -> Self {
|
||||
Self {
|
||||
source_range: value.into(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<ElseIf> for Metadata {
|
||||
fn from(value: ElseIf) -> Self {
|
||||
Self {
|
||||
source_range: value.into(),
|
||||
}
|
||||
}
|
||||
}
|
||||
impl From<&IfExpression> for Metadata {
|
||||
fn from(value: &IfExpression) -> Self {
|
||||
Self {
|
||||
source_range: value.into(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<&ElseIf> for Metadata {
|
||||
fn from(value: &ElseIf) -> Self {
|
||||
Self {
|
||||
source_range: value.into(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl ElseIf {
|
||||
#[allow(dead_code)]
|
||||
fn source_ranges(&self) -> Vec<SourceRange> {
|
||||
vec![SourceRange([self.start, self.end])]
|
||||
@ -56,15 +93,6 @@ impl UnboxedNode<ElseIf> {
|
||||
|
||||
// IDE support and refactors
|
||||
|
||||
impl UnboxedNode<IfExpression> {
|
||||
/// Get the constraint level.
|
||||
pub fn get_constraint_level(&self) -> ConstraintLevel {
|
||||
ConstraintLevel::Full {
|
||||
source_ranges: self.source_ranges(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl IfExpression {
|
||||
pub fn get_hover_value_for_position(&self, pos: usize, code: &str) -> Option<Hover> {
|
||||
self.cond
|
||||
@ -87,7 +115,12 @@ impl IfExpression {
|
||||
}
|
||||
self.final_else.rename_identifiers(old_name, new_name);
|
||||
}
|
||||
|
||||
/// Get the constraint level.
|
||||
pub fn get_constraint_level(&self) -> ConstraintLevel {
|
||||
ConstraintLevel::Full {
|
||||
source_ranges: self.source_ranges(),
|
||||
}
|
||||
}
|
||||
pub fn replace_value(&mut self, source_range: SourceRange, new_value: Expr) {
|
||||
self.cond.replace_value(source_range, new_value.clone());
|
||||
for else_if in &mut self.else_ifs {
|
||||
|
@ -1,7 +1,7 @@
|
||||
use super::{
|
||||
human_friendly_type, ArrayExpression, ArrayRangeExpression, BinaryExpression, BinaryOperator, BinaryPart,
|
||||
CallExpression, Expr, IfExpression, LiteralIdentifier, LiteralValue, MemberExpression, MemberObject,
|
||||
ObjectExpression, TagDeclarator, UnaryExpression, UnaryOperator, UnboxedNode,
|
||||
ObjectExpression, TagDeclarator, UnaryExpression, UnaryOperator,
|
||||
};
|
||||
use crate::{
|
||||
errors::{KclError, KclErrorDetails},
|
||||
@ -32,7 +32,7 @@ impl BinaryPart {
|
||||
}
|
||||
}
|
||||
|
||||
impl UnboxedNode<MemberExpression> {
|
||||
impl MemberExpression {
|
||||
pub fn get_result_array(&self, exec_state: &mut ExecState, index: usize) -> Result<KclValue, KclError> {
|
||||
let array = match &self.object {
|
||||
MemberObject::MemberExpression(member_expr) => member_expr.get_result(exec_state)?,
|
||||
@ -137,7 +137,7 @@ impl UnboxedNode<MemberExpression> {
|
||||
}
|
||||
}
|
||||
|
||||
impl UnboxedNode<BinaryExpression> {
|
||||
impl BinaryExpression {
|
||||
#[async_recursion]
|
||||
pub async fn get_result(&self, exec_state: &mut ExecState, ctx: &ExecutorContext) -> Result<KclValue, KclError> {
|
||||
let left_json_value = self.left.get_result(exec_state, ctx).await?.get_json_value()?;
|
||||
@ -186,7 +186,7 @@ impl UnboxedNode<BinaryExpression> {
|
||||
}
|
||||
}
|
||||
|
||||
impl UnboxedNode<UnaryExpression> {
|
||||
impl UnaryExpression {
|
||||
pub async fn get_result(&self, exec_state: &mut ExecState, ctx: &ExecutorContext) -> Result<KclValue, KclError> {
|
||||
if self.operator == UnaryOperator::Not {
|
||||
let value = self.argument.get_result(exec_state, ctx).await?.get_json_value()?;
|
||||
@ -297,7 +297,7 @@ async fn inner_execute_pipe_body(
|
||||
Ok(final_output)
|
||||
}
|
||||
|
||||
impl UnboxedNode<CallExpression> {
|
||||
impl CallExpression {
|
||||
#[async_recursion]
|
||||
pub async fn execute(&self, exec_state: &mut ExecState, ctx: &ExecutorContext) -> Result<KclValue, KclError> {
|
||||
let fn_name = &self.callee.name;
|
||||
@ -502,7 +502,7 @@ impl UnboxedNode<CallExpression> {
|
||||
}
|
||||
}
|
||||
|
||||
impl UnboxedNode<TagDeclarator> {
|
||||
impl TagDeclarator {
|
||||
pub async fn execute(&self, exec_state: &mut ExecState) -> Result<KclValue, KclError> {
|
||||
let memory_item = KclValue::TagIdentifier(Box::new(TagIdentifier {
|
||||
value: self.name.clone(),
|
||||
@ -518,7 +518,7 @@ impl UnboxedNode<TagDeclarator> {
|
||||
}
|
||||
}
|
||||
|
||||
impl UnboxedNode<ArrayExpression> {
|
||||
impl ArrayExpression {
|
||||
#[async_recursion]
|
||||
pub async fn execute(&self, exec_state: &mut ExecState, ctx: &ExecutorContext) -> Result<KclValue, KclError> {
|
||||
let mut results = Vec::with_capacity(self.elements.len());
|
||||
@ -543,21 +543,21 @@ impl UnboxedNode<ArrayExpression> {
|
||||
}
|
||||
}
|
||||
|
||||
impl UnboxedNode<ArrayRangeExpression> {
|
||||
impl ArrayRangeExpression {
|
||||
#[async_recursion]
|
||||
pub async fn execute(&self, exec_state: &mut ExecState, ctx: &ExecutorContext) -> Result<KclValue, KclError> {
|
||||
let metadata = Metadata::from(&self.start_element);
|
||||
let metadata = Metadata::from(&*self.start_element);
|
||||
let start = ctx
|
||||
.execute_expr(&self.start_element, exec_state, &metadata, StatementKind::Expression)
|
||||
.await?
|
||||
.get_json_value()?;
|
||||
let start = parse_json_number_as_u64(&start, (&self.start_element).into())?;
|
||||
let metadata = Metadata::from(&self.end_element);
|
||||
let start = parse_json_number_as_i64(&start, (&*self.start_element).into())?;
|
||||
let metadata = Metadata::from(&*self.end_element);
|
||||
let end = ctx
|
||||
.execute_expr(&self.end_element, exec_state, &metadata, StatementKind::Expression)
|
||||
.await?
|
||||
.get_json_value()?;
|
||||
let end = parse_json_number_as_u64(&end, (&self.end_element).into())?;
|
||||
let end = parse_json_number_as_i64(&end, (&*self.end_element).into())?;
|
||||
|
||||
if end < start {
|
||||
return Err(KclError::Semantic(KclErrorDetails {
|
||||
@ -581,7 +581,7 @@ impl UnboxedNode<ArrayRangeExpression> {
|
||||
}
|
||||
}
|
||||
|
||||
impl UnboxedNode<ObjectExpression> {
|
||||
impl ObjectExpression {
|
||||
#[async_recursion]
|
||||
pub async fn execute(&self, exec_state: &mut ExecState, ctx: &ExecutorContext) -> Result<KclValue, KclError> {
|
||||
let mut object = serde_json::Map::new();
|
||||
@ -603,9 +603,9 @@ impl UnboxedNode<ObjectExpression> {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn parse_json_number_as_u64(j: &serde_json::Value, source_range: SourceRange) -> Result<u64, KclError> {
|
||||
fn parse_json_number_as_i64(j: &serde_json::Value, source_range: SourceRange) -> Result<i64, KclError> {
|
||||
if let serde_json::Value::Number(n) = &j {
|
||||
n.as_u64().ok_or_else(|| {
|
||||
n.as_i64().ok_or_else(|| {
|
||||
KclError::Syntax(KclErrorDetails {
|
||||
source_ranges: vec![source_range],
|
||||
message: format!("Invalid integer: {}", j),
|
||||
@ -655,7 +655,7 @@ pub fn json_as_bool(j: &serde_json::Value) -> Option<bool> {
|
||||
}
|
||||
}
|
||||
|
||||
impl UnboxedNode<IfExpression> {
|
||||
impl IfExpression {
|
||||
#[async_recursion]
|
||||
pub async fn get_result(&self, exec_state: &mut ExecState, ctx: &ExecutorContext) -> Result<KclValue, KclError> {
|
||||
// Check the `if` branch.
|
||||
@ -717,7 +717,7 @@ impl Property {
|
||||
let property_src: SourceRange = value.clone().into();
|
||||
match value {
|
||||
LiteralIdentifier::Identifier(identifier) => {
|
||||
let name = &identifier.name;
|
||||
let name = identifier.name;
|
||||
if !computed {
|
||||
// Treat the property as a literal
|
||||
Ok(Property::String(name.to_string()))
|
||||
|
@ -5,8 +5,6 @@ use serde_json::Value as JValue;
|
||||
|
||||
use crate::ast::types::{Expr, Literal};
|
||||
|
||||
use super::UnboxedNode;
|
||||
|
||||
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, ts_rs::TS, JsonSchema, Bake)]
|
||||
#[databake(path = kcl_lib::ast::types)]
|
||||
#[ts(export)]
|
||||
@ -35,9 +33,9 @@ impl LiteralValue {
|
||||
}
|
||||
}
|
||||
|
||||
impl From<UnboxedNode<Literal>> for Expr {
|
||||
fn from(literal: UnboxedNode<Literal>) -> Self {
|
||||
Expr::Literal(literal)
|
||||
impl From<Literal> for Expr {
|
||||
fn from(literal: Literal) -> Self {
|
||||
Expr::Literal(Box::new(literal))
|
||||
}
|
||||
}
|
||||
|
||||
|
57
src/wasm-lib/kcl/src/engine/engine_utils.rs
Normal file
57
src/wasm-lib/kcl/src/engine/engine_utils.rs
Normal file
@ -0,0 +1,57 @@
|
||||
//! Functions for calling into the engine-utils library (a set of C++ utilities containing various logic for client-side CAD processing)
|
||||
//! Note that this binary may not be available to all builds of kcl, so fallbacks that call the engine API should be implemented
|
||||
|
||||
use crate::{
|
||||
errors::{KclError, KclErrorDetails},
|
||||
std::Args,
|
||||
};
|
||||
use anyhow::Result;
|
||||
use std::ffi::{CString, CStr};
|
||||
use kittycad_modeling_cmds::{length_unit::LengthUnit, shared::Point3d};
|
||||
|
||||
mod cpp {
|
||||
use std::os::raw::c_char;
|
||||
|
||||
extern "C" {
|
||||
pub fn kcEngineUtilsEvaluatePath(sketch: *const c_char, t: f64) -> *const c_char;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
pub fn is_available() -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
pub async fn get_true_path_end_pos(sketch: String, args: &Args) -> Result<Point3d<LengthUnit>, KclError> {
|
||||
let c_string = CString::new(sketch).map_err(|e| {
|
||||
KclError::Internal(KclErrorDetails {
|
||||
message: format!("{:?}", e),
|
||||
source_ranges: vec![args.source_range],
|
||||
})
|
||||
})?;
|
||||
let arg = c_string.into_raw();
|
||||
let result_string: String;
|
||||
|
||||
unsafe {
|
||||
let result = cpp::kcEngineUtilsEvaluatePath(arg, 1.0);
|
||||
let result_cstr = CStr::from_ptr(result);
|
||||
let str_slice: &str = result_cstr.to_str().map_err(|e| {
|
||||
KclError::Internal(KclErrorDetails {
|
||||
message: format!("{:?}", e),
|
||||
source_ranges: vec![args.source_range],
|
||||
})
|
||||
})?;
|
||||
let str_buf: String = str_slice.to_owned();
|
||||
result_string = str_buf.clone();
|
||||
let _ = CString::from_raw(arg);
|
||||
}
|
||||
|
||||
let point: Point3d<f64> = serde_json::from_str(&result_string).map_err(|e| {
|
||||
KclError::Type(KclErrorDetails {
|
||||
message: format!("Failed to path position from json: {}", e),
|
||||
source_ranges: vec![args.source_range],
|
||||
})
|
||||
})?;
|
||||
|
||||
Ok(Point3d::<f64>::from(point).map(LengthUnit))
|
||||
}
|
35
src/wasm-lib/kcl/src/engine/engine_utils_api.rs
Normal file
35
src/wasm-lib/kcl/src/engine/engine_utils_api.rs
Normal file
@ -0,0 +1,35 @@
|
||||
//! Functions for calling into the engine-utils library (a set of C++ utilities containing various logic for client-side CAD processing)
|
||||
//! Note that this binary may not be available to all builds of kcl, so fallbacks that call the engine API should be implemented
|
||||
|
||||
use crate::{
|
||||
errors::{KclError, KclErrorDetails},
|
||||
std::Args,
|
||||
};
|
||||
use crate::engine::kcmc::{each_cmd as mcmd, ModelingCmd};
|
||||
use anyhow::Result;
|
||||
use kittycad_modeling_cmds::{length_unit::LengthUnit, ok_response::OkModelingCmdResponse, shared::Point3d, websocket::OkWebSocketResponseData};
|
||||
|
||||
pub fn is_available() -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
pub async fn get_true_path_end_pos(sketch: String, args: &Args) -> Result<Point3d<LengthUnit>, KclError> {
|
||||
let id = uuid::Uuid::new_v4();
|
||||
|
||||
let resp = args.send_modeling_cmd(id, ModelingCmd::from(mcmd::EngineUtilEvaluatePath {
|
||||
path_json: sketch,
|
||||
t: 1.0,
|
||||
})).await?;
|
||||
|
||||
let OkWebSocketResponseData::Modeling {
|
||||
modeling_response: OkModelingCmdResponse::EngineUtilEvaluatePath(point),
|
||||
} = &resp
|
||||
else {
|
||||
return Err(KclError::Engine(KclErrorDetails {
|
||||
message: format!("mcmd::EngineUtilEvaluatePath response was not as expected: {:?}", resp),
|
||||
source_ranges: vec![args.source_range],
|
||||
}));
|
||||
};
|
||||
|
||||
Ok(point.pos)
|
||||
}
|
56
src/wasm-lib/kcl/src/engine/engine_utils_wasm.rs
Normal file
56
src/wasm-lib/kcl/src/engine/engine_utils_wasm.rs
Normal file
@ -0,0 +1,56 @@
|
||||
//! Functions for calling into the engine-utils library (a set of C++ utilities containing various logic for client-side CAD processing)
|
||||
//! Note that this binary may not be available to all builds of kcl, so fallbacks that call the engine API should be implemented
|
||||
|
||||
use crate::{
|
||||
errors::{KclError, KclErrorDetails},
|
||||
std::Args,
|
||||
};
|
||||
use anyhow::Result;
|
||||
use kittycad_modeling_cmds::{length_unit::LengthUnit, shared::Point3d};
|
||||
mod cpp {
|
||||
use wasm_bindgen::prelude::wasm_bindgen;
|
||||
|
||||
#[wasm_bindgen(module = "/../../lib/engineUtils.ts")]
|
||||
extern "C" {
|
||||
#[wasm_bindgen(js_name = getTruePathEndPos, catch)]
|
||||
pub fn get_true_path_end_pos(sketch: String) -> Result<js_sys::Promise, js_sys::Error>;
|
||||
}
|
||||
}
|
||||
|
||||
pub fn is_available() -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
async fn call_cpp<F>(args: &Args, f: F) -> Result<String, KclError>
|
||||
where
|
||||
F: FnOnce() -> Result<js_sys::Promise, js_sys::Error>,
|
||||
{
|
||||
let promise = f().map_err(|e| {
|
||||
KclError::Internal(KclErrorDetails {
|
||||
message: format!("{:?}", e),
|
||||
source_ranges: vec![args.source_range],
|
||||
})
|
||||
})?;
|
||||
|
||||
let result = crate::wasm::JsFuture::from(promise).await.map_err(|e| {
|
||||
KclError::Internal(KclErrorDetails {
|
||||
message: format!("{:?}", e),
|
||||
source_ranges: vec![args.source_range],
|
||||
})
|
||||
})?;
|
||||
|
||||
Ok(result.as_string().unwrap_or_default())
|
||||
}
|
||||
|
||||
pub async fn get_true_path_end_pos(sketch: String, args: &Args) -> Result<Point3d<LengthUnit>, KclError> {
|
||||
let result_str = call_cpp(args, || cpp::get_true_path_end_pos(sketch.into())).await?;
|
||||
|
||||
let point: Point3d<f64> = serde_json::from_str(&result_str).map_err(|e| {
|
||||
KclError::Type(KclErrorDetails {
|
||||
message: format!("Failed to path position from json: {}", e),
|
||||
source_ranges: vec![args.source_range],
|
||||
})
|
||||
})?;
|
||||
|
||||
Ok(Point3d::<f64>::from(point).map(LengthUnit))
|
||||
}
|
@ -8,6 +8,17 @@ pub mod conn_mock;
|
||||
#[cfg(feature = "engine")]
|
||||
pub mod conn_wasm;
|
||||
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
#[cfg(feature = "native-engine-utils")]
|
||||
pub mod engine_utils;
|
||||
#[cfg(target_arch = "wasm32")]
|
||||
#[cfg(feature = "wasm-engine-utils")]
|
||||
pub mod engine_utils_wasm;
|
||||
|
||||
#[cfg(feature = "engine")]
|
||||
#[cfg(any(not(target_arch = "wasm32"), all(not(feature = "native-engine-utils"), not(feature = "wasm-engine-utils"))))]
|
||||
pub mod engine_utils_api;
|
||||
|
||||
use std::{
|
||||
collections::HashMap,
|
||||
sync::{Arc, Mutex},
|
||||
|
@ -26,8 +26,8 @@ type Point3D = kcmc::shared::Point3d<f64>;
|
||||
|
||||
use crate::{
|
||||
ast::types::{
|
||||
human_friendly_type, BodyItem, Expr, FunctionExpression, ItemVisibility, KclNone, NodeRef, Program,
|
||||
TagDeclarator, TagNode, UnboxedNode,
|
||||
human_friendly_type, BodyItem, Expr, ExpressionStatement, FunctionExpression, ImportStatement, ItemVisibility,
|
||||
KclNone, Program, ReturnStatement, TagDeclarator,
|
||||
},
|
||||
engine::{EngineManager, ExecutionKind},
|
||||
errors::{KclError, KclErrorDetails},
|
||||
@ -339,7 +339,7 @@ impl IdGenerator {
|
||||
pub enum KclValue {
|
||||
UserVal(UserVal),
|
||||
TagIdentifier(Box<TagIdentifier>),
|
||||
TagDeclarator(crate::ast::types::Node<TagDeclarator>),
|
||||
TagDeclarator(Box<TagDeclarator>),
|
||||
Plane(Box<Plane>),
|
||||
Face(Box<Face>),
|
||||
|
||||
@ -352,7 +352,7 @@ pub enum KclValue {
|
||||
Function {
|
||||
#[serde(skip)]
|
||||
func: Option<MemoryFunction>,
|
||||
expression: crate::ast::types::Node<FunctionExpression>,
|
||||
expression: Box<FunctionExpression>,
|
||||
memory: Box<ProgramMemory>,
|
||||
#[serde(rename = "__meta")]
|
||||
meta: Vec<Metadata>,
|
||||
@ -890,7 +890,7 @@ pub type MemoryFunction =
|
||||
fn(
|
||||
s: Vec<KclValue>,
|
||||
memory: ProgramMemory,
|
||||
expression: crate::ast::types::Node<FunctionExpression>,
|
||||
expression: Box<FunctionExpression>,
|
||||
metadata: Vec<Metadata>,
|
||||
exec_state: &ExecState,
|
||||
ctx: ExecutorContext,
|
||||
@ -900,7 +900,7 @@ impl From<KclValue> for Vec<SourceRange> {
|
||||
fn from(item: KclValue) -> Self {
|
||||
match item {
|
||||
KclValue::UserVal(u) => u.meta.iter().map(|m| m.source_range).collect(),
|
||||
KclValue::TagDeclarator(t) => vec![(&t).into()],
|
||||
KclValue::TagDeclarator(t) => t.into(),
|
||||
KclValue::TagIdentifier(t) => t.meta.iter().map(|m| m.source_range).collect(),
|
||||
KclValue::Solid(e) => e.meta.iter().map(|m| m.source_range).collect(),
|
||||
KclValue::Solids { value } => value
|
||||
@ -1043,9 +1043,9 @@ impl KclValue {
|
||||
}
|
||||
|
||||
/// Get a tag declarator from a memory item.
|
||||
pub fn get_tag_declarator(&self) -> Result<TagNode, KclError> {
|
||||
pub fn get_tag_declarator(&self) -> Result<TagDeclarator, KclError> {
|
||||
match self {
|
||||
KclValue::TagDeclarator(t) => Ok((**t).clone()),
|
||||
KclValue::TagDeclarator(t) => Ok(*t.clone()),
|
||||
_ => Err(KclError::Semantic(KclErrorDetails {
|
||||
message: format!("Not a tag declarator: {:?}", self),
|
||||
source_ranges: self.clone().into(),
|
||||
@ -1054,9 +1054,9 @@ impl KclValue {
|
||||
}
|
||||
|
||||
/// Get an optional tag from a memory item.
|
||||
pub fn get_tag_declarator_opt(&self) -> Result<Option<TagNode>, KclError> {
|
||||
pub fn get_tag_declarator_opt(&self) -> Result<Option<TagDeclarator>, KclError> {
|
||||
match self {
|
||||
KclValue::TagDeclarator(t) => Ok(Some((**t).clone())),
|
||||
KclValue::TagDeclarator(t) => Ok(Some(*t.clone())),
|
||||
_ => Err(KclError::Semantic(KclErrorDetails {
|
||||
message: format!("Not a tag declarator: {:?}", self),
|
||||
source_ranges: self.clone().into(),
|
||||
@ -1200,7 +1200,7 @@ pub struct GetTangentialInfoFromPathsResult {
|
||||
}
|
||||
|
||||
impl Sketch {
|
||||
pub(crate) fn add_tag(&mut self, tag: NodeRef<'_, TagDeclarator>, current_path: &Path) {
|
||||
pub(crate) fn add_tag(&mut self, tag: &TagDeclarator, current_path: &Path) {
|
||||
let mut tag_identifier: TagIdentifier = tag.into();
|
||||
let base = current_path.get_base();
|
||||
tag_identifier.info = Some(TagEngineInfo {
|
||||
@ -1326,7 +1326,7 @@ pub enum EdgeCut {
|
||||
/// The engine id of the edge to fillet.
|
||||
#[serde(rename = "edgeId")]
|
||||
edge_id: uuid::Uuid,
|
||||
tag: Box<Option<TagNode>>,
|
||||
tag: Box<Option<TagDeclarator>>,
|
||||
},
|
||||
/// A chamfer.
|
||||
Chamfer {
|
||||
@ -1336,7 +1336,7 @@ pub enum EdgeCut {
|
||||
/// The engine id of the edge to chamfer.
|
||||
#[serde(rename = "edgeId")]
|
||||
edge_id: uuid::Uuid,
|
||||
tag: Box<Option<TagNode>>,
|
||||
tag: Box<Option<TagDeclarator>>,
|
||||
},
|
||||
}
|
||||
|
||||
@ -1355,7 +1355,7 @@ impl EdgeCut {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn tag(&self) -> Option<TagNode> {
|
||||
pub fn tag(&self) -> Option<TagDeclarator> {
|
||||
match self {
|
||||
EdgeCut::Fillet { tag, .. } => *tag.clone(),
|
||||
EdgeCut::Chamfer { tag, .. } => *tag.clone(),
|
||||
@ -1529,10 +1529,26 @@ impl From<SourceRange> for Metadata {
|
||||
}
|
||||
}
|
||||
|
||||
impl<T> From<NodeRef<'_, T>> for Metadata {
|
||||
fn from(node: NodeRef<'_, T>) -> Self {
|
||||
impl From<&ImportStatement> for Metadata {
|
||||
fn from(stmt: &ImportStatement) -> Self {
|
||||
Self {
|
||||
source_range: SourceRange::new(node.start, node.end),
|
||||
source_range: SourceRange::new(stmt.start, stmt.end),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<&ExpressionStatement> for Metadata {
|
||||
fn from(exp_statement: &ExpressionStatement) -> Self {
|
||||
Self {
|
||||
source_range: SourceRange::new(exp_statement.start, exp_statement.end),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<&ReturnStatement> for Metadata {
|
||||
fn from(return_statement: &ReturnStatement) -> Self {
|
||||
Self {
|
||||
source_range: SourceRange::new(return_statement.start, return_statement.end),
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1557,7 +1573,7 @@ pub struct BasePath {
|
||||
#[ts(type = "[number, number]")]
|
||||
pub to: [f64; 2],
|
||||
/// The tag of the path.
|
||||
pub tag: Option<TagNode>,
|
||||
pub tag: Option<TagDeclarator>,
|
||||
/// Metadata.
|
||||
#[serde(rename = "__geoMeta")]
|
||||
pub geo_meta: GeoMeta,
|
||||
@ -1585,6 +1601,19 @@ pub enum Path {
|
||||
#[serde(flatten)]
|
||||
base: BasePath,
|
||||
},
|
||||
/// An arc (only used for engine-utils arg serialization for now)
|
||||
Arc {
|
||||
#[serde(flatten)]
|
||||
base: BasePath,
|
||||
/// angle range
|
||||
#[ts(type = "[number, number]")]
|
||||
angle_range: [f64; 2],
|
||||
/// center
|
||||
#[ts(type = "[number, number]")]
|
||||
center: [f64; 2],
|
||||
/// the arc's radius
|
||||
radius: f64,
|
||||
},
|
||||
/// A arc that is tangential to the last path segment that goes to a point
|
||||
TangentialArcTo {
|
||||
#[serde(flatten)]
|
||||
@ -1604,6 +1633,10 @@ pub enum Path {
|
||||
center: [f64; 2],
|
||||
/// arc's direction
|
||||
ccw: bool,
|
||||
/// the arc's radius
|
||||
radius: f64,
|
||||
/// the arc's angle offset
|
||||
offset: f64,
|
||||
},
|
||||
// TODO: consolidate segment enums, remove Circle. https://github.com/KittyCAD/modeling-app/issues/3940
|
||||
/// a complete arc
|
||||
@ -1652,10 +1685,11 @@ impl Path {
|
||||
Path::TangentialArcTo { base, .. } => base.geo_meta.id,
|
||||
Path::TangentialArc { base, .. } => base.geo_meta.id,
|
||||
Path::Circle { base, .. } => base.geo_meta.id,
|
||||
Path::Arc { base, .. } => base.geo_meta.id,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn get_tag(&self) -> Option<TagNode> {
|
||||
pub fn get_tag(&self) -> Option<TagDeclarator> {
|
||||
match self {
|
||||
Path::ToPoint { base } => base.tag.clone(),
|
||||
Path::Horizontal { base, .. } => base.tag.clone(),
|
||||
@ -1664,6 +1698,7 @@ impl Path {
|
||||
Path::TangentialArcTo { base, .. } => base.tag.clone(),
|
||||
Path::TangentialArc { base, .. } => base.tag.clone(),
|
||||
Path::Circle { base, .. } => base.tag.clone(),
|
||||
Path::Arc { base, .. } => base.tag.clone(),
|
||||
}
|
||||
}
|
||||
|
||||
@ -1676,6 +1711,7 @@ impl Path {
|
||||
Path::TangentialArcTo { base, .. } => base,
|
||||
Path::TangentialArc { base, .. } => base,
|
||||
Path::Circle { base, .. } => base,
|
||||
Path::Arc { base, .. } => base,
|
||||
}
|
||||
}
|
||||
|
||||
@ -1688,6 +1724,7 @@ impl Path {
|
||||
Path::TangentialArcTo { base, .. } => Some(base),
|
||||
Path::TangentialArc { base, .. } => Some(base),
|
||||
Path::Circle { base, .. } => Some(base),
|
||||
Path::Arc { base, .. } => Some(base),
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1712,7 +1749,7 @@ pub struct ChamferSurface {
|
||||
/// The id for the chamfer surface.
|
||||
pub face_id: uuid::Uuid,
|
||||
/// The tag.
|
||||
pub tag: Option<UnboxedNode<TagDeclarator>>,
|
||||
pub tag: Option<TagDeclarator>,
|
||||
/// Metadata.
|
||||
#[serde(flatten)]
|
||||
pub geo_meta: GeoMeta,
|
||||
@ -1726,7 +1763,7 @@ pub struct FilletSurface {
|
||||
/// The id for the fillet surface.
|
||||
pub face_id: uuid::Uuid,
|
||||
/// The tag.
|
||||
pub tag: Option<UnboxedNode<TagDeclarator>>,
|
||||
pub tag: Option<TagDeclarator>,
|
||||
/// Metadata.
|
||||
#[serde(flatten)]
|
||||
pub geo_meta: GeoMeta,
|
||||
@ -1740,7 +1777,7 @@ pub struct ExtrudePlane {
|
||||
/// The face id for the extrude plane.
|
||||
pub face_id: uuid::Uuid,
|
||||
/// The tag.
|
||||
pub tag: Option<UnboxedNode<TagDeclarator>>,
|
||||
pub tag: Option<TagDeclarator>,
|
||||
/// Metadata.
|
||||
#[serde(flatten)]
|
||||
pub geo_meta: GeoMeta,
|
||||
@ -1754,7 +1791,7 @@ pub struct ExtrudeArc {
|
||||
/// The face id for the extrude plane.
|
||||
pub face_id: uuid::Uuid,
|
||||
/// The tag.
|
||||
pub tag: Option<UnboxedNode<TagDeclarator>>,
|
||||
pub tag: Option<TagDeclarator>,
|
||||
/// Metadata.
|
||||
#[serde(flatten)]
|
||||
pub geo_meta: GeoMeta,
|
||||
@ -1770,7 +1807,7 @@ impl ExtrudeSurface {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn get_tag(&self) -> Option<UnboxedNode<TagDeclarator>> {
|
||||
pub fn get_tag(&self) -> Option<TagDeclarator> {
|
||||
match self {
|
||||
ExtrudeSurface::ExtrudePlane(ep) => ep.tag.clone(),
|
||||
ExtrudeSurface::ExtrudeArc(ea) => ea.tag.clone(),
|
||||
@ -1981,7 +2018,7 @@ impl ExecutorContext {
|
||||
/// Kurt uses this for partial execution.
|
||||
pub async fn run(
|
||||
&self,
|
||||
program: NodeRef<'_, crate::ast::types::Program>,
|
||||
program: &crate::ast::types::Program,
|
||||
memory: Option<ProgramMemory>,
|
||||
id_generator: IdGenerator,
|
||||
project_directory: Option<String>,
|
||||
@ -1995,7 +2032,7 @@ impl ExecutorContext {
|
||||
/// Kurt uses this for partial execution.
|
||||
pub async fn run_with_session_data(
|
||||
&self,
|
||||
program: NodeRef<'_, crate::ast::types::Program>,
|
||||
program: &crate::ast::types::Program,
|
||||
memory: Option<ProgramMemory>,
|
||||
id_generator: IdGenerator,
|
||||
project_directory: Option<String>,
|
||||
@ -2037,9 +2074,9 @@ impl ExecutorContext {
|
||||
|
||||
/// Execute an AST's program.
|
||||
#[async_recursion]
|
||||
pub(crate) async fn inner_execute<'a>(
|
||||
&'a self,
|
||||
program: NodeRef<'a, crate::ast::types::Program>,
|
||||
pub(crate) async fn inner_execute(
|
||||
&self,
|
||||
program: &crate::ast::types::Program,
|
||||
exec_state: &mut ExecState,
|
||||
body_type: BodyType,
|
||||
) -> Result<Option<KclValue>, KclError> {
|
||||
@ -2275,7 +2312,7 @@ impl ExecutorContext {
|
||||
/// Execute the program, then get a PNG screenshot.
|
||||
pub async fn execute_and_prepare_snapshot(
|
||||
&self,
|
||||
program: NodeRef<'_, Program>,
|
||||
program: &Program,
|
||||
id_generator: IdGenerator,
|
||||
project_directory: Option<String>,
|
||||
) -> Result<TakeSnapshot> {
|
||||
@ -2320,7 +2357,7 @@ impl ExecutorContext {
|
||||
/// assign it to a parameter of the function, in the given block of function memory.
|
||||
/// Returns Err if too few/too many arguments were given for the function.
|
||||
fn assign_args_to_params(
|
||||
function_expression: NodeRef<'_, FunctionExpression>,
|
||||
function_expression: &FunctionExpression,
|
||||
args: Vec<KclValue>,
|
||||
mut fn_memory: ProgramMemory,
|
||||
) -> Result<ProgramMemory, KclError> {
|
||||
@ -2372,7 +2409,7 @@ fn assign_args_to_params(
|
||||
pub(crate) async fn call_user_defined_function(
|
||||
args: Vec<KclValue>,
|
||||
memory: &ProgramMemory,
|
||||
function_expression: NodeRef<'_, FunctionExpression>,
|
||||
function_expression: &FunctionExpression,
|
||||
exec_state: &mut ExecState,
|
||||
ctx: &ExecutorContext,
|
||||
) -> Result<Option<KclValue>, KclError> {
|
||||
@ -2411,7 +2448,7 @@ mod tests {
|
||||
use pretty_assertions::assert_eq;
|
||||
|
||||
use super::*;
|
||||
use crate::ast::types::{Identifier, Parameter, UnboxedNode};
|
||||
use crate::ast::types::{Identifier, Parameter};
|
||||
|
||||
pub async fn parse_execute(code: &str) -> Result<ProgramMemory> {
|
||||
let tokens = crate::token::lexer(code)?;
|
||||
@ -3383,11 +3420,13 @@ let w = f() + f()
|
||||
meta: Default::default(),
|
||||
})
|
||||
}
|
||||
fn ident(s: &'static str) -> UnboxedNode<Identifier> {
|
||||
UnboxedNode::no_src(Identifier {
|
||||
fn ident(s: &'static str) -> Identifier {
|
||||
Identifier {
|
||||
start: 0,
|
||||
end: 0,
|
||||
name: s.to_owned(),
|
||||
digest: None,
|
||||
})
|
||||
}
|
||||
}
|
||||
fn opt_param(s: &'static str) -> Parameter {
|
||||
Parameter {
|
||||
@ -3479,20 +3518,20 @@ let w = f() + f()
|
||||
),
|
||||
] {
|
||||
// Run each test.
|
||||
let func_expr = &UnboxedNode::no_src(FunctionExpression {
|
||||
let func_expr = &FunctionExpression {
|
||||
start: 0,
|
||||
end: 0,
|
||||
params,
|
||||
body: UnboxedNode {
|
||||
inner: crate::ast::types::Program {
|
||||
body: Vec::new(),
|
||||
non_code_meta: Default::default(),
|
||||
digest: None,
|
||||
},
|
||||
body: crate::ast::types::Program {
|
||||
start: 0,
|
||||
end: 0,
|
||||
body: Vec::new(),
|
||||
non_code_meta: Default::default(),
|
||||
digest: None,
|
||||
},
|
||||
return_type: None,
|
||||
digest: None,
|
||||
});
|
||||
};
|
||||
let actual = assign_args_to_params(func_expr, args, ProgramMemory::new());
|
||||
assert_eq!(
|
||||
actual, expected,
|
||||
|
@ -13,7 +13,7 @@ use crate::{
|
||||
pub struct FunctionParam<'a> {
|
||||
pub inner: Option<&'a MemoryFunction>,
|
||||
pub memory: ProgramMemory,
|
||||
pub fn_expr: crate::ast::types::Node<FunctionExpression>,
|
||||
pub fn_expr: Box<FunctionExpression>,
|
||||
pub meta: Vec<Metadata>,
|
||||
pub ctx: ExecutorContext,
|
||||
}
|
||||
|
@ -3,7 +3,7 @@ use std::sync::Arc;
|
||||
use anyhow::Result;
|
||||
|
||||
use crate::{
|
||||
ast::types::{CallExpression, NodeRef},
|
||||
ast::types::CallExpression,
|
||||
docs::StdLibFn,
|
||||
executor::SourceRange,
|
||||
lint::rule::{def_finding, Discovered, Finding},
|
||||
@ -18,10 +18,7 @@ def_finding!(
|
||||
Previously, we have not been failing when too many arguments are passed to a stdlib function. This is a problem because it can lead to unexpected behavior. We will in the future fail when too many arguments are passed to a function. So fix your code now."
|
||||
);
|
||||
|
||||
fn lint_too_many_args_std_lib_function(
|
||||
f: Box<dyn StdLibFn>,
|
||||
exp: NodeRef<'_, CallExpression>,
|
||||
) -> Result<Vec<Discovered>> {
|
||||
fn lint_too_many_args_std_lib_function(f: Box<dyn StdLibFn>, exp: &CallExpression) -> Result<Vec<Discovered>> {
|
||||
let mut findings = vec![];
|
||||
|
||||
if f.name() == "pow" {
|
||||
|
@ -3,14 +3,14 @@
|
||||
use serde::{Deserialize, Serialize};
|
||||
use tower_lsp::lsp_types::notification::Notification;
|
||||
|
||||
use crate::{ast::types::UnboxedNode, settings::types::UnitLength};
|
||||
use crate::settings::types::UnitLength;
|
||||
|
||||
/// A notification that the AST has changed.
|
||||
#[derive(Debug)]
|
||||
pub enum AstUpdated {}
|
||||
|
||||
impl Notification for AstUpdated {
|
||||
type Params = UnboxedNode<crate::ast::types::Program>;
|
||||
type Params = crate::ast::types::Program;
|
||||
const METHOD: &'static str = "kcl/astUpdated";
|
||||
}
|
||||
|
||||
|
@ -40,7 +40,7 @@ use tower_lsp::{
|
||||
};
|
||||
|
||||
use crate::{
|
||||
ast::types::{Expr, NodeRef, UnboxedNode, VariableKind},
|
||||
ast::types::{Expr, VariableKind},
|
||||
executor::{IdGenerator, SourceRange},
|
||||
lsp::{backend::Backend as _, util::IntoDiagnostic},
|
||||
parser::PIPE_OPERATOR,
|
||||
@ -99,7 +99,7 @@ pub struct Backend {
|
||||
/// Token maps.
|
||||
pub token_map: DashMap<String, Vec<crate::token::Token>>,
|
||||
/// AST maps.
|
||||
pub ast_map: DashMap<String, UnboxedNode<crate::ast::types::Program>>,
|
||||
pub ast_map: DashMap<String, crate::ast::types::Program>,
|
||||
/// Memory maps.
|
||||
pub memory_map: DashMap<String, crate::executor::ProgramMemory>,
|
||||
/// Current code.
|
||||
@ -571,7 +571,7 @@ impl Backend {
|
||||
self.client.publish_diagnostics(params.uri.clone(), items, None).await;
|
||||
}
|
||||
|
||||
async fn execute(&self, params: &TextDocumentItem, ast: NodeRef<'_, crate::ast::types::Program>) -> Result<()> {
|
||||
async fn execute(&self, params: &TextDocumentItem, ast: &crate::ast::types::Program) -> Result<()> {
|
||||
// Check if we can execute.
|
||||
if !self.can_execute().await {
|
||||
return Ok(());
|
||||
|
@ -7,7 +7,6 @@ use tower_lsp::{
|
||||
};
|
||||
|
||||
use crate::{
|
||||
ast::types::{Program, UnboxedNode},
|
||||
executor::ProgramMemory,
|
||||
lsp::test_util::{copilot_lsp_server, kcl_lsp_server},
|
||||
};
|
||||
@ -1071,7 +1070,7 @@ fn myFn = (param1) => {
|
||||
|
||||
// Get the ast.
|
||||
let ast = server.ast_map.get("file:///test.kcl").unwrap().clone();
|
||||
assert!(ast != UnboxedNode::<Program>::default());
|
||||
assert!(ast != crate::ast::types::Program::default());
|
||||
|
||||
// Send semantic tokens request.
|
||||
let semantic_tokens = server
|
||||
@ -2397,7 +2396,7 @@ async fn kcl_test_kcl_lsp_full_to_empty_file_updates_ast_and_memory() {
|
||||
|
||||
// Get the ast.
|
||||
let ast = server.ast_map.get("file:///test.kcl").unwrap().clone();
|
||||
assert!(ast != UnboxedNode::<Program>::default());
|
||||
assert!(ast != crate::ast::types::Program::default());
|
||||
// Get the memory.
|
||||
let memory = server.memory_map.get("file:///test.kcl").unwrap().clone();
|
||||
assert!(memory != ProgramMemory::default());
|
||||
@ -2417,7 +2416,7 @@ async fn kcl_test_kcl_lsp_full_to_empty_file_updates_ast_and_memory() {
|
||||
})
|
||||
.await;
|
||||
|
||||
let mut default_hashed = UnboxedNode::<Program>::default();
|
||||
let mut default_hashed = crate::ast::types::Program::default();
|
||||
default_hashed.compute_digest();
|
||||
|
||||
// Get the ast.
|
||||
@ -2454,7 +2453,7 @@ async fn kcl_test_kcl_lsp_code_unchanged_but_has_diagnostics_reexecute() {
|
||||
|
||||
// Get the ast.
|
||||
let ast = server.ast_map.get("file:///test.kcl").unwrap().clone();
|
||||
assert!(ast != UnboxedNode::<Program>::default());
|
||||
assert!(ast != crate::ast::types::Program::default());
|
||||
// Get the memory.
|
||||
let memory = server.memory_map.get("file:///test.kcl").unwrap().clone();
|
||||
assert!(memory != ProgramMemory::default());
|
||||
@ -2488,9 +2487,9 @@ async fn kcl_test_kcl_lsp_code_unchanged_but_has_diagnostics_reexecute() {
|
||||
// Clear the ast and memory.
|
||||
server
|
||||
.ast_map
|
||||
.insert("file:///test.kcl".to_string(), UnboxedNode::<Program>::default());
|
||||
.insert("file:///test.kcl".to_string(), crate::ast::types::Program::default());
|
||||
let ast = server.ast_map.get("file:///test.kcl").unwrap().clone();
|
||||
assert_eq!(ast, UnboxedNode::<Program>::default());
|
||||
assert_eq!(ast, crate::ast::types::Program::default());
|
||||
server
|
||||
.memory_map
|
||||
.insert("file:///test.kcl".to_string(), ProgramMemory::default());
|
||||
@ -2514,7 +2513,7 @@ async fn kcl_test_kcl_lsp_code_unchanged_but_has_diagnostics_reexecute() {
|
||||
|
||||
// Get the ast.
|
||||
let ast = server.ast_map.get("file:///test.kcl").unwrap().clone();
|
||||
assert!(ast != UnboxedNode::<Program>::default());
|
||||
assert!(ast != crate::ast::types::Program::default());
|
||||
// Get the memory.
|
||||
let memory = server.memory_map.get("file:///test.kcl").unwrap().clone();
|
||||
assert!(memory != ProgramMemory::default());
|
||||
@ -2550,7 +2549,7 @@ async fn kcl_test_kcl_lsp_code_and_ast_unchanged_but_has_diagnostics_reexecute()
|
||||
|
||||
// Get the ast.
|
||||
let ast = server.ast_map.get("file:///test.kcl").unwrap().clone();
|
||||
assert!(ast != UnboxedNode::<Program>::default());
|
||||
assert!(ast != crate::ast::types::Program::default());
|
||||
// Get the memory.
|
||||
let memory = server.memory_map.get("file:///test.kcl").unwrap().clone();
|
||||
assert!(memory != ProgramMemory::default());
|
||||
@ -2605,7 +2604,7 @@ async fn kcl_test_kcl_lsp_code_and_ast_unchanged_but_has_diagnostics_reexecute()
|
||||
|
||||
// Get the ast.
|
||||
let ast = server.ast_map.get("file:///test.kcl").unwrap().clone();
|
||||
assert!(ast != UnboxedNode::<Program>::default());
|
||||
assert!(ast != crate::ast::types::Program::default());
|
||||
// Get the memory.
|
||||
let memory = server.memory_map.get("file:///test.kcl").unwrap().clone();
|
||||
assert!(memory != ProgramMemory::default());
|
||||
@ -2641,7 +2640,7 @@ async fn kcl_test_kcl_lsp_code_and_ast_units_unchanged_but_has_diagnostics_reexe
|
||||
|
||||
// Get the ast.
|
||||
let ast = server.ast_map.get("file:///test.kcl").unwrap().clone();
|
||||
assert!(ast != UnboxedNode::<Program>::default());
|
||||
assert!(ast != crate::ast::types::Program::default());
|
||||
// Get the memory.
|
||||
let memory = server.memory_map.get("file:///test.kcl").unwrap().clone();
|
||||
assert!(memory != ProgramMemory::default());
|
||||
@ -2699,7 +2698,7 @@ async fn kcl_test_kcl_lsp_code_and_ast_units_unchanged_but_has_diagnostics_reexe
|
||||
|
||||
// Get the ast.
|
||||
let ast = server.ast_map.get("file:///test.kcl").unwrap().clone();
|
||||
assert!(ast != UnboxedNode::<Program>::default());
|
||||
assert!(ast != crate::ast::types::Program::default());
|
||||
// Get the memory.
|
||||
let memory = server.memory_map.get("file:///test.kcl").unwrap().clone();
|
||||
assert!(memory != ProgramMemory::default());
|
||||
@ -2735,7 +2734,7 @@ async fn kcl_test_kcl_lsp_code_and_ast_units_unchanged_but_has_memory_reexecute_
|
||||
|
||||
// Get the ast.
|
||||
let ast = server.ast_map.get("file:///test.kcl").unwrap().clone();
|
||||
assert!(ast != UnboxedNode::<Program>::default());
|
||||
assert!(ast != crate::ast::types::Program::default());
|
||||
// Get the memory.
|
||||
let memory = server.memory_map.get("file:///test.kcl").unwrap().clone();
|
||||
assert!(memory != ProgramMemory::default());
|
||||
@ -2771,7 +2770,7 @@ async fn kcl_test_kcl_lsp_code_and_ast_units_unchanged_but_has_memory_reexecute_
|
||||
|
||||
// Get the ast.
|
||||
let ast = server.ast_map.get("file:///test.kcl").unwrap().clone();
|
||||
assert!(ast != UnboxedNode::<Program>::default());
|
||||
assert!(ast != crate::ast::types::Program::default());
|
||||
// Get the memory.
|
||||
let memory = server.memory_map.get("file:///test.kcl").unwrap().clone();
|
||||
assert!(memory != ProgramMemory::default());
|
||||
@ -2807,7 +2806,7 @@ async fn kcl_test_kcl_lsp_cant_execute_set() {
|
||||
|
||||
// Get the ast.
|
||||
let ast = server.ast_map.get("file:///test.kcl").unwrap().clone();
|
||||
assert!(ast != UnboxedNode::<Program>::default());
|
||||
assert!(ast != crate::ast::types::Program::default());
|
||||
// Get the memory.
|
||||
let memory = server.memory_map.get("file:///test.kcl").unwrap().clone();
|
||||
assert!(memory != ProgramMemory::default());
|
||||
@ -2842,7 +2841,7 @@ async fn kcl_test_kcl_lsp_cant_execute_set() {
|
||||
|
||||
// Get the ast.
|
||||
let ast = server.ast_map.get("file:///test.kcl").unwrap().clone();
|
||||
assert!(ast != UnboxedNode::<Program>::default());
|
||||
assert!(ast != crate::ast::types::Program::default());
|
||||
// Get the memory.
|
||||
let memory = server.memory_map.get("file:///test.kcl").unwrap().clone();
|
||||
assert!(memory != ProgramMemory::default());
|
||||
@ -2884,7 +2883,7 @@ async fn kcl_test_kcl_lsp_cant_execute_set() {
|
||||
let units = server.executor_ctx().await.clone().unwrap().settings.units;
|
||||
assert_eq!(units, crate::settings::types::UnitLength::Mm);
|
||||
|
||||
let mut default_hashed = UnboxedNode::<Program>::default();
|
||||
let mut default_hashed = crate::ast::types::Program::default();
|
||||
default_hashed.compute_digest();
|
||||
|
||||
// Get the ast.
|
||||
@ -2925,7 +2924,7 @@ async fn kcl_test_kcl_lsp_cant_execute_set() {
|
||||
|
||||
// Get the ast.
|
||||
let ast = server.ast_map.get("file:///test.kcl").unwrap().clone();
|
||||
assert!(ast != UnboxedNode::<Program>::default());
|
||||
assert!(ast != crate::ast::types::Program::default());
|
||||
// Get the memory.
|
||||
let memory = server.memory_map.get("file:///test.kcl").unwrap().clone();
|
||||
// Now it should NOT be the default memory.
|
||||
@ -3065,7 +3064,7 @@ const part001 = startSketchOn('XY')
|
||||
|
||||
// Get the ast.
|
||||
let ast = server.ast_map.get("file:///test.kcl").unwrap().clone();
|
||||
assert!(ast != UnboxedNode::<Program>::default());
|
||||
assert!(ast != crate::ast::types::Program::default());
|
||||
|
||||
// Assure we have one diagnostics.
|
||||
let diagnostics = server.diagnostics_map.get("file:///test.kcl").unwrap().clone();
|
||||
@ -3088,7 +3087,7 @@ const part001 = startSketchOn('XY')
|
||||
|
||||
// Get the ast.
|
||||
let ast = server.ast_map.get("file:///test.kcl").unwrap().clone();
|
||||
assert!(ast != UnboxedNode::<Program>::default());
|
||||
assert!(ast != crate::ast::types::Program::default());
|
||||
|
||||
// Assure we have one diagnostics.
|
||||
let diagnostics = server.diagnostics_map.get("file:///test.kcl").unwrap().clone();
|
||||
@ -3184,7 +3183,7 @@ const part001 = startSketchOn('XY')
|
||||
|
||||
// Get the ast.
|
||||
let ast = server.ast_map.get("file:///test.kcl").unwrap().clone();
|
||||
assert!(ast != UnboxedNode::<Program>::default());
|
||||
assert!(ast != crate::ast::types::Program::default());
|
||||
// Get the memory.
|
||||
let memory = server.memory_map.get("file:///test.kcl");
|
||||
assert!(memory.is_none());
|
||||
@ -3206,7 +3205,7 @@ const part001 = startSketchOn('XY')
|
||||
|
||||
// Get the ast.
|
||||
let ast = server.ast_map.get("file:///test.kcl").unwrap().clone();
|
||||
assert!(ast != UnboxedNode::<Program>::default());
|
||||
assert!(ast != crate::ast::types::Program::default());
|
||||
// Get the memory.
|
||||
let memory = server.memory_map.get("file:///test.kcl");
|
||||
assert!(memory.is_none());
|
||||
@ -3249,7 +3248,7 @@ const part001 = startSketchOn('XY')
|
||||
|
||||
// Get the ast.
|
||||
let ast = server.ast_map.get("file:///test.kcl").unwrap().clone();
|
||||
assert!(ast != UnboxedNode::<Program>::default());
|
||||
assert!(ast != crate::ast::types::Program::default());
|
||||
// Get the memory.
|
||||
let memory = server.memory_map.get("file:///test.kcl");
|
||||
assert!(memory.is_none());
|
||||
@ -3279,7 +3278,7 @@ const NEW_LINT = 1"#
|
||||
|
||||
// Get the ast.
|
||||
let ast = server.ast_map.get("file:///test.kcl").unwrap().clone();
|
||||
assert!(ast != UnboxedNode::<Program>::default());
|
||||
assert!(ast != crate::ast::types::Program::default());
|
||||
// Get the memory.
|
||||
let memory = server.memory_map.get("file:///test.kcl");
|
||||
assert!(memory.is_none());
|
||||
@ -3395,7 +3394,7 @@ const part001 = startSketchOn('XY')
|
||||
|
||||
// Get the ast.
|
||||
let ast = server.ast_map.get("file:///test.kcl").unwrap().clone();
|
||||
assert!(ast != UnboxedNode::<Program>::default());
|
||||
assert!(ast != crate::ast::types::Program::default());
|
||||
|
||||
// Get the symbols map.
|
||||
let symbols_map = server.symbols_map.get("file:///test.kcl").unwrap().clone();
|
||||
@ -3490,7 +3489,7 @@ const part001 = startSketchOn('XY')
|
||||
|
||||
// Get the ast.
|
||||
let ast = server.ast_map.get("file:///test.kcl").unwrap().clone();
|
||||
assert!(ast != UnboxedNode::<Program>::default());
|
||||
assert!(ast != crate::ast::types::Program::default());
|
||||
|
||||
// Get the symbols map.
|
||||
let symbols_map = server.symbols_map.get("file:///test.kcl").unwrap().clone();
|
||||
@ -3533,7 +3532,7 @@ const part001 = startSketchOn('XY')
|
||||
|
||||
// Get the ast.
|
||||
let ast = server.ast_map.get("file:///test.kcl").unwrap().clone();
|
||||
assert!(ast != UnboxedNode::<Program>::default());
|
||||
assert!(ast != crate::ast::types::Program::default());
|
||||
|
||||
// Get the symbols map.
|
||||
let symbols_map = server.symbols_map.get("file:///test.kcl").unwrap().clone();
|
||||
|
@ -1,5 +1,5 @@
|
||||
use crate::{
|
||||
ast::types::{Program, UnboxedNode},
|
||||
ast::types::Program,
|
||||
errors::{KclError, KclErrorDetails},
|
||||
executor::SourceRange,
|
||||
token::{Token, TokenType},
|
||||
@ -13,7 +13,7 @@ pub const PIPE_SUBSTITUTION_OPERATOR: &str = "%";
|
||||
pub const PIPE_OPERATOR: &str = "|>";
|
||||
|
||||
/// Parse the given KCL code into an AST.
|
||||
pub fn parse(code: &str) -> Result<UnboxedNode<Program>, KclError> {
|
||||
pub fn parse(code: &str) -> Result<Program, KclError> {
|
||||
let tokens = crate::token::lexer(code)?;
|
||||
let parser = Parser::new(tokens);
|
||||
parser.ast()
|
||||
@ -33,7 +33,7 @@ impl Parser {
|
||||
}
|
||||
|
||||
/// Run the parser
|
||||
pub fn ast(&self) -> Result<UnboxedNode<Program>, KclError> {
|
||||
pub fn ast(&self) -> Result<Program, KclError> {
|
||||
if !self.unknown_tokens.is_empty() {
|
||||
let source_ranges = self.unknown_tokens.iter().map(SourceRange::from).collect();
|
||||
let token_list = self.unknown_tokens.iter().map(|t| t.value.as_str()).collect::<Vec<_>>();
|
||||
@ -48,7 +48,7 @@ impl Parser {
|
||||
// Important, to not call this before the unknown tokens check.
|
||||
if self.tokens.is_empty() {
|
||||
// Empty file should just do nothing.
|
||||
return Ok(UnboxedNode::<Program>::default());
|
||||
return Ok(Program::default());
|
||||
}
|
||||
|
||||
// Check all the tokens are whitespace or comments.
|
||||
@ -57,7 +57,7 @@ impl Parser {
|
||||
.iter()
|
||||
.all(|t| t.token_type.is_whitespace() || t.token_type.is_comment())
|
||||
{
|
||||
return Ok(UnboxedNode::<Program>::default());
|
||||
return Ok(Program::default());
|
||||
}
|
||||
|
||||
parser_impl::run_parser(&mut self.tokens.as_slice())
|
||||
|
@ -1,18 +1,18 @@
|
||||
use crate::{
|
||||
ast::types::{BinaryExpression, BinaryOperator, BinaryPart, UnboxedNode},
|
||||
ast::types::{BinaryExpression, BinaryOperator, BinaryPart},
|
||||
errors::{KclError, KclErrorDetails},
|
||||
executor::SourceRange,
|
||||
};
|
||||
|
||||
/// Parses a list of tokens (in infix order, i.e. as the user typed them)
|
||||
/// into a binary expression tree.
|
||||
pub fn parse(infix_tokens: Vec<BinaryExpressionToken>) -> Result<UnboxedNode<BinaryExpression>, KclError> {
|
||||
pub fn parse(infix_tokens: Vec<BinaryExpressionToken>) -> Result<BinaryExpression, KclError> {
|
||||
let rpn = postfix(infix_tokens);
|
||||
evaluate(rpn)
|
||||
}
|
||||
|
||||
/// Parses a list of tokens (in postfix order) into a binary expression tree.
|
||||
fn evaluate(rpn: Vec<BinaryExpressionToken>) -> Result<UnboxedNode<BinaryExpression>, KclError> {
|
||||
fn evaluate(rpn: Vec<BinaryExpressionToken>) -> Result<BinaryExpression, KclError> {
|
||||
let source_ranges = source_range(&rpn);
|
||||
let mut operand_stack: Vec<BinaryPart> = Vec::new();
|
||||
let e = KclError::Internal(KclErrorDetails {
|
||||
@ -28,19 +28,14 @@ fn evaluate(rpn: Vec<BinaryExpressionToken>) -> Result<UnboxedNode<BinaryExpress
|
||||
let Some(left) = operand_stack.pop() else {
|
||||
return Err(e);
|
||||
};
|
||||
let start = left.start();
|
||||
let end = right.end();
|
||||
|
||||
BinaryPart::BinaryExpression(UnboxedNode::boxed(
|
||||
BinaryExpression {
|
||||
operator,
|
||||
left,
|
||||
right,
|
||||
digest: None,
|
||||
},
|
||||
start,
|
||||
end,
|
||||
))
|
||||
BinaryPart::BinaryExpression(Box::new(BinaryExpression {
|
||||
start: left.start(),
|
||||
end: right.end(),
|
||||
operator,
|
||||
left,
|
||||
right,
|
||||
digest: None,
|
||||
}))
|
||||
}
|
||||
BinaryExpressionToken::Operand(o) => o,
|
||||
};
|
||||
@ -130,15 +125,13 @@ mod tests {
|
||||
fn parse_and_evaluate() {
|
||||
/// Make a literal
|
||||
fn lit(n: u8) -> BinaryPart {
|
||||
BinaryPart::Literal(UnboxedNode::new(
|
||||
Literal {
|
||||
value: n.into(),
|
||||
raw: n.to_string(),
|
||||
digest: None,
|
||||
},
|
||||
0,
|
||||
0,
|
||||
))
|
||||
BinaryPart::Literal(Box::new(Literal {
|
||||
start: 0,
|
||||
end: 0,
|
||||
value: n.into(),
|
||||
raw: n.to_string(),
|
||||
digest: None,
|
||||
}))
|
||||
}
|
||||
let tests: Vec<Vec<BinaryExpressionToken>> = vec![
|
||||
// 3 + 4 × 2 ÷ ( 1 − 5 ) ^ 2 ^ 3
|
||||
@ -149,16 +142,14 @@ mod tests {
|
||||
BinaryOperator::Mul.into(),
|
||||
lit(2).into(),
|
||||
BinaryOperator::Div.into(),
|
||||
BinaryPart::BinaryExpression(UnboxedNode::boxed(
|
||||
BinaryExpression {
|
||||
operator: BinaryOperator::Sub,
|
||||
left: lit(1),
|
||||
right: lit(5),
|
||||
digest: None,
|
||||
},
|
||||
0,
|
||||
0,
|
||||
))
|
||||
BinaryPart::BinaryExpression(Box::new(BinaryExpression {
|
||||
start: 0,
|
||||
end: 0,
|
||||
operator: BinaryOperator::Sub,
|
||||
left: lit(1),
|
||||
right: lit(5),
|
||||
digest: None,
|
||||
}))
|
||||
.into(),
|
||||
BinaryOperator::Pow.into(),
|
||||
lit(2).into(),
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,36 +1,26 @@
|
||||
---
|
||||
source: kcl/src/parser/parser_impl.rs
|
||||
assertion_line: 3567
|
||||
expression: actual
|
||||
---
|
||||
{
|
||||
"type": "UnboxedNode",
|
||||
"kind": {
|
||||
"type": "BinaryExpression",
|
||||
"operator": "+",
|
||||
"left": {
|
||||
"type": "Literal",
|
||||
"type": "UnboxedNode",
|
||||
"kind": {
|
||||
"type": "Literal",
|
||||
"value": 1,
|
||||
"raw": "1"
|
||||
},
|
||||
"start": 0,
|
||||
"end": 1
|
||||
},
|
||||
"right": {
|
||||
"type": "Literal",
|
||||
"type": "UnboxedNode",
|
||||
"kind": {
|
||||
"type": "Literal",
|
||||
"value": 2,
|
||||
"raw": "2"
|
||||
},
|
||||
"start": 4,
|
||||
"end": 5
|
||||
}
|
||||
},
|
||||
"type": "BinaryExpression",
|
||||
"start": 0,
|
||||
"end": 5
|
||||
"end": 5,
|
||||
"operator": "+",
|
||||
"left": {
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"start": 0,
|
||||
"end": 1,
|
||||
"value": 1,
|
||||
"raw": "1"
|
||||
},
|
||||
"right": {
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"start": 4,
|
||||
"end": 5,
|
||||
"value": 2,
|
||||
"raw": "2"
|
||||
}
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user