Compare commits
9 Commits
kurt-scale
...
nrc-refact
Author | SHA1 | Date | |
---|---|---|---|
7fd9eb3322 | |||
5aef2b72cb | |||
8ccdf2286d | |||
054e235362 | |||
3eebd36a41 | |||
412417411b | |||
a1c9dd99cf | |||
3ed873b6e9 | |||
a172e606b4 |
@ -9,7 +9,7 @@ Draw a line segment relative to the current origin using the polar
|
|||||||
measure of some angle and distance.
|
measure of some angle and distance.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
angledLine(data: AngledLineData, sketch: Sketch, tag?: TagDeclarator) -> Sketch
|
angledLine(data: AngledLineData, sketch: Sketch, tag?: TagNode) -> Sketch
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
@ -19,7 +19,7 @@ angledLine(data: AngledLineData, sketch: Sketch, tag?: TagDeclarator) -> Sketch
|
|||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `data` | [`AngledLineData`](/docs/kcl/types/AngledLineData) | Data to draw an angled line. | Yes |
|
| `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 |
|
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | A sketch is a collection of paths. | Yes |
|
||||||
| `tag` | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | | No |
|
| `tag` | [`TagNode`](/docs/kcl/types/TagNode) | | No |
|
||||||
|
|
||||||
### Returns
|
### 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.
|
along some angle (in degrees) for some relative length in the 'x' dimension.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
angledLineOfXLength(data: AngledLineData, sketch: Sketch, tag?: TagDeclarator) -> Sketch
|
angledLineOfXLength(data: AngledLineData, sketch: Sketch, tag?: TagNode) -> Sketch
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
@ -19,7 +19,7 @@ angledLineOfXLength(data: AngledLineData, sketch: Sketch, tag?: TagDeclarator) -
|
|||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `data` | [`AngledLineData`](/docs/kcl/types/AngledLineData) | Data to draw an angled line. | Yes |
|
| `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 |
|
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | A sketch is a collection of paths. | Yes |
|
||||||
| `tag` | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | | No |
|
| `tag` | [`TagNode`](/docs/kcl/types/TagNode) | | No |
|
||||||
|
|
||||||
### Returns
|
### 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.
|
along some angle (in degrees) for some relative length in the 'y' dimension.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
angledLineOfYLength(data: AngledLineData, sketch: Sketch, tag?: TagDeclarator) -> Sketch
|
angledLineOfYLength(data: AngledLineData, sketch: Sketch, tag?: TagNode) -> Sketch
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
@ -19,7 +19,7 @@ angledLineOfYLength(data: AngledLineData, sketch: Sketch, tag?: TagDeclarator) -
|
|||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `data` | [`AngledLineData`](/docs/kcl/types/AngledLineData) | Data to draw an angled line. | Yes |
|
| `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 |
|
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | A sketch is a collection of paths. | Yes |
|
||||||
| `tag` | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | | No |
|
| `tag` | [`TagNode`](/docs/kcl/types/TagNode) | | No |
|
||||||
|
|
||||||
### Returns
|
### 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.
|
such that the newly created line intersects the desired target line segment.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
angledLineThatIntersects(data: AngledLineThatIntersectsData, sketch: Sketch, tag?: TagDeclarator) -> Sketch
|
angledLineThatIntersects(data: AngledLineThatIntersectsData, sketch: Sketch, tag?: TagNode) -> 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 |
|
| `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 |
|
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | A sketch is a collection of paths. | Yes |
|
||||||
| `tag` | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | | No |
|
| `tag` | [`TagNode`](/docs/kcl/types/TagNode) | | No |
|
||||||
|
|
||||||
### Returns
|
### 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.
|
along some angle (in degrees) for some length, ending at the provided value in the 'x' dimension.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
angledLineToX(data: AngledLineToData, sketch: Sketch, tag?: TagDeclarator) -> Sketch
|
angledLineToX(data: AngledLineToData, sketch: Sketch, tag?: TagNode) -> Sketch
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
@ -19,7 +19,7 @@ angledLineToX(data: AngledLineToData, sketch: Sketch, tag?: TagDeclarator) -> Sk
|
|||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `data` | [`AngledLineToData`](/docs/kcl/types/AngledLineToData) | Data to draw an angled line to a point. | Yes |
|
| `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 |
|
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | A sketch is a collection of paths. | Yes |
|
||||||
| `tag` | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | | No |
|
| `tag` | [`TagNode`](/docs/kcl/types/TagNode) | | No |
|
||||||
|
|
||||||
### Returns
|
### 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.
|
along some angle (in degrees) for some length, ending at the provided value in the 'y' dimension.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
angledLineToY(data: AngledLineToData, sketch: Sketch, tag?: TagDeclarator) -> Sketch
|
angledLineToY(data: AngledLineToData, sketch: Sketch, tag?: TagNode) -> Sketch
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
@ -19,7 +19,7 @@ angledLineToY(data: AngledLineToData, sketch: Sketch, tag?: TagDeclarator) -> Sk
|
|||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `data` | [`AngledLineToData`](/docs/kcl/types/AngledLineToData) | Data to draw an angled line to a point. | Yes |
|
| `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 |
|
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | A sketch is a collection of paths. | Yes |
|
||||||
| `tag` | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | | No |
|
| `tag` | [`TagNode`](/docs/kcl/types/TagNode) | | No |
|
||||||
|
|
||||||
### Returns
|
### 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.
|
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
|
```js
|
||||||
arc(data: ArcData, sketch: Sketch, tag?: TagDeclarator) -> Sketch
|
arc(data: ArcData, sketch: Sketch, tag?: TagNode) -> Sketch
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
@ -21,7 +21,7 @@ arc(data: ArcData, sketch: Sketch, tag?: TagDeclarator) -> Sketch
|
|||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `data` | [`ArcData`](/docs/kcl/types/ArcData) | Data to draw an arc. | Yes |
|
| `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 |
|
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | A sketch is a collection of paths. | Yes |
|
||||||
| `tag` | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | | No |
|
| `tag` | [`TagNode`](/docs/kcl/types/TagNode) | | No |
|
||||||
|
|
||||||
### Returns
|
### 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.
|
the desired (x, y), using a number of control points to shape the curve's shape.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
bezierCurve(data: BezierData, sketch: Sketch, tag?: TagDeclarator) -> Sketch
|
bezierCurve(data: BezierData, sketch: Sketch, tag?: TagNode) -> Sketch
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
@ -19,7 +19,7 @@ bezierCurve(data: BezierData, sketch: Sketch, tag?: TagDeclarator) -> Sketch
|
|||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `data` | [`BezierData`](/docs/kcl/types/BezierData) | Data to draw a bezier curve. | Yes |
|
| `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 |
|
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | A sketch is a collection of paths. | Yes |
|
||||||
| `tag` | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | | No |
|
| `tag` | [`TagNode`](/docs/kcl/types/TagNode) | | No |
|
||||||
|
|
||||||
### Returns
|
### 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.
|
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
|
```js
|
||||||
chamfer(data: ChamferData, solid: Solid, tag?: TagDeclarator) -> Solid
|
chamfer(data: ChamferData, solid: Solid, tag?: TagNode) -> Solid
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
@ -19,7 +19,7 @@ chamfer(data: ChamferData, solid: Solid, tag?: TagDeclarator) -> Solid
|
|||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `data` | [`ChamferData`](/docs/kcl/types/ChamferData) | Data for chamfers. | Yes |
|
| `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 |
|
| `solid` | [`Solid`](/docs/kcl/types/Solid) | An solid is a collection of extrude surfaces. | Yes |
|
||||||
| `tag` | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | | No |
|
| `tag` | [`TagNode`](/docs/kcl/types/TagNode) | | No |
|
||||||
|
|
||||||
### Returns
|
### Returns
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ Construct a 2-dimensional circle, of the specified radius, centered at
|
|||||||
the provided (x, y) origin point.
|
the provided (x, y) origin point.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
circle(data: CircleData, sketch_surface_or_group: SketchOrSurface, tag?: TagDeclarator) -> Sketch
|
circle(data: CircleData, sketch_surface_or_group: SketchOrSurface, tag?: TagNode) -> Sketch
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
@ -19,7 +19,7 @@ circle(data: CircleData, sketch_surface_or_group: SketchOrSurface, tag?: TagDecl
|
|||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `data` | [`CircleData`](/docs/kcl/types/CircleData) | Data for drawing an circle | Yes |
|
| `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 |
|
| `sketch_surface_or_group` | [`SketchOrSurface`](/docs/kcl/types/SketchOrSurface) | A sketch surface or a sketch. | Yes |
|
||||||
| `tag` | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | | No |
|
| `tag` | [`TagNode`](/docs/kcl/types/TagNode) | | No |
|
||||||
|
|
||||||
### Returns
|
### 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.
|
origin, ensuring the resulting 2-dimensional sketch is not open-ended.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
close(sketch: Sketch, tag?: TagDeclarator) -> Sketch
|
close(sketch: Sketch, tag?: TagNode) -> Sketch
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
@ -18,7 +18,7 @@ close(sketch: Sketch, tag?: TagDeclarator) -> Sketch
|
|||||||
| Name | Type | Description | Required |
|
| Name | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | A sketch is a collection of paths. | Yes |
|
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | A sketch is a collection of paths. | Yes |
|
||||||
| `tag` | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | | No |
|
| `tag` | [`TagNode`](/docs/kcl/types/TagNode) | | No |
|
||||||
|
|
||||||
### Returns
|
### 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.
|
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
|
```js
|
||||||
fillet(data: FilletData, solid: Solid, tag?: TagDeclarator) -> Solid
|
fillet(data: FilletData, solid: Solid, tag?: TagNode) -> Solid
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
@ -19,7 +19,7 @@ fillet(data: FilletData, solid: Solid, tag?: TagDeclarator) -> Solid
|
|||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `data` | [`FilletData`](/docs/kcl/types/FilletData) | Data for fillets. | Yes |
|
| `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 |
|
| `solid` | [`Solid`](/docs/kcl/types/Solid) | An solid is a collection of extrude surfaces. | Yes |
|
||||||
| `tag` | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | | No |
|
| `tag` | [`TagNode`](/docs/kcl/types/TagNode) | | No |
|
||||||
|
|
||||||
### Returns
|
### Returns
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ Draw a line relative to the current origin to a specified (x, y) away
|
|||||||
from the current position.
|
from the current position.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
line(delta: [number], sketch: Sketch, tag?: TagDeclarator) -> Sketch
|
line(delta: [number], sketch: Sketch, tag?: TagNode) -> Sketch
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
@ -19,7 +19,7 @@ line(delta: [number], sketch: Sketch, tag?: TagDeclarator) -> Sketch
|
|||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `delta` | `[number]` | | Yes |
|
| `delta` | `[number]` | | Yes |
|
||||||
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | A sketch is a collection of paths. | Yes |
|
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | A sketch is a collection of paths. | Yes |
|
||||||
| `tag` | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | | No |
|
| `tag` | [`TagNode`](/docs/kcl/types/TagNode) | | No |
|
||||||
|
|
||||||
### Returns
|
### Returns
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ Draw a line from the current origin to some absolute (x, y) point.
|
|||||||
|
|
||||||
|
|
||||||
```js
|
```js
|
||||||
lineTo(to: [number], sketch: Sketch, tag?: TagDeclarator) -> Sketch
|
lineTo(to: [number], sketch: Sketch, tag?: TagNode) -> Sketch
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
@ -19,7 +19,7 @@ lineTo(to: [number], sketch: Sketch, tag?: TagDeclarator) -> Sketch
|
|||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `to` | `[number]` | | Yes |
|
| `to` | `[number]` | | Yes |
|
||||||
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | A sketch is a collection of paths. | Yes |
|
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | A sketch is a collection of paths. | Yes |
|
||||||
| `tag` | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | | No |
|
| `tag` | [`TagNode`](/docs/kcl/types/TagNode) | | No |
|
||||||
|
|
||||||
### Returns
|
### Returns
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ Start a new profile at a given point.
|
|||||||
|
|
||||||
|
|
||||||
```js
|
```js
|
||||||
startProfileAt(to: [number], sketch_surface: SketchSurface, tag?: TagDeclarator) -> Sketch
|
startProfileAt(to: [number], sketch_surface: SketchSurface, tag?: TagNode) -> Sketch
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
@ -19,7 +19,7 @@ startProfileAt(to: [number], sketch_surface: SketchSurface, tag?: TagDeclarator)
|
|||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `to` | `[number]` | | Yes |
|
| `to` | `[number]` | | Yes |
|
||||||
| `sketch_surface` | [`SketchSurface`](/docs/kcl/types/SketchSurface) | A sketch type. | Yes |
|
| `sketch_surface` | [`SketchSurface`](/docs/kcl/types/SketchSurface) | A sketch type. | Yes |
|
||||||
| `tag` | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | | No |
|
| `tag` | [`TagNode`](/docs/kcl/types/TagNode) | | No |
|
||||||
|
|
||||||
### Returns
|
### Returns
|
||||||
|
|
||||||
|
17359
docs/kcl/std.json
17359
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.
|
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
|
```js
|
||||||
tangentialArc(data: TangentialArcData, sketch: Sketch, tag?: TagDeclarator) -> Sketch
|
tangentialArc(data: TangentialArcData, sketch: Sketch, tag?: TagNode) -> Sketch
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
@ -19,7 +19,7 @@ tangentialArc(data: TangentialArcData, sketch: Sketch, tag?: TagDeclarator) -> S
|
|||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `data` | [`TangentialArcData`](/docs/kcl/types/TangentialArcData) | Data to draw a tangential arc. | Yes |
|
| `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 |
|
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | A sketch is a collection of paths. | Yes |
|
||||||
| `tag` | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | | No |
|
| `tag` | [`TagNode`](/docs/kcl/types/TagNode) | | No |
|
||||||
|
|
||||||
### Returns
|
### 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.
|
some part of an imaginary circle until it reaches the desired (x, y) coordinates.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
tangentialArcTo(to: [number], sketch: Sketch, tag?: TagDeclarator) -> Sketch
|
tangentialArcTo(to: [number], sketch: Sketch, tag?: TagNode) -> Sketch
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
@ -19,7 +19,7 @@ tangentialArcTo(to: [number], sketch: Sketch, tag?: TagDeclarator) -> Sketch
|
|||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `to` | `[number]` | | Yes |
|
| `to` | `[number]` | | Yes |
|
||||||
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | A sketch is a collection of paths. | Yes |
|
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | A sketch is a collection of paths. | Yes |
|
||||||
| `tag` | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | | No |
|
| `tag` | [`TagNode`](/docs/kcl/types/TagNode) | | No |
|
||||||
|
|
||||||
### Returns
|
### 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.
|
some part of an imaginary circle until it reaches a point the given (x, y) distance away.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
tangentialArcToRelative(delta: [number], sketch: Sketch, tag?: TagDeclarator) -> Sketch
|
tangentialArcToRelative(delta: [number], sketch: Sketch, tag?: TagNode) -> Sketch
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
@ -19,7 +19,7 @@ tangentialArcToRelative(delta: [number], sketch: Sketch, tag?: TagDeclarator) ->
|
|||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `delta` | `[number]` | | Yes |
|
| `delta` | `[number]` | | Yes |
|
||||||
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | A sketch is a collection of paths. | Yes |
|
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | A sketch is a collection of paths. | Yes |
|
||||||
| `tag` | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | | No |
|
| `tag` | [`TagNode`](/docs/kcl/types/TagNode) | | No |
|
||||||
|
|
||||||
### Returns
|
### Returns
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ A base path.
|
|||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `from` |`[number, number]`| The from point. | No |
|
| `from` |`[number, number]`| The from point. | No |
|
||||||
| `to` |`[number, number]`| The to point. | No |
|
| `to` |`[number, number]`| The to point. | No |
|
||||||
| `tag` |[`TagDeclarator`](/docs/kcl/types#tag-declaration)| The tag of the path. | No |
|
| `tag` |[`TagNode`](/docs/kcl/types/TagNode)| The tag of the path. | No |
|
||||||
| `__geoMeta` |[`GeoMeta`](/docs/kcl/types/GeoMeta)| Metadata. | No |
|
| `__geoMeta` |[`GeoMeta`](/docs/kcl/types/GeoMeta)| Metadata. | No |
|
||||||
|
|
||||||
|
|
||||||
|
@ -22,12 +22,10 @@ layout: manual
|
|||||||
|
|
||||||
| Property | Type | Description | Required |
|
| Property | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `type` |enum: `Literal`| | No |
|
| `type` |enum: [`Literal`](/docs/kcl/types/Literal)| | No |
|
||||||
|
| `kind` |[`Literal`](/docs/kcl/types/Literal)| | No |
|
||||||
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||||
| `end` |[`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 |
|
|
||||||
|
|
||||||
|
|
||||||
----
|
----
|
||||||
@ -43,10 +41,9 @@ layout: manual
|
|||||||
| Property | Type | Description | Required |
|
| Property | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `type` |enum: [`Identifier`](/docs/kcl/types/Identifier)| | No |
|
| `type` |enum: [`Identifier`](/docs/kcl/types/Identifier)| | No |
|
||||||
|
| `kind` |[`Identifier`](/docs/kcl/types/Identifier)| | No |
|
||||||
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||||
| `end` |[`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 |
|
|
||||||
|
|
||||||
|
|
||||||
----
|
----
|
||||||
@ -61,13 +58,10 @@ layout: manual
|
|||||||
|
|
||||||
| Property | Type | Description | Required |
|
| Property | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `type` |enum: `BinaryExpression`| | No |
|
| `type` |enum: [`BinaryExpression`](/docs/kcl/types/BinaryExpression)| | No |
|
||||||
|
| `kind` |[`BinaryExpression`](/docs/kcl/types/BinaryExpression)| | No |
|
||||||
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||||
| `end` |[`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 |
|
|
||||||
|
|
||||||
|
|
||||||
----
|
----
|
||||||
@ -82,13 +76,10 @@ layout: manual
|
|||||||
|
|
||||||
| Property | Type | Description | Required |
|
| Property | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `type` |enum: `CallExpression`| | No |
|
| `type` |enum: [`CallExpression`](/docs/kcl/types/CallExpression)| | No |
|
||||||
|
| `kind` |[`CallExpression`](/docs/kcl/types/CallExpression)| | No |
|
||||||
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||||
| `end` |[`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 |
|
|
||||||
|
|
||||||
|
|
||||||
----
|
----
|
||||||
@ -103,12 +94,10 @@ layout: manual
|
|||||||
|
|
||||||
| Property | Type | Description | Required |
|
| Property | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `type` |enum: `UnaryExpression`| | No |
|
| `type` |enum: [`UnaryExpression`](/docs/kcl/types/UnaryExpression)| | No |
|
||||||
|
| `kind` |[`UnaryExpression`](/docs/kcl/types/UnaryExpression)| | No |
|
||||||
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||||
| `end` |[`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 |
|
|
||||||
|
|
||||||
|
|
||||||
----
|
----
|
||||||
@ -123,13 +112,10 @@ layout: manual
|
|||||||
|
|
||||||
| Property | Type | Description | Required |
|
| Property | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `type` |enum: `MemberExpression`| | No |
|
| `type` |enum: [`MemberExpression`](/docs/kcl/types/MemberExpression)| | No |
|
||||||
|
| `kind` |[`MemberExpression`](/docs/kcl/types/MemberExpression)| | No |
|
||||||
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||||
| `end` |[`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 |
|
|
||||||
|
|
||||||
|
|
||||||
----
|
----
|
||||||
@ -144,14 +130,10 @@ layout: manual
|
|||||||
|
|
||||||
| Property | Type | Description | Required |
|
| Property | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `type` |enum: `IfExpression`| | No |
|
| `type` |enum: [`IfExpression`](/docs/kcl/types/IfExpression)| | No |
|
||||||
|
| `kind` |[`IfExpression`](/docs/kcl/types/IfExpression)| | No |
|
||||||
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||||
| `end` |[`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,13 +22,10 @@ layout: manual
|
|||||||
|
|
||||||
| Property | Type | Description | Required |
|
| Property | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `type` |enum: `ImportStatement`| | No |
|
| `type` |enum: [`ImportStatement`](/docs/kcl/types/ImportStatement)| | No |
|
||||||
|
| `kind` |[`ImportStatement`](/docs/kcl/types/ImportStatement)| | No |
|
||||||
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||||
| `end` |[`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 |
|
|
||||||
|
|
||||||
|
|
||||||
----
|
----
|
||||||
@ -43,11 +40,10 @@ layout: manual
|
|||||||
|
|
||||||
| Property | Type | Description | Required |
|
| Property | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `type` |enum: `ExpressionStatement`| | No |
|
| `type` |enum: [`ExpressionStatement`](/docs/kcl/types/ExpressionStatement)| | No |
|
||||||
|
| `kind` |[`ExpressionStatement`](/docs/kcl/types/ExpressionStatement)| | No |
|
||||||
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||||
| `end` |[`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 |
|
|
||||||
|
|
||||||
|
|
||||||
----
|
----
|
||||||
@ -62,13 +58,10 @@ layout: manual
|
|||||||
|
|
||||||
| Property | Type | Description | Required |
|
| Property | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `type` |enum: `VariableDeclaration`| | No |
|
| `type` |enum: [`VariableDeclaration`](/docs/kcl/types/VariableDeclaration)| | No |
|
||||||
|
| `kind` |[`VariableDeclaration`](/docs/kcl/types/VariableDeclaration)| | No |
|
||||||
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||||
| `end` |[`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 |
|
|
||||||
|
|
||||||
|
|
||||||
----
|
----
|
||||||
@ -83,11 +76,10 @@ layout: manual
|
|||||||
|
|
||||||
| Property | Type | Description | Required |
|
| Property | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `type` |enum: `ReturnStatement`| | No |
|
| `type` |enum: [`ReturnStatement`](/docs/kcl/types/ReturnStatement)| | No |
|
||||||
|
| `kind` |[`ReturnStatement`](/docs/kcl/types/ReturnStatement)| | No |
|
||||||
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||||
| `end` |[`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 |
|
| `id` |`string`| The id of the engine command that called this fillet. | No |
|
||||||
| `radius` |`number`| | No |
|
| `radius` |`number`| | No |
|
||||||
| `edgeId` |`string`| The engine id of the edge to fillet. | No |
|
| `edgeId` |`string`| The engine id of the edge to fillet. | No |
|
||||||
| `tag` |[`TagDeclarator`](/docs/kcl/types#tag-declaration)| | No |
|
| `tag` |[`TagNode`](/docs/kcl/types/TagNode)| | No |
|
||||||
|
|
||||||
|
|
||||||
----
|
----
|
||||||
@ -48,7 +48,7 @@ A chamfer.
|
|||||||
| `id` |`string`| The id of the engine command that called this chamfer. | No |
|
| `id` |`string`| The id of the engine command that called this chamfer. | No |
|
||||||
| `length` |`number`| | No |
|
| `length` |`number`| | No |
|
||||||
| `edgeId` |`string`| The engine id of the edge to chamfer. | No |
|
| `edgeId` |`string`| The engine id of the edge to chamfer. | No |
|
||||||
| `tag` |[`TagDeclarator`](/docs/kcl/types#tag-declaration)| | No |
|
| `tag` |[`TagNode`](/docs/kcl/types/TagNode)| | No |
|
||||||
|
|
||||||
|
|
||||||
----
|
----
|
||||||
|
@ -15,10 +15,8 @@ layout: manual
|
|||||||
|
|
||||||
| Property | Type | Description | Required |
|
| 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 |
|
| `cond` |[`Expr`](/docs/kcl/types/Expr)| | No |
|
||||||
| `then_val` |[`Program`](/docs/kcl/types/Program)| | No |
|
| `then_val` |[`UnboxedNode_for_Program`](/docs/kcl/types/UnboxedNode_for_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 |
|
| `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,12 +23,10 @@ An expression can be evaluated to yield a single KCL value.
|
|||||||
|
|
||||||
| Property | Type | Description | Required |
|
| Property | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `type` |enum: `Literal`| | No |
|
| `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 |
|
||||||
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||||
| `end` |[`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 |
|
|
||||||
|
|
||||||
|
|
||||||
----
|
----
|
||||||
@ -44,10 +42,9 @@ An expression can be evaluated to yield a single KCL value.
|
|||||||
| Property | Type | Description | Required |
|
| Property | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `type` |enum: [`Identifier`](/docs/kcl/types/Identifier)| | No |
|
| `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 |
|
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||||
| `end` |[`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 |
|
|
||||||
|
|
||||||
|
|
||||||
----
|
----
|
||||||
@ -63,10 +60,9 @@ An expression can be evaluated to yield a single KCL value.
|
|||||||
| Property | Type | Description | Required |
|
| Property | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `type` |enum: [`TagDeclarator`](/docs/kcl/types#tag-declaration)| | No |
|
| `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 |
|
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||||
| `end` |[`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 |
|
|
||||||
|
|
||||||
|
|
||||||
----
|
----
|
||||||
@ -81,13 +77,10 @@ An expression can be evaluated to yield a single KCL value.
|
|||||||
|
|
||||||
| Property | Type | Description | Required |
|
| Property | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `type` |enum: `BinaryExpression`| | No |
|
| `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 |
|
||||||
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||||
| `end` |[`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 |
|
|
||||||
|
|
||||||
|
|
||||||
----
|
----
|
||||||
@ -103,11 +96,9 @@ An expression can be evaluated to yield a single KCL value.
|
|||||||
| Property | Type | Description | Required |
|
| Property | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `type` |enum: [`FunctionExpression`](/docs/kcl/types/FunctionExpression)| | No |
|
| `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 |
|
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||||
| `end` |[`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 |
|
|
||||||
|
|
||||||
|
|
||||||
----
|
----
|
||||||
@ -122,13 +113,10 @@ An expression can be evaluated to yield a single KCL value.
|
|||||||
|
|
||||||
| Property | Type | Description | Required |
|
| Property | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `type` |enum: `CallExpression`| | No |
|
| `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 |
|
||||||
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||||
| `end` |[`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 |
|
|
||||||
|
|
||||||
|
|
||||||
----
|
----
|
||||||
@ -143,12 +131,10 @@ An expression can be evaluated to yield a single KCL value.
|
|||||||
|
|
||||||
| Property | Type | Description | Required |
|
| Property | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `type` |enum: `PipeExpression`| | No |
|
| `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 |
|
||||||
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||||
| `end` |[`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 |
|
|
||||||
|
|
||||||
|
|
||||||
----
|
----
|
||||||
@ -163,10 +149,10 @@ An expression can be evaluated to yield a single KCL value.
|
|||||||
|
|
||||||
| Property | Type | Description | Required |
|
| Property | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `type` |enum: `PipeSubstitution`| | No |
|
| `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 |
|
||||||
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||||
| `end` |[`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 |
|
|
||||||
|
|
||||||
|
|
||||||
----
|
----
|
||||||
@ -181,12 +167,10 @@ An expression can be evaluated to yield a single KCL value.
|
|||||||
|
|
||||||
| Property | Type | Description | Required |
|
| Property | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `type` |enum: `ArrayExpression`| | No |
|
| `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 |
|
||||||
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||||
| `end` |[`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 |
|
|
||||||
|
|
||||||
|
|
||||||
----
|
----
|
||||||
@ -201,13 +185,10 @@ An expression can be evaluated to yield a single KCL value.
|
|||||||
|
|
||||||
| Property | Type | Description | Required |
|
| Property | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `type` |enum: `ArrayRangeExpression`| | No |
|
| `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 |
|
||||||
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||||
| `end` |[`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 |
|
|
||||||
|
|
||||||
|
|
||||||
----
|
----
|
||||||
@ -222,12 +203,10 @@ An expression can be evaluated to yield a single KCL value.
|
|||||||
|
|
||||||
| Property | Type | Description | Required |
|
| Property | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `type` |enum: `ObjectExpression`| | No |
|
| `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 |
|
||||||
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||||
| `end` |[`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 |
|
|
||||||
|
|
||||||
|
|
||||||
----
|
----
|
||||||
@ -242,13 +221,10 @@ An expression can be evaluated to yield a single KCL value.
|
|||||||
|
|
||||||
| Property | Type | Description | Required |
|
| Property | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `type` |enum: `MemberExpression`| | No |
|
| `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 |
|
||||||
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||||
| `end` |[`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 |
|
|
||||||
|
|
||||||
|
|
||||||
----
|
----
|
||||||
@ -263,12 +239,10 @@ An expression can be evaluated to yield a single KCL value.
|
|||||||
|
|
||||||
| Property | Type | Description | Required |
|
| Property | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `type` |enum: `UnaryExpression`| | No |
|
| `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 |
|
||||||
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||||
| `end` |[`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 |
|
|
||||||
|
|
||||||
|
|
||||||
----
|
----
|
||||||
@ -283,14 +257,10 @@ An expression can be evaluated to yield a single KCL value.
|
|||||||
|
|
||||||
| Property | Type | Description | Required |
|
| Property | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `type` |enum: `IfExpression`| | No |
|
| `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 |
|
||||||
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||||
| `end` |[`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 |
|
| `type` |enum: `extrudePlane`| | No |
|
||||||
| `faceId` |`string`| The face id for the extrude plane. | No |
|
| `faceId` |`string`| The face id for the extrude plane. | No |
|
||||||
| `tag` |[`TagDeclarator`](/docs/kcl/types#tag-declaration)| The tag. | No |
|
| `tag` |[`TagNode`](/docs/kcl/types/TagNode)| The tag. | No |
|
||||||
| `id` |`string`| The id of the geometry. | No |
|
| `id` |`string`| The id of the geometry. | No |
|
||||||
| `sourceRange` |`SourceRange`| The source range. | No |
|
| `sourceRange` |`SourceRange`| The source range. | No |
|
||||||
|
|
||||||
@ -46,7 +46,7 @@ An extruded arc.
|
|||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `type` |enum: `extrudeArc`| | No |
|
| `type` |enum: `extrudeArc`| | No |
|
||||||
| `faceId` |`string`| The face id for the extrude plane. | No |
|
| `faceId` |`string`| The face id for the extrude plane. | No |
|
||||||
| `tag` |[`TagDeclarator`](/docs/kcl/types#tag-declaration)| The tag. | No |
|
| `tag` |[`TagNode`](/docs/kcl/types/TagNode)| The tag. | No |
|
||||||
| `id` |`string`| The id of the geometry. | No |
|
| `id` |`string`| The id of the geometry. | No |
|
||||||
| `sourceRange` |`SourceRange`| The source range. | No |
|
| `sourceRange` |`SourceRange`| The source range. | No |
|
||||||
|
|
||||||
@ -66,7 +66,7 @@ Geometry metadata.
|
|||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `type` |enum: `chamfer`| | No |
|
| `type` |enum: `chamfer`| | No |
|
||||||
| `faceId` |`string`| The id for the chamfer surface. | No |
|
| `faceId` |`string`| The id for the chamfer surface. | No |
|
||||||
| `tag` |[`TagDeclarator`](/docs/kcl/types#tag-declaration)| The tag. | No |
|
| `tag` |[`TagNode`](/docs/kcl/types/TagNode)| The tag. | No |
|
||||||
| `id` |`string`| The id of the geometry. | No |
|
| `id` |`string`| The id of the geometry. | No |
|
||||||
| `sourceRange` |`SourceRange`| The source range. | No |
|
| `sourceRange` |`SourceRange`| The source range. | No |
|
||||||
|
|
||||||
@ -86,7 +86,7 @@ Geometry metadata.
|
|||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `type` |enum: `fillet`| | No |
|
| `type` |enum: `fillet`| | No |
|
||||||
| `faceId` |`string`| The id for the fillet surface. | No |
|
| `faceId` |`string`| The id for the fillet surface. | No |
|
||||||
| `tag` |[`TagDeclarator`](/docs/kcl/types#tag-declaration)| The tag. | No |
|
| `tag` |[`TagNode`](/docs/kcl/types/TagNode)| The tag. | No |
|
||||||
| `id` |`string`| The id of the geometry. | No |
|
| `id` |`string`| The id of the geometry. | No |
|
||||||
| `sourceRange` |`SourceRange`| The source range. | No |
|
| `sourceRange` |`SourceRange`| The source range. | No |
|
||||||
|
|
||||||
|
@ -15,10 +15,8 @@ layout: manual
|
|||||||
|
|
||||||
| Property | Type | Description | Required |
|
| 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 |
|
| `params` |`[` [`Parameter`](/docs/kcl/types/Parameter) `]`| | No |
|
||||||
| `body` |[`Program`](/docs/kcl/types/Program)| | No |
|
| `body` |[`UnboxedNode_for_Program`](/docs/kcl/types/UnboxedNode_for_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 |
|
| `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,6 @@ layout: manual
|
|||||||
|
|
||||||
| Property | Type | Description | Required |
|
| Property | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
|
||||||
| `end` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
|
||||||
| `name` |`string`| | 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 |
|
| `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,10 +15,8 @@ layout: manual
|
|||||||
|
|
||||||
| Property | Type | Description | Required |
|
| Property | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `name` |[`Identifier`](/docs/kcl/types/Identifier)| Name of the item to import. | No |
|
| `name` |[`UnboxedNode_for_Identifier`](/docs/kcl/types/UnboxedNode_for_Identifier)| Name of the item to import. | No |
|
||||||
| `alias` |[`Identifier`](/docs/kcl/types/Identifier)| Rename the item using an identifier after "as". | No |
|
| `alias` |[`UnboxedNode_for_Identifier`](/docs/kcl/types/UnboxedNode_for_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 |
|
| `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,10 +59,9 @@ Any KCL value.
|
|||||||
| Property | Type | Description | Required |
|
| Property | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `type` |enum: [`TagDeclarator`](/docs/kcl/types#tag-declaration)| | No |
|
| `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 |
|
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||||
| `end` |[`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 |
|
|
||||||
|
|
||||||
|
|
||||||
----
|
----
|
||||||
@ -183,7 +182,7 @@ Data for an imported geometry.
|
|||||||
| Property | Type | Description | Required |
|
| Property | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `type` |enum: `Function`| | No |
|
| `type` |enum: `Function`| | No |
|
||||||
| `expression` |[`FunctionExpression`](/docs/kcl/types/FunctionExpression)| Any KCL value. | No |
|
| `expression` |[`UnboxedNode_for_FunctionExpression`](/docs/kcl/types/UnboxedNode_for_FunctionExpression)| Any KCL value. | No |
|
||||||
| `memory` |[`ProgramMemory`](/docs/kcl/types/ProgramMemory)| Any KCL value. | No |
|
| `memory` |[`ProgramMemory`](/docs/kcl/types/ProgramMemory)| Any KCL value. | No |
|
||||||
| `__meta` |`[` [`Metadata`](/docs/kcl/types/Metadata) `]`| | No |
|
| `__meta` |`[` [`Metadata`](/docs/kcl/types/Metadata) `]`| | No |
|
||||||
|
|
||||||
|
@ -23,10 +23,9 @@ layout: manual
|
|||||||
| Property | Type | Description | Required |
|
| Property | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `type` |enum: [`Identifier`](/docs/kcl/types/Identifier)| | No |
|
| `type` |enum: [`Identifier`](/docs/kcl/types/Identifier)| | No |
|
||||||
|
| `kind` |[`Identifier`](/docs/kcl/types/Identifier)| | No |
|
||||||
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||||
| `end` |[`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 |
|
|
||||||
|
|
||||||
|
|
||||||
----
|
----
|
||||||
@ -41,12 +40,10 @@ layout: manual
|
|||||||
|
|
||||||
| Property | Type | Description | Required |
|
| Property | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `type` |enum: `Literal`| | No |
|
| `type` |enum: [`Literal`](/docs/kcl/types/Literal)| | No |
|
||||||
|
| `kind` |[`Literal`](/docs/kcl/types/Literal)| | No |
|
||||||
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||||
| `end` |[`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,13 +22,10 @@ layout: manual
|
|||||||
|
|
||||||
| Property | Type | Description | Required |
|
| Property | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `type` |enum: `MemberExpression`| | No |
|
| `type` |enum: [`MemberExpression`](/docs/kcl/types/MemberExpression)| | No |
|
||||||
|
| `kind` |[`MemberExpression`](/docs/kcl/types/MemberExpression)| | No |
|
||||||
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||||
| `end` |[`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 |
|
|
||||||
|
|
||||||
|
|
||||||
----
|
----
|
||||||
@ -44,10 +41,9 @@ layout: manual
|
|||||||
| Property | Type | Description | Required |
|
| Property | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `type` |enum: [`Identifier`](/docs/kcl/types/Identifier)| | No |
|
| `type` |enum: [`Identifier`](/docs/kcl/types/Identifier)| | No |
|
||||||
|
| `kind` |[`Identifier`](/docs/kcl/types/Identifier)| | No |
|
||||||
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||||
| `end` |[`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 |
|
| Property | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `nonCodeNodes` |`object`| | No |
|
| `nonCodeNodes` |`object`| | No |
|
||||||
| `start` |`[` [`NonCodeNode`](/docs/kcl/types/NonCodeNode) `]`| | No |
|
| `start` |`[` [`UnboxedNode_for_NonCodeNode`](/docs/kcl/types/UnboxedNode_for_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 |
|
| `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,6 @@ layout: manual
|
|||||||
|
|
||||||
| Property | Type | Description | Required |
|
| 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 |
|
| `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 |
|
| `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,9 +15,7 @@ layout: manual
|
|||||||
|
|
||||||
| Property | Type | Description | Required |
|
| Property | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `start` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
| `key` |[`UnboxedNode_for_Identifier`](/docs/kcl/types/UnboxedNode_for_Identifier)| | No |
|
||||||
| `end` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
|
||||||
| `key` |[`Identifier`](/docs/kcl/types/Identifier)| | No |
|
|
||||||
| `value` |[`Expr`](/docs/kcl/types/Expr)| | 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 |
|
| `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 |
|
| Property | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `identifier` |[`Identifier`](/docs/kcl/types/Identifier)| The parameter's label or name. | No |
|
| `identifier` |[`UnboxedNode_for_Identifier`](/docs/kcl/types/UnboxedNode_for_Identifier)| The parameter's label or name. | No |
|
||||||
| `optional` |`boolean`| Is the parameter optional? | 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 |
|
| `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 |
|
| `type` |enum: `ToPoint`| | No |
|
||||||
| `from` |`[number, number]`| The from point. | No |
|
| `from` |`[number, number]`| The from point. | No |
|
||||||
| `to` |`[number, number]`| The to point. | No |
|
| `to` |`[number, number]`| The to point. | No |
|
||||||
| `tag` |[`TagDeclarator`](/docs/kcl/types#tag-declaration)| The tag of the path. | No |
|
| `tag` |[`TagNode`](/docs/kcl/types/TagNode)| The tag of the path. | No |
|
||||||
| `__geoMeta` |[`GeoMeta`](/docs/kcl/types/GeoMeta)| Metadata. | 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 |
|
| `ccw` |`boolean`| arc's direction | No |
|
||||||
| `from` |`[number, number]`| The from point. | No |
|
| `from` |`[number, number]`| The from point. | No |
|
||||||
| `to` |`[number, number]`| The to point. | No |
|
| `to` |`[number, number]`| The to point. | No |
|
||||||
| `tag` |[`TagDeclarator`](/docs/kcl/types#tag-declaration)| The tag of the path. | No |
|
| `tag` |[`TagNode`](/docs/kcl/types/TagNode)| The tag of the path. | No |
|
||||||
| `__geoMeta` |[`GeoMeta`](/docs/kcl/types/GeoMeta)| Metadata. | 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 |
|
| `ccw` |`boolean`| arc's direction | No |
|
||||||
| `from` |`[number, number]`| The from point. | No |
|
| `from` |`[number, number]`| The from point. | No |
|
||||||
| `to` |`[number, number]`| The to point. | No |
|
| `to` |`[number, number]`| The to point. | No |
|
||||||
| `tag` |[`TagDeclarator`](/docs/kcl/types#tag-declaration)| The tag of the path. | No |
|
| `tag` |[`TagNode`](/docs/kcl/types/TagNode)| The tag of the path. | No |
|
||||||
| `__geoMeta` |[`GeoMeta`](/docs/kcl/types/GeoMeta)| Metadata. | No |
|
| `__geoMeta` |[`GeoMeta`](/docs/kcl/types/GeoMeta)| Metadata. | No |
|
||||||
|
|
||||||
|
|
||||||
@ -94,7 +94,7 @@ a complete arc
|
|||||||
| `ccw` |`boolean`| arc's direction | No |
|
| `ccw` |`boolean`| arc's direction | No |
|
||||||
| `from` |`[number, number]`| The from point. | No |
|
| `from` |`[number, number]`| The from point. | No |
|
||||||
| `to` |`[number, number]`| The to point. | No |
|
| `to` |`[number, number]`| The to point. | No |
|
||||||
| `tag` |[`TagDeclarator`](/docs/kcl/types#tag-declaration)| The tag of the path. | No |
|
| `tag` |[`TagNode`](/docs/kcl/types/TagNode)| The tag of the path. | No |
|
||||||
| `__geoMeta` |[`GeoMeta`](/docs/kcl/types/GeoMeta)| Metadata. | No |
|
| `__geoMeta` |[`GeoMeta`](/docs/kcl/types/GeoMeta)| Metadata. | No |
|
||||||
|
|
||||||
|
|
||||||
@ -115,7 +115,7 @@ A path that is horizontal.
|
|||||||
| `x` |`number`| The x coordinate. | No |
|
| `x` |`number`| The x coordinate. | No |
|
||||||
| `from` |`[number, number]`| The from point. | No |
|
| `from` |`[number, number]`| The from point. | No |
|
||||||
| `to` |`[number, number]`| The to point. | No |
|
| `to` |`[number, number]`| The to point. | No |
|
||||||
| `tag` |[`TagDeclarator`](/docs/kcl/types#tag-declaration)| The tag of the path. | No |
|
| `tag` |[`TagNode`](/docs/kcl/types/TagNode)| The tag of the path. | No |
|
||||||
| `__geoMeta` |[`GeoMeta`](/docs/kcl/types/GeoMeta)| Metadata. | No |
|
| `__geoMeta` |[`GeoMeta`](/docs/kcl/types/GeoMeta)| Metadata. | No |
|
||||||
|
|
||||||
|
|
||||||
@ -137,7 +137,7 @@ An angled line to.
|
|||||||
| `y` |`number`| The y coordinate. | No |
|
| `y` |`number`| The y coordinate. | No |
|
||||||
| `from` |`[number, number]`| The from point. | No |
|
| `from` |`[number, number]`| The from point. | No |
|
||||||
| `to` |`[number, number]`| The to point. | No |
|
| `to` |`[number, number]`| The to point. | No |
|
||||||
| `tag` |[`TagDeclarator`](/docs/kcl/types#tag-declaration)| The tag of the path. | No |
|
| `tag` |[`TagNode`](/docs/kcl/types/TagNode)| The tag of the path. | No |
|
||||||
| `__geoMeta` |[`GeoMeta`](/docs/kcl/types/GeoMeta)| Metadata. | No |
|
| `__geoMeta` |[`GeoMeta`](/docs/kcl/types/GeoMeta)| Metadata. | No |
|
||||||
|
|
||||||
|
|
||||||
@ -157,7 +157,7 @@ A base path.
|
|||||||
| `type` |enum: `Base`| | No |
|
| `type` |enum: `Base`| | No |
|
||||||
| `from` |`[number, number]`| The from point. | No |
|
| `from` |`[number, number]`| The from point. | No |
|
||||||
| `to` |`[number, number]`| The to point. | No |
|
| `to` |`[number, number]`| The to point. | No |
|
||||||
| `tag` |[`TagDeclarator`](/docs/kcl/types#tag-declaration)| The tag of the path. | No |
|
| `tag` |[`TagNode`](/docs/kcl/types/TagNode)| The tag of the path. | No |
|
||||||
| `__geoMeta` |[`GeoMeta`](/docs/kcl/types/GeoMeta)| Metadata. | No |
|
| `__geoMeta` |[`GeoMeta`](/docs/kcl/types/GeoMeta)| Metadata. | No |
|
||||||
|
|
||||||
|
|
||||||
|
@ -16,10 +16,8 @@ A KCL program top level, or function body.
|
|||||||
|
|
||||||
| Property | Type | Description | Required |
|
| 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 |
|
| `body` |`[` [`BodyItem`](/docs/kcl/types/BodyItem) `]`| | No |
|
||||||
| `nonCodeMeta` |[`NonCodeMeta`](/docs/kcl/types/NonCodeMeta)| A KCL program top level, or function body. | No |
|
| `nonCodeMeta` |[`UnboxedNode_for_NonCodeMeta`](/docs/kcl/types/UnboxedNode_for_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 |
|
| `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.
|
from the current position along the 'x' axis.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
xLine(length: number, sketch: Sketch, tag?: TagDeclarator) -> Sketch
|
xLine(length: number, sketch: Sketch, tag?: TagNode) -> Sketch
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
@ -19,7 +19,7 @@ xLine(length: number, sketch: Sketch, tag?: TagDeclarator) -> Sketch
|
|||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `length` | `number` | | Yes |
|
| `length` | `number` | | Yes |
|
||||||
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | A sketch is a collection of paths. | Yes |
|
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | A sketch is a collection of paths. | Yes |
|
||||||
| `tag` | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | | No |
|
| `tag` | [`TagNode`](/docs/kcl/types/TagNode) | | No |
|
||||||
|
|
||||||
### Returns
|
### 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)
|
E.g. if the previous line ended at (1, 1), then xLineTo(4) draws a line from (1, 1) to (4, 1)
|
||||||
|
|
||||||
```js
|
```js
|
||||||
xLineTo(to: number, sketch: Sketch, tag?: TagDeclarator) -> Sketch
|
xLineTo(to: number, sketch: Sketch, tag?: TagNode) -> Sketch
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
@ -19,7 +19,7 @@ xLineTo(to: number, sketch: Sketch, tag?: TagDeclarator) -> Sketch
|
|||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `to` | `number` | | Yes |
|
| `to` | `number` | | Yes |
|
||||||
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | A sketch is a collection of paths. | Yes |
|
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | A sketch is a collection of paths. | Yes |
|
||||||
| `tag` | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | | No |
|
| `tag` | [`TagNode`](/docs/kcl/types/TagNode) | | No |
|
||||||
|
|
||||||
### Returns
|
### 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.
|
from the current position along the 'y' axis.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
yLine(length: number, sketch: Sketch, tag?: TagDeclarator) -> Sketch
|
yLine(length: number, sketch: Sketch, tag?: TagNode) -> Sketch
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
@ -19,7 +19,7 @@ yLine(length: number, sketch: Sketch, tag?: TagDeclarator) -> Sketch
|
|||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `length` | `number` | | Yes |
|
| `length` | `number` | | Yes |
|
||||||
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | A sketch is a collection of paths. | Yes |
|
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | A sketch is a collection of paths. | Yes |
|
||||||
| `tag` | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | | No |
|
| `tag` | [`TagNode`](/docs/kcl/types/TagNode) | | No |
|
||||||
|
|
||||||
### Returns
|
### 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)
|
E.g. if the previous line ended at (1, 1), then yLineTo(4) draws a line from (1, 1) to (1, 4)
|
||||||
|
|
||||||
```js
|
```js
|
||||||
yLineTo(to: number, sketch: Sketch, tag?: TagDeclarator) -> Sketch
|
yLineTo(to: number, sketch: Sketch, tag?: TagNode) -> Sketch
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
@ -19,7 +19,7 @@ yLineTo(to: number, sketch: Sketch, tag?: TagDeclarator) -> Sketch
|
|||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `to` | `number` | | Yes |
|
| `to` | `number` | | Yes |
|
||||||
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | A sketch is a collection of paths. | Yes |
|
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | A sketch is a collection of paths. | Yes |
|
||||||
| `tag` | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | | No |
|
| `tag` | [`TagNode`](/docs/kcl/types/TagNode) | | No |
|
||||||
|
|
||||||
### Returns
|
### Returns
|
||||||
|
|
||||||
|
@ -44,6 +44,7 @@ import {
|
|||||||
import { ActionButton } from 'components/ActionButton'
|
import { ActionButton } from 'components/ActionButton'
|
||||||
import { err, reportRejection, trap } from 'lib/trap'
|
import { err, reportRejection, trap } from 'lib/trap'
|
||||||
import { useCommandsContext } from 'hooks/useCommandsContext'
|
import { useCommandsContext } from 'hooks/useCommandsContext'
|
||||||
|
import { UnboxedNode } from 'wasm-lib/kcl/bindings/UnboxedNode'
|
||||||
|
|
||||||
function useShouldHideScene(): { hideClient: boolean; hideServer: boolean } {
|
function useShouldHideScene(): { hideClient: boolean; hideServer: boolean } {
|
||||||
const [isCamMoving, setIsCamMoving] = useState(false)
|
const [isCamMoving, setIsCamMoving] = useState(false)
|
||||||
@ -201,7 +202,7 @@ const Overlay = ({
|
|||||||
let xAlignment = overlay.angle < 0 ? '0%' : '-100%'
|
let xAlignment = overlay.angle < 0 ? '0%' : '-100%'
|
||||||
let yAlignment = overlay.angle < -90 || overlay.angle >= 90 ? '0%' : '-100%'
|
let yAlignment = overlay.angle < -90 || overlay.angle >= 90 ? '0%' : '-100%'
|
||||||
|
|
||||||
const _node1 = getNodeFromPath<CallExpression>(
|
const _node1 = getNodeFromPath<UnboxedNode<CallExpression>>(
|
||||||
kclManager.ast,
|
kclManager.ast,
|
||||||
overlay.pathToNode,
|
overlay.pathToNode,
|
||||||
'CallExpression'
|
'CallExpression'
|
||||||
@ -381,7 +382,7 @@ export async function deleteSegment({
|
|||||||
pathToNode: PathToNode
|
pathToNode: PathToNode
|
||||||
sketchDetails: SketchDetails | null
|
sketchDetails: SketchDetails | null
|
||||||
}) {
|
}) {
|
||||||
let modifiedAst: Program | Error = kclManager.ast
|
let modifiedAst: UnboxedNode<Program> | Error = kclManager.ast
|
||||||
const dependentRanges = findUsesOfTagInPipe(modifiedAst, pathToNode)
|
const dependentRanges = findUsesOfTagInPipe(modifiedAst, pathToNode)
|
||||||
|
|
||||||
const shouldContinueSegDelete = dependentRanges.length
|
const shouldContinueSegDelete = dependentRanges.length
|
||||||
|
@ -92,6 +92,7 @@ import { err, reportRejection, trap } from 'lib/trap'
|
|||||||
import { CSS2DObject } from 'three/examples/jsm/renderers/CSS2DRenderer'
|
import { CSS2DObject } from 'three/examples/jsm/renderers/CSS2DRenderer'
|
||||||
import { Point3d } from 'wasm-lib/kcl/bindings/Point3d'
|
import { Point3d } from 'wasm-lib/kcl/bindings/Point3d'
|
||||||
import { SegmentInputs } from 'lang/std/stdTypes'
|
import { SegmentInputs } from 'lang/std/stdTypes'
|
||||||
|
import { UnboxedNode } from 'wasm-lib/kcl/bindings/UnboxedNode'
|
||||||
|
|
||||||
type DraftSegment = 'line' | 'tangentialArcTo'
|
type DraftSegment = 'line' | 'tangentialArcTo'
|
||||||
|
|
||||||
@ -369,14 +370,14 @@ export class SceneEntities {
|
|||||||
selectionRanges,
|
selectionRanges,
|
||||||
}: {
|
}: {
|
||||||
sketchPathToNode: PathToNode
|
sketchPathToNode: PathToNode
|
||||||
maybeModdedAst: Program
|
maybeModdedAst: UnboxedNode<Program>
|
||||||
draftExpressionsIndices?: { start: number; end: number }
|
draftExpressionsIndices?: { start: number; end: number }
|
||||||
forward: [number, number, number]
|
forward: [number, number, number]
|
||||||
up: [number, number, number]
|
up: [number, number, number]
|
||||||
position?: [number, number, number]
|
position?: [number, number, number]
|
||||||
selectionRanges?: Selections
|
selectionRanges?: Selections
|
||||||
}): Promise<{
|
}): Promise<{
|
||||||
truncatedAst: Program
|
truncatedAst: UnboxedNode<Program>
|
||||||
programMemoryOverride: ProgramMemory
|
programMemoryOverride: ProgramMemory
|
||||||
sketch: Sketch
|
sketch: Sketch
|
||||||
variableDeclarationName: string
|
variableDeclarationName: string
|
||||||
@ -561,7 +562,7 @@ export class SceneEntities {
|
|||||||
}
|
}
|
||||||
updateAstAndRejigSketch = async (
|
updateAstAndRejigSketch = async (
|
||||||
sketchPathToNode: PathToNode,
|
sketchPathToNode: PathToNode,
|
||||||
modifiedAst: Program | Error,
|
modifiedAst: UnboxedNode<Program> | Error,
|
||||||
forward: [number, number, number],
|
forward: [number, number, number],
|
||||||
up: [number, number, number],
|
up: [number, number, number],
|
||||||
origin: [number, number, number]
|
origin: [number, number, number]
|
||||||
@ -1177,7 +1178,7 @@ export class SceneEntities {
|
|||||||
}
|
}
|
||||||
prepareTruncatedMemoryAndAst = (
|
prepareTruncatedMemoryAndAst = (
|
||||||
sketchPathToNode: PathToNode,
|
sketchPathToNode: PathToNode,
|
||||||
ast?: Program,
|
ast?: UnboxedNode<Program>,
|
||||||
draftSegment?: DraftSegment
|
draftSegment?: DraftSegment
|
||||||
) =>
|
) =>
|
||||||
prepareTruncatedMemoryAndAst(
|
prepareTruncatedMemoryAndAst(
|
||||||
@ -1198,7 +1199,7 @@ export class SceneEntities {
|
|||||||
sketchPathToNode: PathToNode
|
sketchPathToNode: PathToNode
|
||||||
intersects: Intersection<Object3D<Object3DEventMap>>[]
|
intersects: Intersection<Object3D<Object3DEventMap>>[]
|
||||||
draftInfo?: {
|
draftInfo?: {
|
||||||
truncatedAst: Program
|
truncatedAst: UnboxedNode<Program>
|
||||||
programMemoryOverride: ProgramMemory
|
programMemoryOverride: ProgramMemory
|
||||||
variableDeclarationName: string
|
variableDeclarationName: string
|
||||||
}
|
}
|
||||||
@ -1234,7 +1235,7 @@ export class SceneEntities {
|
|||||||
const dragTo: [number, number] = [intersection2d.x, intersection2d.y]
|
const dragTo: [number, number] = [intersection2d.x, intersection2d.y]
|
||||||
let modifiedAst = draftInfo ? draftInfo.truncatedAst : { ...kclManager.ast }
|
let modifiedAst = draftInfo ? draftInfo.truncatedAst : { ...kclManager.ast }
|
||||||
|
|
||||||
const _node = getNodeFromPath<CallExpression>(
|
const _node = getNodeFromPath<UnboxedNode<CallExpression>>(
|
||||||
modifiedAst,
|
modifiedAst,
|
||||||
pathToNode,
|
pathToNode,
|
||||||
'CallExpression'
|
'CallExpression'
|
||||||
@ -1246,7 +1247,7 @@ export class SceneEntities {
|
|||||||
|
|
||||||
let modded:
|
let modded:
|
||||||
| {
|
| {
|
||||||
modifiedAst: Program
|
modifiedAst: UnboxedNode<Program>
|
||||||
pathToNode: PathToNode
|
pathToNode: PathToNode
|
||||||
}
|
}
|
||||||
| Error
|
| Error
|
||||||
@ -1541,7 +1542,7 @@ export class SceneEntities {
|
|||||||
if (parent?.userData?.pathToNode) {
|
if (parent?.userData?.pathToNode) {
|
||||||
const updatedAst = parse(recast(kclManager.ast))
|
const updatedAst = parse(recast(kclManager.ast))
|
||||||
if (trap(updatedAst)) return
|
if (trap(updatedAst)) return
|
||||||
const _node = getNodeFromPath<CallExpression>(
|
const _node = getNodeFromPath<UnboxedNode<CallExpression>>(
|
||||||
updatedAst,
|
updatedAst,
|
||||||
parent.userData.pathToNode,
|
parent.userData.pathToNode,
|
||||||
'CallExpression'
|
'CallExpression'
|
||||||
@ -1676,12 +1677,12 @@ export type DefaultPlaneStr = 'XY' | 'XZ' | 'YZ' | '-XY' | '-XZ' | '-YZ'
|
|||||||
|
|
||||||
function prepareTruncatedMemoryAndAst(
|
function prepareTruncatedMemoryAndAst(
|
||||||
sketchPathToNode: PathToNode,
|
sketchPathToNode: PathToNode,
|
||||||
ast: Program,
|
ast: UnboxedNode<Program>,
|
||||||
programMemory: ProgramMemory,
|
programMemory: ProgramMemory,
|
||||||
draftSegment?: DraftSegment
|
draftSegment?: DraftSegment
|
||||||
):
|
):
|
||||||
| {
|
| {
|
||||||
truncatedAst: Program
|
truncatedAst: UnboxedNode<Program>
|
||||||
programMemoryOverride: ProgramMemory
|
programMemoryOverride: ProgramMemory
|
||||||
variableDeclarationName: string
|
variableDeclarationName: string
|
||||||
}
|
}
|
||||||
@ -1689,7 +1690,7 @@ function prepareTruncatedMemoryAndAst(
|
|||||||
const bodyIndex = Number(sketchPathToNode?.[1]?.[0]) || 0
|
const bodyIndex = Number(sketchPathToNode?.[1]?.[0]) || 0
|
||||||
const _ast = structuredClone(ast)
|
const _ast = structuredClone(ast)
|
||||||
|
|
||||||
const _node = getNodeFromPath<VariableDeclaration>(
|
const _node = getNodeFromPath<UnboxedNode<VariableDeclaration>>(
|
||||||
_ast,
|
_ast,
|
||||||
sketchPathToNode || [],
|
sketchPathToNode || [],
|
||||||
'VariableDeclaration'
|
'VariableDeclaration'
|
||||||
@ -1739,15 +1740,15 @@ function prepareTruncatedMemoryAndAst(
|
|||||||
).body.slice(-1)[0].start = lastPipeItem.start
|
).body.slice(-1)[0].start = lastPipeItem.start
|
||||||
|
|
||||||
_ast.end = lastPipeItem.end
|
_ast.end = lastPipeItem.end
|
||||||
const varDec = _ast.body[bodyIndex] as VariableDeclaration
|
const varDec = _ast.body[bodyIndex] as UnboxedNode<VariableDeclaration>
|
||||||
varDec.end = lastPipeItem.end
|
varDec.end = lastPipeItem.end
|
||||||
const declarator = varDec.declarations[0]
|
const declarator = varDec.declarations[0]
|
||||||
declarator.end = lastPipeItem.end
|
declarator.end = lastPipeItem.end
|
||||||
const init = declarator.init as PipeExpression
|
const init = declarator.init as UnboxedNode<PipeExpression>
|
||||||
init.end = lastPipeItem.end
|
init.end = lastPipeItem.end
|
||||||
init.body.slice(-1)[0].end = lastPipeItem.end
|
init.body.slice(-1)[0].end = lastPipeItem.end
|
||||||
}
|
}
|
||||||
const truncatedAst: Program = {
|
const truncatedAst: UnboxedNode<Program> = {
|
||||||
..._ast,
|
..._ast,
|
||||||
body: [structuredClone(_ast.body[bodyIndex])],
|
body: [structuredClone(_ast.body[bodyIndex])],
|
||||||
}
|
}
|
||||||
|
@ -84,6 +84,7 @@ import {
|
|||||||
import { submitAndAwaitTextToKcl } from 'lib/textToCad'
|
import { submitAndAwaitTextToKcl } from 'lib/textToCad'
|
||||||
import { useFileContext } from 'hooks/useFileContext'
|
import { useFileContext } from 'hooks/useFileContext'
|
||||||
import { uuidv4 } from 'lib/utils'
|
import { uuidv4 } from 'lib/utils'
|
||||||
|
import { UnboxedNode } from 'wasm-lib/kcl/bindings/UnboxedNode'
|
||||||
|
|
||||||
type MachineContext<T extends AnyStateMachine> = {
|
type MachineContext<T extends AnyStateMachine> = {
|
||||||
state: StateFrom<T>
|
state: StateFrom<T>
|
||||||
@ -939,7 +940,7 @@ export const ModelingMachineProvider = ({
|
|||||||
})
|
})
|
||||||
let parsed = parse(recast(kclManager.ast))
|
let parsed = parse(recast(kclManager.ast))
|
||||||
if (trap(parsed)) return Promise.reject(parsed)
|
if (trap(parsed)) return Promise.reject(parsed)
|
||||||
parsed = parsed as Program
|
parsed = parsed as UnboxedNode<Program>
|
||||||
|
|
||||||
const { modifiedAst: _modifiedAst, pathToReplacedNode } =
|
const { modifiedAst: _modifiedAst, pathToReplacedNode } =
|
||||||
moveValueIntoNewVariablePath(
|
moveValueIntoNewVariablePath(
|
||||||
@ -950,7 +951,7 @@ export const ModelingMachineProvider = ({
|
|||||||
)
|
)
|
||||||
parsed = parse(recast(_modifiedAst))
|
parsed = parse(recast(_modifiedAst))
|
||||||
if (trap(parsed)) return Promise.reject(parsed)
|
if (trap(parsed)) return Promise.reject(parsed)
|
||||||
parsed = parsed as Program
|
parsed = parsed as UnboxedNode<Program>
|
||||||
if (!pathToReplacedNode)
|
if (!pathToReplacedNode)
|
||||||
return Promise.reject(new Error('No path to replaced node'))
|
return Promise.reject(new Error('No path to replaced node'))
|
||||||
|
|
||||||
|
@ -14,6 +14,7 @@ import {
|
|||||||
import { TransformInfo } from 'lang/std/stdTypes'
|
import { TransformInfo } from 'lang/std/stdTypes'
|
||||||
import { kclManager } from 'lib/singletons'
|
import { kclManager } from 'lib/singletons'
|
||||||
import { err } from 'lib/trap'
|
import { err } from 'lib/trap'
|
||||||
|
import { UnboxedNode } from 'wasm-lib/kcl/bindings/UnboxedNode'
|
||||||
|
|
||||||
export function setEqualLengthInfo({
|
export function setEqualLengthInfo({
|
||||||
selectionRanges,
|
selectionRanges,
|
||||||
@ -86,7 +87,7 @@ export function applyConstraintEqualLength({
|
|||||||
selectionRanges: Selections
|
selectionRanges: Selections
|
||||||
}):
|
}):
|
||||||
| {
|
| {
|
||||||
modifiedAst: Program
|
modifiedAst: UnboxedNode<Program>
|
||||||
pathToNodeMap: PathToNodeMap
|
pathToNodeMap: PathToNodeMap
|
||||||
}
|
}
|
||||||
| Error {
|
| Error {
|
||||||
|
@ -13,6 +13,7 @@ import {
|
|||||||
import { TransformInfo } from 'lang/std/stdTypes'
|
import { TransformInfo } from 'lang/std/stdTypes'
|
||||||
import { kclManager } from 'lib/singletons'
|
import { kclManager } from 'lib/singletons'
|
||||||
import { err } from 'lib/trap'
|
import { err } from 'lib/trap'
|
||||||
|
import { UnboxedNode } from 'wasm-lib/kcl/bindings/UnboxedNode'
|
||||||
|
|
||||||
export function horzVertInfo(
|
export function horzVertInfo(
|
||||||
selectionRanges: Selections,
|
selectionRanges: Selections,
|
||||||
@ -55,11 +56,11 @@ export function horzVertInfo(
|
|||||||
export function applyConstraintHorzVert(
|
export function applyConstraintHorzVert(
|
||||||
selectionRanges: Selections,
|
selectionRanges: Selections,
|
||||||
horOrVert: 'vertical' | 'horizontal',
|
horOrVert: 'vertical' | 'horizontal',
|
||||||
ast: Program,
|
ast: UnboxedNode<Program>,
|
||||||
programMemory: ProgramMemory
|
programMemory: ProgramMemory
|
||||||
):
|
):
|
||||||
| {
|
| {
|
||||||
modifiedAst: Program
|
modifiedAst: UnboxedNode<Program>
|
||||||
pathToNodeMap: PathToNodeMap
|
pathToNodeMap: PathToNodeMap
|
||||||
}
|
}
|
||||||
| Error {
|
| Error {
|
||||||
|
@ -19,6 +19,7 @@ import { createVariableDeclaration } from '../../lang/modifyAst'
|
|||||||
import { removeDoubleNegatives } from '../AvailableVarsHelpers'
|
import { removeDoubleNegatives } from '../AvailableVarsHelpers'
|
||||||
import { kclManager } from 'lib/singletons'
|
import { kclManager } from 'lib/singletons'
|
||||||
import { err } from 'lib/trap'
|
import { err } from 'lib/trap'
|
||||||
|
import { UnboxedNode } from 'wasm-lib/kcl/bindings/UnboxedNode'
|
||||||
|
|
||||||
const getModalInfo = createInfoModal(GetInfoModal)
|
const getModalInfo = createInfoModal(GetInfoModal)
|
||||||
|
|
||||||
@ -136,7 +137,7 @@ export async function applyConstraintIntersect({
|
|||||||
}: {
|
}: {
|
||||||
selectionRanges: Selections
|
selectionRanges: Selections
|
||||||
}): Promise<{
|
}): Promise<{
|
||||||
modifiedAst: Program
|
modifiedAst: UnboxedNode<Program>
|
||||||
pathToNodeMap: PathToNodeMap
|
pathToNodeMap: PathToNodeMap
|
||||||
}> {
|
}> {
|
||||||
const info = intersectInfo({
|
const info = intersectInfo({
|
||||||
|
@ -13,6 +13,7 @@ import {
|
|||||||
import { TransformInfo } from 'lang/std/stdTypes'
|
import { TransformInfo } from 'lang/std/stdTypes'
|
||||||
import { kclManager } from 'lib/singletons'
|
import { kclManager } from 'lib/singletons'
|
||||||
import { err } from 'lib/trap'
|
import { err } from 'lib/trap'
|
||||||
|
import { UnboxedNode } from 'wasm-lib/kcl/bindings/UnboxedNode'
|
||||||
|
|
||||||
export function removeConstrainingValuesInfo({
|
export function removeConstrainingValuesInfo({
|
||||||
selectionRanges,
|
selectionRanges,
|
||||||
@ -77,7 +78,7 @@ export function applyRemoveConstrainingValues({
|
|||||||
pathToNodes?: Array<PathToNode>
|
pathToNodes?: Array<PathToNode>
|
||||||
}):
|
}):
|
||||||
| {
|
| {
|
||||||
modifiedAst: Program
|
modifiedAst: UnboxedNode<Program>
|
||||||
pathToNodeMap: PathToNodeMap
|
pathToNodeMap: PathToNodeMap
|
||||||
}
|
}
|
||||||
| Error {
|
| Error {
|
||||||
|
@ -23,6 +23,7 @@ import {
|
|||||||
import { removeDoubleNegatives } from '../AvailableVarsHelpers'
|
import { removeDoubleNegatives } from '../AvailableVarsHelpers'
|
||||||
import { kclManager } from 'lib/singletons'
|
import { kclManager } from 'lib/singletons'
|
||||||
import { err } from 'lib/trap'
|
import { err } from 'lib/trap'
|
||||||
|
import { UnboxedNode } from 'wasm-lib/kcl/bindings/UnboxedNode'
|
||||||
|
|
||||||
const getModalInfo = createSetAngleLengthModal(SetAngleLengthModal)
|
const getModalInfo = createSetAngleLengthModal(SetAngleLengthModal)
|
||||||
|
|
||||||
@ -161,7 +162,7 @@ export function applyConstraintAxisAlign({
|
|||||||
constraint: 'snapToYAxis' | 'snapToXAxis'
|
constraint: 'snapToYAxis' | 'snapToXAxis'
|
||||||
}):
|
}):
|
||||||
| {
|
| {
|
||||||
modifiedAst: Program
|
modifiedAst: UnboxedNode<Program>
|
||||||
pathToNodeMap: PathToNodeMap
|
pathToNodeMap: PathToNodeMap
|
||||||
}
|
}
|
||||||
| Error {
|
| Error {
|
||||||
|
@ -18,6 +18,7 @@ import { removeDoubleNegatives } from '../AvailableVarsHelpers'
|
|||||||
import { kclManager } from 'lib/singletons'
|
import { kclManager } from 'lib/singletons'
|
||||||
import { Selections } from 'lib/selections'
|
import { Selections } from 'lib/selections'
|
||||||
import { cleanErrs, err } from 'lib/trap'
|
import { cleanErrs, err } from 'lib/trap'
|
||||||
|
import { UnboxedNode } from 'wasm-lib/kcl/bindings/UnboxedNode'
|
||||||
|
|
||||||
const getModalInfo = createInfoModal(GetInfoModal)
|
const getModalInfo = createInfoModal(GetInfoModal)
|
||||||
|
|
||||||
@ -185,7 +186,7 @@ export function applyConstraintHorzVertAlign({
|
|||||||
constraint: 'setHorzDistance' | 'setVertDistance'
|
constraint: 'setHorzDistance' | 'setVertDistance'
|
||||||
}):
|
}):
|
||||||
| {
|
| {
|
||||||
modifiedAst: Program
|
modifiedAst: UnboxedNode<Program>
|
||||||
pathToNodeMap: PathToNodeMap
|
pathToNodeMap: PathToNodeMap
|
||||||
}
|
}
|
||||||
| Error {
|
| Error {
|
||||||
|
@ -21,9 +21,10 @@ import {
|
|||||||
import { getNodeFromPath } from './queryAst'
|
import { getNodeFromPath } from './queryAst'
|
||||||
import { codeManager, editorManager, sceneInfra } from 'lib/singletons'
|
import { codeManager, editorManager, sceneInfra } from 'lib/singletons'
|
||||||
import { Diagnostic } from '@codemirror/lint'
|
import { Diagnostic } from '@codemirror/lint'
|
||||||
|
import { UnboxedNode } from 'wasm-lib/kcl/bindings/UnboxedNode'
|
||||||
|
|
||||||
interface ExecuteArgs {
|
interface ExecuteArgs {
|
||||||
ast?: Program
|
ast?: UnboxedNode<Program>
|
||||||
zoomToFit?: boolean
|
zoomToFit?: boolean
|
||||||
executionId?: number
|
executionId?: number
|
||||||
zoomOnRangeAndType?: {
|
zoomOnRangeAndType?: {
|
||||||
@ -33,13 +34,13 @@ interface ExecuteArgs {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export class KclManager {
|
export class KclManager {
|
||||||
private _ast: Program = {
|
private _ast: UnboxedNode<Program> = {
|
||||||
body: [],
|
body: [],
|
||||||
start: 0,
|
start: 0,
|
||||||
end: 0,
|
end: 0,
|
||||||
nonCodeMeta: {
|
nonCodeMeta: {
|
||||||
nonCodeNodes: {},
|
nonCodeNodes: {},
|
||||||
start: [],
|
startNodes: [],
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
private _execState: ExecState = emptyExecState()
|
private _execState: ExecState = emptyExecState()
|
||||||
@ -55,7 +56,7 @@ export class KclManager {
|
|||||||
engineCommandManager: EngineCommandManager
|
engineCommandManager: EngineCommandManager
|
||||||
|
|
||||||
private _isExecutingCallback: (arg: boolean) => void = () => {}
|
private _isExecutingCallback: (arg: boolean) => void = () => {}
|
||||||
private _astCallBack: (arg: Program) => void = () => {}
|
private _astCallBack: (arg: UnboxedNode<Program>) => void = () => {}
|
||||||
private _programMemoryCallBack: (arg: ProgramMemory) => void = () => {}
|
private _programMemoryCallBack: (arg: ProgramMemory) => void = () => {}
|
||||||
private _logsCallBack: (arg: string[]) => void = () => {}
|
private _logsCallBack: (arg: string[]) => void = () => {}
|
||||||
private _kclErrorsCallBack: (arg: KCLError[]) => void = () => {}
|
private _kclErrorsCallBack: (arg: KCLError[]) => void = () => {}
|
||||||
@ -181,7 +182,7 @@ export class KclManager {
|
|||||||
setWasmInitFailed,
|
setWasmInitFailed,
|
||||||
}: {
|
}: {
|
||||||
setProgramMemory: (arg: ProgramMemory) => void
|
setProgramMemory: (arg: ProgramMemory) => void
|
||||||
setAst: (arg: Program) => void
|
setAst: (arg: UnboxedNode<Program>) => void
|
||||||
setLogs: (arg: string[]) => void
|
setLogs: (arg: string[]) => void
|
||||||
setKclErrors: (arg: KCLError[]) => void
|
setKclErrors: (arg: KCLError[]) => void
|
||||||
setIsExecuting: (arg: boolean) => void
|
setIsExecuting: (arg: boolean) => void
|
||||||
@ -205,12 +206,12 @@ export class KclManager {
|
|||||||
end: 0,
|
end: 0,
|
||||||
nonCodeMeta: {
|
nonCodeMeta: {
|
||||||
nonCodeNodes: {},
|
nonCodeNodes: {},
|
||||||
start: [],
|
startNodes: [],
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
safeParse(code: string): Program | null {
|
safeParse(code: string): UnboxedNode<Program> | null {
|
||||||
const ast = parse(code)
|
const ast = parse(code)
|
||||||
this.lints = []
|
this.lints = []
|
||||||
this.kclErrors = []
|
this.kclErrors = []
|
||||||
@ -377,7 +378,7 @@ export class KclManager {
|
|||||||
Array.from(this.engineCommandManager.artifactGraph).forEach(
|
Array.from(this.engineCommandManager.artifactGraph).forEach(
|
||||||
([commandId, artifact]) => {
|
([commandId, artifact]) => {
|
||||||
if (!('codeRef' in artifact)) return
|
if (!('codeRef' in artifact)) return
|
||||||
const _node1 = getNodeFromPath<CallExpression>(
|
const _node1 = getNodeFromPath<UnboxedNode<CallExpression>>(
|
||||||
this.ast,
|
this.ast,
|
||||||
artifact.codeRef.pathToNode,
|
artifact.codeRef.pathToNode,
|
||||||
'CallExpression'
|
'CallExpression'
|
||||||
@ -441,7 +442,7 @@ export class KclManager {
|
|||||||
// but should probably have think about which of the function to keep
|
// 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.
|
// This always updates the code state and editor and writes to the file system.
|
||||||
async updateAst(
|
async updateAst(
|
||||||
ast: Program,
|
ast: UnboxedNode<Program>,
|
||||||
execute: boolean,
|
execute: boolean,
|
||||||
optionalParams?: {
|
optionalParams?: {
|
||||||
focusPath?: Array<PathToNode>
|
focusPath?: Array<PathToNode>
|
||||||
@ -452,7 +453,7 @@ export class KclManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
): Promise<{
|
): Promise<{
|
||||||
newAst: Program
|
newAst: UnboxedNode<Program>
|
||||||
selections?: Selections
|
selections?: Selections
|
||||||
}> {
|
}> {
|
||||||
const newCode = recast(ast)
|
const newCode = recast(ast)
|
||||||
@ -588,7 +589,7 @@ export class KclManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Determines if there is no KCL code which means it is executing a blank KCL file
|
// Determines if there is no KCL code which means it is executing a blank KCL file
|
||||||
_isAstEmpty(ast: Program) {
|
_isAstEmpty(ast: UnboxedNode<Program>) {
|
||||||
return ast.start === 0 && ast.end === 0 && ast.body.length === 0
|
return ast.start === 0 && ast.end === 0 && ast.body.length === 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,6 +12,7 @@ import { EngineCommandManager } from 'lang/std/engineConnection'
|
|||||||
import { KCLError } from 'lang/errors'
|
import { KCLError } from 'lang/errors'
|
||||||
import { Diagnostic } from '@codemirror/lint'
|
import { Diagnostic } from '@codemirror/lint'
|
||||||
import { IdGenerator } from 'wasm-lib/kcl/bindings/IdGenerator'
|
import { IdGenerator } from 'wasm-lib/kcl/bindings/IdGenerator'
|
||||||
|
import { UnboxedNode } from 'wasm-lib/kcl/bindings/UnboxedNode'
|
||||||
|
|
||||||
export type ToolTip =
|
export type ToolTip =
|
||||||
| 'lineTo'
|
| 'lineTo'
|
||||||
@ -52,7 +53,7 @@ export async function executeAst({
|
|||||||
programMemoryOverride,
|
programMemoryOverride,
|
||||||
idGenerator,
|
idGenerator,
|
||||||
}: {
|
}: {
|
||||||
ast: Program
|
ast: UnboxedNode<Program>
|
||||||
engineCommandManager: EngineCommandManager
|
engineCommandManager: EngineCommandManager
|
||||||
useFakeExecutor?: boolean
|
useFakeExecutor?: boolean
|
||||||
programMemoryOverride?: ProgramMemory
|
programMemoryOverride?: ProgramMemory
|
||||||
|
@ -21,6 +21,7 @@ import { enginelessExecutor } from '../lib/testHelpers'
|
|||||||
import { findUsesOfTagInPipe, getNodePathFromSourceRange } from './queryAst'
|
import { findUsesOfTagInPipe, getNodePathFromSourceRange } from './queryAst'
|
||||||
import { err } from 'lib/trap'
|
import { err } from 'lib/trap'
|
||||||
import { SimplifiedArgDetails } from './std/stdTypes'
|
import { SimplifiedArgDetails } from './std/stdTypes'
|
||||||
|
import { UnboxedNode } from 'wasm-lib/kcl/bindings/UnboxedNode'
|
||||||
|
|
||||||
beforeAll(async () => {
|
beforeAll(async () => {
|
||||||
await initPromise
|
await initPromise
|
||||||
@ -109,7 +110,7 @@ describe('Testing findUniqueName', () => {
|
|||||||
{ type: 'Identifier', name: 'yo07', start: 0, end: 0 },
|
{ type: 'Identifier', name: 'yo07', start: 0, end: 0 },
|
||||||
{ type: 'Identifier', name: 'yo08', start: 0, end: 0 },
|
{ type: 'Identifier', name: 'yo08', start: 0, end: 0 },
|
||||||
{ type: 'Identifier', name: 'yo09', start: 0, end: 0 },
|
{ type: 'Identifier', name: 'yo09', start: 0, end: 0 },
|
||||||
] satisfies Identifier[]),
|
] satisfies UnboxedNode<Identifier>[]),
|
||||||
'yo',
|
'yo',
|
||||||
2
|
2
|
||||||
)
|
)
|
||||||
@ -123,7 +124,7 @@ describe('Testing addSketchTo', () => {
|
|||||||
body: [],
|
body: [],
|
||||||
start: 0,
|
start: 0,
|
||||||
end: 0,
|
end: 0,
|
||||||
nonCodeMeta: { nonCodeNodes: {}, start: [] },
|
nonCodeMeta: { nonCodeNodes: {}, startNodes: [] },
|
||||||
},
|
},
|
||||||
'yz'
|
'yz'
|
||||||
)
|
)
|
||||||
|
@ -42,12 +42,13 @@ import { SimplifiedArgDetails } from './std/stdTypes'
|
|||||||
import { TagDeclarator } from 'wasm-lib/kcl/bindings/TagDeclarator'
|
import { TagDeclarator } from 'wasm-lib/kcl/bindings/TagDeclarator'
|
||||||
import { Models } from '@kittycad/lib'
|
import { Models } from '@kittycad/lib'
|
||||||
import { ExtrudeFacePlane } from 'machines/modelingMachine'
|
import { ExtrudeFacePlane } from 'machines/modelingMachine'
|
||||||
|
import { UnboxedNode } from 'wasm-lib/kcl/bindings/UnboxedNode'
|
||||||
|
|
||||||
export function startSketchOnDefault(
|
export function startSketchOnDefault(
|
||||||
node: Program,
|
node: UnboxedNode<Program>,
|
||||||
axis: DefaultPlaneStr,
|
axis: DefaultPlaneStr,
|
||||||
name = ''
|
name = ''
|
||||||
): { modifiedAst: Program; id: string; pathToNode: PathToNode } {
|
): { modifiedAst: UnboxedNode<Program>; id: string; pathToNode: PathToNode } {
|
||||||
const _node = { ...node }
|
const _node = { ...node }
|
||||||
const _name =
|
const _name =
|
||||||
name || findUniqueName(node, KCL_DEFAULT_CONSTANT_PREFIXES.SKETCH)
|
name || findUniqueName(node, KCL_DEFAULT_CONSTANT_PREFIXES.SKETCH)
|
||||||
@ -76,10 +77,10 @@ export function startSketchOnDefault(
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function addStartProfileAt(
|
export function addStartProfileAt(
|
||||||
node: Program,
|
node: UnboxedNode<Program>,
|
||||||
pathToNode: PathToNode,
|
pathToNode: PathToNode,
|
||||||
at: [number, number]
|
at: [number, number]
|
||||||
): { modifiedAst: Program; pathToNode: PathToNode } | Error {
|
): { modifiedAst: UnboxedNode<Program>; pathToNode: PathToNode } | Error {
|
||||||
const _node1 = getNodeFromPath<VariableDeclaration>(
|
const _node1 = getNodeFromPath<VariableDeclaration>(
|
||||||
node,
|
node,
|
||||||
pathToNode,
|
pathToNode,
|
||||||
@ -114,7 +115,7 @@ export function addStartProfileAt(
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function addSketchTo(
|
export function addSketchTo(
|
||||||
node: Program,
|
node: UnboxedNode<Program>,
|
||||||
axis: 'xy' | 'xz' | 'yz',
|
axis: 'xy' | 'xz' | 'yz',
|
||||||
name = ''
|
name = ''
|
||||||
): { modifiedAst: Program; id: string; pathToNode: PathToNode } {
|
): { modifiedAst: Program; id: string; pathToNode: PathToNode } {
|
||||||
@ -210,7 +211,7 @@ export function mutateArrExp(node: Expr, updateWith: ArrayExpression): boolean {
|
|||||||
|
|
||||||
export function mutateObjExpProp(
|
export function mutateObjExpProp(
|
||||||
node: Expr,
|
node: Expr,
|
||||||
updateWith: Literal | ArrayExpression,
|
updateWith: UnboxedNode<Literal> | UnboxedNode<ArrayExpression>,
|
||||||
key: string
|
key: string
|
||||||
): boolean {
|
): boolean {
|
||||||
if (node.type === 'ObjectExpression') {
|
if (node.type === 'ObjectExpression') {
|
||||||
@ -248,13 +249,13 @@ export function mutateObjExpProp(
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function extrudeSketch(
|
export function extrudeSketch(
|
||||||
node: Program,
|
node: UnboxedNode<Program>,
|
||||||
pathToNode: PathToNode,
|
pathToNode: PathToNode,
|
||||||
shouldPipe = false,
|
shouldPipe = false,
|
||||||
distance: Expr = createLiteral(4)
|
distance: Expr = createLiteral(4)
|
||||||
):
|
):
|
||||||
| {
|
| {
|
||||||
modifiedAst: Program
|
modifiedAst: UnboxedNode<Program>
|
||||||
pathToNode: PathToNode
|
pathToNode: PathToNode
|
||||||
pathToExtrudeArg: PathToNode
|
pathToExtrudeArg: PathToNode
|
||||||
}
|
}
|
||||||
@ -343,13 +344,13 @@ export function extrudeSketch(
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function revolveSketch(
|
export function revolveSketch(
|
||||||
node: Program,
|
node: UnboxedNode<Program>,
|
||||||
pathToNode: PathToNode,
|
pathToNode: PathToNode,
|
||||||
shouldPipe = false,
|
shouldPipe = false,
|
||||||
angle: Expr = createLiteral(4)
|
angle: Expr = createLiteral(4)
|
||||||
):
|
):
|
||||||
| {
|
| {
|
||||||
modifiedAst: Program
|
modifiedAst: UnboxedNode<Program>
|
||||||
pathToNode: PathToNode
|
pathToNode: PathToNode
|
||||||
pathToRevolveArg: PathToNode
|
pathToRevolveArg: PathToNode
|
||||||
}
|
}
|
||||||
@ -439,7 +440,7 @@ export function revolveSketch(
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function sketchOnExtrudedFace(
|
export function sketchOnExtrudedFace(
|
||||||
node: Program,
|
node: UnboxedNode<Program>,
|
||||||
sketchPathToNode: PathToNode,
|
sketchPathToNode: PathToNode,
|
||||||
extrudePathToNode: PathToNode,
|
extrudePathToNode: PathToNode,
|
||||||
info: ExtrudeFacePlane['faceInfo'] = { type: 'wall' }
|
info: ExtrudeFacePlane['faceInfo'] = { type: 'wall' }
|
||||||
@ -571,7 +572,7 @@ export function splitPathAtPipeExpression(pathToNode: PathToNode): {
|
|||||||
return splitPathAtPipeExpression(pathToNode.slice(0, -1))
|
return splitPathAtPipeExpression(pathToNode.slice(0, -1))
|
||||||
}
|
}
|
||||||
|
|
||||||
export function createLiteral(value: string | number): Literal {
|
export function createLiteral(value: string | number): UnboxedNode<Literal> {
|
||||||
return {
|
return {
|
||||||
type: 'Literal',
|
type: 'Literal',
|
||||||
start: 0,
|
start: 0,
|
||||||
@ -581,7 +582,7 @@ export function createLiteral(value: string | number): Literal {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function createTagDeclarator(value: string): TagDeclarator {
|
export function createTagDeclarator(value: string): UnboxedNode<TagDeclarator> {
|
||||||
return {
|
return {
|
||||||
type: 'TagDeclarator',
|
type: 'TagDeclarator',
|
||||||
start: 0,
|
start: 0,
|
||||||
@ -591,7 +592,7 @@ export function createTagDeclarator(value: string): TagDeclarator {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function createIdentifier(name: string): Identifier {
|
export function createIdentifier(name: string): UnboxedNode<Identifier> {
|
||||||
return {
|
return {
|
||||||
type: 'Identifier',
|
type: 'Identifier',
|
||||||
start: 0,
|
start: 0,
|
||||||
@ -601,7 +602,7 @@ export function createIdentifier(name: string): Identifier {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function createPipeSubstitution(): PipeSubstitution {
|
export function createPipeSubstitution(): UnboxedNode<PipeSubstitution> {
|
||||||
return {
|
return {
|
||||||
type: 'PipeSubstitution',
|
type: 'PipeSubstitution',
|
||||||
start: 0,
|
start: 0,
|
||||||
@ -612,7 +613,7 @@ export function createPipeSubstitution(): PipeSubstitution {
|
|||||||
export function createCallExpressionStdLib(
|
export function createCallExpressionStdLib(
|
||||||
name: string,
|
name: string,
|
||||||
args: CallExpression['arguments']
|
args: CallExpression['arguments']
|
||||||
): CallExpression {
|
): UnboxedNode<CallExpression> {
|
||||||
return {
|
return {
|
||||||
type: 'CallExpression',
|
type: 'CallExpression',
|
||||||
start: 0,
|
start: 0,
|
||||||
@ -632,7 +633,7 @@ export function createCallExpressionStdLib(
|
|||||||
export function createCallExpression(
|
export function createCallExpression(
|
||||||
name: string,
|
name: string,
|
||||||
args: CallExpression['arguments']
|
args: CallExpression['arguments']
|
||||||
): CallExpression {
|
): UnboxedNode<CallExpression> {
|
||||||
return {
|
return {
|
||||||
type: 'CallExpression',
|
type: 'CallExpression',
|
||||||
start: 0,
|
start: 0,
|
||||||
@ -651,7 +652,7 @@ export function createCallExpression(
|
|||||||
|
|
||||||
export function createArrayExpression(
|
export function createArrayExpression(
|
||||||
elements: ArrayExpression['elements']
|
elements: ArrayExpression['elements']
|
||||||
): ArrayExpression {
|
): UnboxedNode<ArrayExpression> {
|
||||||
return {
|
return {
|
||||||
type: 'ArrayExpression',
|
type: 'ArrayExpression',
|
||||||
start: 0,
|
start: 0,
|
||||||
@ -664,7 +665,7 @@ export function createArrayExpression(
|
|||||||
|
|
||||||
export function createPipeExpression(
|
export function createPipeExpression(
|
||||||
body: PipeExpression['body']
|
body: PipeExpression['body']
|
||||||
): PipeExpression {
|
): UnboxedNode<PipeExpression> {
|
||||||
return {
|
return {
|
||||||
type: 'PipeExpression',
|
type: 'PipeExpression',
|
||||||
start: 0,
|
start: 0,
|
||||||
@ -680,7 +681,7 @@ export function createVariableDeclaration(
|
|||||||
init: VariableDeclarator['init'],
|
init: VariableDeclarator['init'],
|
||||||
visibility: VariableDeclaration['visibility'] = 'default',
|
visibility: VariableDeclaration['visibility'] = 'default',
|
||||||
kind: VariableDeclaration['kind'] = 'const'
|
kind: VariableDeclaration['kind'] = 'const'
|
||||||
): VariableDeclaration {
|
): UnboxedNode<VariableDeclaration> {
|
||||||
return {
|
return {
|
||||||
type: 'VariableDeclaration',
|
type: 'VariableDeclaration',
|
||||||
start: 0,
|
start: 0,
|
||||||
@ -703,7 +704,7 @@ export function createVariableDeclaration(
|
|||||||
|
|
||||||
export function createObjectExpression(properties: {
|
export function createObjectExpression(properties: {
|
||||||
[key: string]: Expr
|
[key: string]: Expr
|
||||||
}): ObjectExpression {
|
}): UnboxedNode<ObjectExpression> {
|
||||||
return {
|
return {
|
||||||
type: 'ObjectExpression',
|
type: 'ObjectExpression',
|
||||||
start: 0,
|
start: 0,
|
||||||
@ -724,7 +725,7 @@ export function createObjectExpression(properties: {
|
|||||||
export function createUnaryExpression(
|
export function createUnaryExpression(
|
||||||
argument: UnaryExpression['argument'],
|
argument: UnaryExpression['argument'],
|
||||||
operator: UnaryExpression['operator'] = '-'
|
operator: UnaryExpression['operator'] = '-'
|
||||||
): UnaryExpression {
|
): UnboxedNode<UnaryExpression> {
|
||||||
return {
|
return {
|
||||||
type: 'UnaryExpression',
|
type: 'UnaryExpression',
|
||||||
start: 0,
|
start: 0,
|
||||||
@ -739,7 +740,7 @@ export function createBinaryExpression([left, operator, right]: [
|
|||||||
BinaryExpression['left'],
|
BinaryExpression['left'],
|
||||||
BinaryExpression['operator'],
|
BinaryExpression['operator'],
|
||||||
BinaryExpression['right']
|
BinaryExpression['right']
|
||||||
]): BinaryExpression {
|
]): UnboxedNode<BinaryExpression> {
|
||||||
return {
|
return {
|
||||||
type: 'BinaryExpression',
|
type: 'BinaryExpression',
|
||||||
start: 0,
|
start: 0,
|
||||||
@ -754,19 +755,19 @@ export function createBinaryExpression([left, operator, right]: [
|
|||||||
export function createBinaryExpressionWithUnary([left, right]: [
|
export function createBinaryExpressionWithUnary([left, right]: [
|
||||||
BinaryExpression['left'],
|
BinaryExpression['left'],
|
||||||
BinaryExpression['right']
|
BinaryExpression['right']
|
||||||
]): BinaryExpression {
|
]): UnboxedNode<BinaryExpression> {
|
||||||
if (right.type === 'UnaryExpression' && right.operator === '-')
|
if (right.type === 'UnaryExpression' && right.operator === '-')
|
||||||
return createBinaryExpression([left, '-', right.argument])
|
return createBinaryExpression([left, '-', right.argument])
|
||||||
return createBinaryExpression([left, '+', right])
|
return createBinaryExpression([left, '+', right])
|
||||||
}
|
}
|
||||||
|
|
||||||
export function giveSketchFnCallTag(
|
export function giveSketchFnCallTag(
|
||||||
ast: Program,
|
ast: UnboxedNode<Program>,
|
||||||
range: Selection['range'],
|
range: Selection['range'],
|
||||||
tag?: string
|
tag?: string
|
||||||
):
|
):
|
||||||
| {
|
| {
|
||||||
modifiedAst: Program
|
modifiedAst: UnboxedNode<Program>
|
||||||
tag: string
|
tag: string
|
||||||
isTagExisting: boolean
|
isTagExisting: boolean
|
||||||
pathToNode: PathToNode
|
pathToNode: PathToNode
|
||||||
@ -801,7 +802,7 @@ export function giveSketchFnCallTag(
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function moveValueIntoNewVariablePath(
|
export function moveValueIntoNewVariablePath(
|
||||||
ast: Program,
|
ast: UnboxedNode<Program>,
|
||||||
programMemory: ProgramMemory,
|
programMemory: ProgramMemory,
|
||||||
pathToNode: PathToNode,
|
pathToNode: PathToNode,
|
||||||
variableName: string
|
variableName: string
|
||||||
@ -834,12 +835,12 @@ export function moveValueIntoNewVariablePath(
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function moveValueIntoNewVariable(
|
export function moveValueIntoNewVariable(
|
||||||
ast: Program,
|
ast: UnboxedNode<Program>,
|
||||||
programMemory: ProgramMemory,
|
programMemory: ProgramMemory,
|
||||||
sourceRange: Selection['range'],
|
sourceRange: Selection['range'],
|
||||||
variableName: string
|
variableName: string
|
||||||
): {
|
): {
|
||||||
modifiedAst: Program
|
modifiedAst: UnboxedNode<Program>
|
||||||
pathToReplacedNode?: PathToNode
|
pathToReplacedNode?: PathToNode
|
||||||
} {
|
} {
|
||||||
const meta = isNodeSafeToReplace(ast, sourceRange)
|
const meta = isNodeSafeToReplace(ast, sourceRange)
|
||||||
@ -872,17 +873,17 @@ export function moveValueIntoNewVariable(
|
|||||||
*/
|
*/
|
||||||
export function deleteSegmentFromPipeExpression(
|
export function deleteSegmentFromPipeExpression(
|
||||||
dependentRanges: SourceRange[],
|
dependentRanges: SourceRange[],
|
||||||
modifiedAst: Program,
|
modifiedAst: UnboxedNode<Program>,
|
||||||
programMemory: ProgramMemory,
|
programMemory: ProgramMemory,
|
||||||
code: string,
|
code: string,
|
||||||
pathToNode: PathToNode
|
pathToNode: PathToNode
|
||||||
): Program | Error {
|
): UnboxedNode<Program> | Error {
|
||||||
let _modifiedAst = structuredClone(modifiedAst)
|
let _modifiedAst = structuredClone(modifiedAst)
|
||||||
|
|
||||||
dependentRanges.forEach((range) => {
|
dependentRanges.forEach((range) => {
|
||||||
const path = getNodePathFromSourceRange(_modifiedAst, range)
|
const path = getNodePathFromSourceRange(_modifiedAst, range)
|
||||||
|
|
||||||
const callExp = getNodeFromPath<CallExpression>(
|
const callExp = getNodeFromPath<UnboxedNode<CallExpression>>(
|
||||||
_modifiedAst,
|
_modifiedAst,
|
||||||
path,
|
path,
|
||||||
'CallExpression',
|
'CallExpression',
|
||||||
@ -928,11 +929,11 @@ export function deleteSegmentFromPipeExpression(
|
|||||||
export function removeSingleConstraintInfo(
|
export function removeSingleConstraintInfo(
|
||||||
pathToCallExp: PathToNode,
|
pathToCallExp: PathToNode,
|
||||||
argDetails: SimplifiedArgDetails,
|
argDetails: SimplifiedArgDetails,
|
||||||
ast: Program,
|
ast: UnboxedNode<Program>,
|
||||||
programMemory: ProgramMemory
|
programMemory: ProgramMemory
|
||||||
):
|
):
|
||||||
| {
|
| {
|
||||||
modifiedAst: Program
|
modifiedAst: UnboxedNode<Program>
|
||||||
pathToNodeMap: PathToNodeMap
|
pathToNodeMap: PathToNodeMap
|
||||||
}
|
}
|
||||||
| false {
|
| false {
|
||||||
@ -954,12 +955,12 @@ export function removeSingleConstraintInfo(
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function deleteFromSelection(
|
export async function deleteFromSelection(
|
||||||
ast: Program,
|
ast: UnboxedNode<Program>,
|
||||||
selection: Selection,
|
selection: Selection,
|
||||||
programMemory: ProgramMemory,
|
programMemory: ProgramMemory,
|
||||||
getFaceDetails: (id: string) => Promise<Models['FaceIsPlanar_type']> = () =>
|
getFaceDetails: (id: string) => Promise<Models['FaceIsPlanar_type']> = () =>
|
||||||
({} as any)
|
({} as any)
|
||||||
): Promise<Program | Error> {
|
): Promise<UnboxedNode<Program> | Error> {
|
||||||
const astClone = structuredClone(ast)
|
const astClone = structuredClone(ast)
|
||||||
const range = selection.range
|
const range = selection.range
|
||||||
const path = getNodePathFromSourceRange(ast, range)
|
const path = getNodePathFromSourceRange(ast, range)
|
||||||
@ -1134,5 +1135,5 @@ export async function deleteFromSelection(
|
|||||||
}
|
}
|
||||||
|
|
||||||
const nonCodeMetaEmpty = () => {
|
const nonCodeMetaEmpty = () => {
|
||||||
return { nonCodeNodes: {}, start: [] }
|
return { nonCodeNodes: {}, startNodes: [], start: 0, end: 0 }
|
||||||
}
|
}
|
||||||
|
@ -36,11 +36,12 @@ import {
|
|||||||
getSweepFromSuspectedPath,
|
getSweepFromSuspectedPath,
|
||||||
} from 'lang/std/artifactGraph'
|
} from 'lang/std/artifactGraph'
|
||||||
import { kclManager, engineCommandManager, editorManager } from 'lib/singletons'
|
import { kclManager, engineCommandManager, editorManager } from 'lib/singletons'
|
||||||
|
import { UnboxedNode } from 'wasm-lib/kcl/bindings/UnboxedNode'
|
||||||
|
|
||||||
// Apply Fillet To Selection
|
// Apply Fillet To Selection
|
||||||
|
|
||||||
export function applyFilletToSelection(
|
export function applyFilletToSelection(
|
||||||
ast: Program,
|
ast: UnboxedNode<Program>,
|
||||||
selection: Selections,
|
selection: Selections,
|
||||||
radius: KclCommandValue
|
radius: KclCommandValue
|
||||||
): void | Error {
|
): void | Error {
|
||||||
@ -55,10 +56,12 @@ export function applyFilletToSelection(
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function modifyAstCloneWithFilletAndTag(
|
export function modifyAstCloneWithFilletAndTag(
|
||||||
ast: Program,
|
ast: UnboxedNode<Program>,
|
||||||
selection: Selections,
|
selection: Selections,
|
||||||
radius: KclCommandValue
|
radius: KclCommandValue
|
||||||
): { modifiedAst: Program; pathToFilletNode: Array<PathToNode> } | Error {
|
):
|
||||||
|
| { modifiedAst: UnboxedNode<Program>; pathToFilletNode: Array<PathToNode> }
|
||||||
|
| Error {
|
||||||
let clonedAst = structuredClone(ast)
|
let clonedAst = structuredClone(ast)
|
||||||
const clonedAstForGetExtrude = structuredClone(ast)
|
const clonedAstForGetExtrude = structuredClone(ast)
|
||||||
|
|
||||||
@ -246,7 +249,7 @@ export function getPathToExtrudeForSegmentSelection(
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function updateAstAndFocus(
|
async function updateAstAndFocus(
|
||||||
modifiedAst: Program,
|
modifiedAst: UnboxedNode<Program>,
|
||||||
pathToFilletNode: Array<PathToNode>
|
pathToFilletNode: Array<PathToNode>
|
||||||
) {
|
) {
|
||||||
const updatedAst = await kclManager.updateAst(modifiedAst, true, {
|
const updatedAst = await kclManager.updateAst(modifiedAst, true, {
|
||||||
@ -258,7 +261,7 @@ async function updateAstAndFocus(
|
|||||||
}
|
}
|
||||||
|
|
||||||
function mutateAstWithTagForSketchSegment(
|
function mutateAstWithTagForSketchSegment(
|
||||||
astClone: Program,
|
astClone: UnboxedNode<Program>,
|
||||||
pathToSegmentNode: PathToNode
|
pathToSegmentNode: PathToNode
|
||||||
): { modifiedAst: Program; tag: string } | Error {
|
): { modifiedAst: Program; tag: string } | Error {
|
||||||
const segmentNode = getNodeFromPath<CallExpression>(
|
const segmentNode = getNodeFromPath<CallExpression>(
|
||||||
@ -292,7 +295,7 @@ function mutateAstWithTagForSketchSegment(
|
|||||||
function getEdgeTagCall(
|
function getEdgeTagCall(
|
||||||
tag: string,
|
tag: string,
|
||||||
selectionType: string
|
selectionType: string
|
||||||
): Identifier | CallExpression {
|
): UnboxedNode<Identifier | CallExpression> {
|
||||||
let tagCall: Expr = createIdentifier(tag)
|
let tagCall: Expr = createIdentifier(tag)
|
||||||
|
|
||||||
// Modify the tag based on selectionType
|
// Modify the tag based on selectionType
|
||||||
@ -426,7 +429,7 @@ export const hasValidFilletSelection = ({
|
|||||||
code,
|
code,
|
||||||
}: {
|
}: {
|
||||||
selectionRanges: Selections
|
selectionRanges: Selections
|
||||||
ast: Program
|
ast: UnboxedNode<Program>
|
||||||
code: string
|
code: string
|
||||||
}) => {
|
}) => {
|
||||||
// check if there is anything filletable in the scene
|
// check if there is anything filletable in the scene
|
||||||
@ -454,7 +457,7 @@ export const hasValidFilletSelection = ({
|
|||||||
for (const selection of selectionRanges.codeBasedSelections) {
|
for (const selection of selectionRanges.codeBasedSelections) {
|
||||||
// check if all selections are in sketchLineHelperMap
|
// check if all selections are in sketchLineHelperMap
|
||||||
const path = getNodePathFromSourceRange(ast, selection.range)
|
const path = getNodePathFromSourceRange(ast, selection.range)
|
||||||
const segmentNode = getNodeFromPath<CallExpression>(
|
const segmentNode = getNodeFromPath<UnboxedNode<CallExpression>>(
|
||||||
ast,
|
ast,
|
||||||
path,
|
path,
|
||||||
'CallExpression'
|
'CallExpression'
|
||||||
@ -534,7 +537,7 @@ export const isTagUsedInFillet = ({
|
|||||||
ast,
|
ast,
|
||||||
callExp,
|
callExp,
|
||||||
}: {
|
}: {
|
||||||
ast: Program
|
ast: UnboxedNode<Program>
|
||||||
callExp: CallExpression
|
callExp: CallExpression
|
||||||
}): Array<EdgeTypes> => {
|
}): Array<EdgeTypes> => {
|
||||||
const tag = getTagFromCallExpression(callExp)
|
const tag = getTagFromCallExpression(callExp)
|
||||||
|
@ -29,6 +29,7 @@ import {
|
|||||||
} from './std/sketchcombos'
|
} from './std/sketchcombos'
|
||||||
import { err } from 'lib/trap'
|
import { err } from 'lib/trap'
|
||||||
import { ImportStatement } from 'wasm-lib/kcl/bindings/ImportStatement'
|
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.
|
* Retrieves a node from a given path within a Program node structure, optionally stopping at a specified node type.
|
||||||
@ -121,12 +122,13 @@ export function getNodeFromPathCurry(
|
|||||||
}
|
}
|
||||||
|
|
||||||
function moreNodePathFromSourceRange(
|
function moreNodePathFromSourceRange(
|
||||||
node:
|
node: UnboxedNode<
|
||||||
| Expr
|
| Expr
|
||||||
| ImportStatement
|
| ImportStatement
|
||||||
| ExpressionStatement
|
| ExpressionStatement
|
||||||
| VariableDeclaration
|
| VariableDeclaration
|
||||||
| ReturnStatement,
|
| ReturnStatement
|
||||||
|
>,
|
||||||
sourceRange: Selection['range'],
|
sourceRange: Selection['range'],
|
||||||
previousPath: PathToNode = [['body', '']]
|
previousPath: PathToNode = [['body', '']]
|
||||||
): PathToNode {
|
): PathToNode {
|
||||||
@ -344,15 +346,16 @@ export function getNodePathFromSourceRange(
|
|||||||
return path
|
return path
|
||||||
}
|
}
|
||||||
|
|
||||||
type KCLNode =
|
type KCLNode = UnboxedNode<
|
||||||
| Expr
|
| Expr
|
||||||
| ExpressionStatement
|
| ExpressionStatement
|
||||||
| VariableDeclaration
|
| VariableDeclaration
|
||||||
| VariableDeclarator
|
| VariableDeclarator
|
||||||
| ReturnStatement
|
| ReturnStatement
|
||||||
|
>
|
||||||
|
|
||||||
export function traverse(
|
export function traverse(
|
||||||
node: KCLNode | Program,
|
node: KCLNode | UnboxedNode<Program>,
|
||||||
option: {
|
option: {
|
||||||
enter?: (node: KCLNode, pathToNode: PathToNode) => void
|
enter?: (node: KCLNode, pathToNode: PathToNode) => void
|
||||||
leave?: (node: KCLNode) => void
|
leave?: (node: KCLNode) => void
|
||||||
@ -512,9 +515,9 @@ export function findAllPreviousVariables(
|
|||||||
}
|
}
|
||||||
|
|
||||||
type ReplacerFn = (
|
type ReplacerFn = (
|
||||||
_ast: Program,
|
_ast: UnboxedNode<Program>,
|
||||||
varName: string
|
varName: string
|
||||||
) => { modifiedAst: Program; pathToReplaced: PathToNode } | Error
|
) => { modifiedAst: UnboxedNode<Program>; pathToReplaced: PathToNode } | Error
|
||||||
|
|
||||||
export function isNodeSafeToReplacePath(
|
export function isNodeSafeToReplacePath(
|
||||||
ast: Program,
|
ast: Program,
|
||||||
@ -583,12 +586,12 @@ export function isNodeSafeToReplacePath(
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function isNodeSafeToReplace(
|
export function isNodeSafeToReplace(
|
||||||
ast: Program,
|
ast: UnboxedNode<Program>,
|
||||||
sourceRange: [number, number]
|
sourceRange: [number, number]
|
||||||
):
|
):
|
||||||
| {
|
| {
|
||||||
isSafe: boolean
|
isSafe: boolean
|
||||||
value: Expr
|
value: UnboxedNode<Expr>
|
||||||
replacer: ReplacerFn
|
replacer: ReplacerFn
|
||||||
}
|
}
|
||||||
| Error {
|
| Error {
|
||||||
@ -837,7 +840,7 @@ export function findUsesOfTagInPipe(
|
|||||||
? String(thirdParam.value)
|
? String(thirdParam.value)
|
||||||
: thirdParam.name
|
: thirdParam.name
|
||||||
|
|
||||||
const varDec = getNodeFromPath<VariableDeclaration>(
|
const varDec = getNodeFromPath<UnboxedNode<VariableDeclaration>>(
|
||||||
ast,
|
ast,
|
||||||
pathToNode,
|
pathToNode,
|
||||||
'VariableDeclaration'
|
'VariableDeclaration'
|
||||||
|
@ -17,6 +17,7 @@ import {
|
|||||||
import { getNodeFromPath, getNodePathFromSourceRange } from '../queryAst'
|
import { getNodeFromPath, getNodePathFromSourceRange } from '../queryAst'
|
||||||
import { enginelessExecutor } from '../../lib/testHelpers'
|
import { enginelessExecutor } from '../../lib/testHelpers'
|
||||||
import { err } from 'lib/trap'
|
import { err } from 'lib/trap'
|
||||||
|
import { UnboxedNode } from 'wasm-lib/kcl/bindings/UnboxedNode'
|
||||||
|
|
||||||
const eachQuad: [number, [number, number]][] = [
|
const eachQuad: [number, [number, number]][] = [
|
||||||
[-315, [1, 1]],
|
[-315, [1, 1]],
|
||||||
@ -687,7 +688,7 @@ describe('testing getConstraintInfo', () => {
|
|||||||
]
|
]
|
||||||
if (err(ast)) return ast
|
if (err(ast)) return ast
|
||||||
const pathToNode = getNodePathFromSourceRange(ast, sourceRange)
|
const pathToNode = getNodePathFromSourceRange(ast, sourceRange)
|
||||||
const callExp = getNodeFromPath<CallExpression>(
|
const callExp = getNodeFromPath<UnboxedNode<CallExpression>>(
|
||||||
ast,
|
ast,
|
||||||
pathToNode,
|
pathToNode,
|
||||||
'CallExpression'
|
'CallExpression'
|
||||||
@ -841,7 +842,7 @@ describe('testing getConstraintInfo', () => {
|
|||||||
]
|
]
|
||||||
if (err(ast)) return ast
|
if (err(ast)) return ast
|
||||||
const pathToNode = getNodePathFromSourceRange(ast, sourceRange)
|
const pathToNode = getNodePathFromSourceRange(ast, sourceRange)
|
||||||
const callExp = getNodeFromPath<CallExpression>(
|
const callExp = getNodeFromPath<UnboxedNode<CallExpression>>(
|
||||||
ast,
|
ast,
|
||||||
pathToNode,
|
pathToNode,
|
||||||
'CallExpression'
|
'CallExpression'
|
||||||
@ -1197,7 +1198,7 @@ describe('testing getConstraintInfo', () => {
|
|||||||
]
|
]
|
||||||
if (err(ast)) return ast
|
if (err(ast)) return ast
|
||||||
const pathToNode = getNodePathFromSourceRange(ast, sourceRange)
|
const pathToNode = getNodePathFromSourceRange(ast, sourceRange)
|
||||||
const callExp = getNodeFromPath<CallExpression>(
|
const callExp = getNodeFromPath<UnboxedNode<CallExpression>>(
|
||||||
ast,
|
ast,
|
||||||
pathToNode,
|
pathToNode,
|
||||||
'CallExpression'
|
'CallExpression'
|
||||||
|
@ -55,6 +55,7 @@ import { err } from 'lib/trap'
|
|||||||
import { perpendicularDistance } from 'sketch-helpers'
|
import { perpendicularDistance } from 'sketch-helpers'
|
||||||
import { TagDeclarator } from 'wasm-lib/kcl/bindings/TagDeclarator'
|
import { TagDeclarator } from 'wasm-lib/kcl/bindings/TagDeclarator'
|
||||||
import { EdgeCutInfo } from 'machines/modelingMachine'
|
import { EdgeCutInfo } from 'machines/modelingMachine'
|
||||||
|
import { UnboxedNode } from 'wasm-lib/kcl/bindings/UnboxedNode'
|
||||||
|
|
||||||
const STRAIGHT_SEGMENT_ERR = new Error(
|
const STRAIGHT_SEGMENT_ERR = new Error(
|
||||||
'Invalid input, expected "straight-segment"'
|
'Invalid input, expected "straight-segment"'
|
||||||
@ -1785,7 +1786,8 @@ export const angledLineThatIntersects: SketchLineHelper = {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
if (intersectTag !== -1) {
|
if (intersectTag !== -1) {
|
||||||
const tag = firstArg.properties[intersectTag]?.value as Identifier
|
const tag = firstArg.properties[intersectTag]
|
||||||
|
?.value as UnboxedNode<Identifier>
|
||||||
const pathToTagProp: PathToNode = [
|
const pathToTagProp: PathToNode = [
|
||||||
...pathToObjectExp,
|
...pathToObjectExp,
|
||||||
[intersectTag, 'index'],
|
[intersectTag, 'index'],
|
||||||
@ -1825,7 +1827,9 @@ export const updateStartProfileAtArgs: SketchLineHelper['updateArgs'] = ({
|
|||||||
body: [],
|
body: [],
|
||||||
|
|
||||||
nonCodeMeta: {
|
nonCodeMeta: {
|
||||||
start: [],
|
start: 0,
|
||||||
|
end: 0,
|
||||||
|
startNodes: [],
|
||||||
nonCodeNodes: [],
|
nonCodeNodes: [],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -1865,7 +1869,7 @@ export const sketchLineHelperMap: { [key: string]: SketchLineHelper } = {
|
|||||||
} as const
|
} as const
|
||||||
|
|
||||||
export function changeSketchArguments(
|
export function changeSketchArguments(
|
||||||
node: Program,
|
node: UnboxedNode<Program>,
|
||||||
programMemory: ProgramMemory,
|
programMemory: ProgramMemory,
|
||||||
sourceRangeOrPath:
|
sourceRangeOrPath:
|
||||||
| {
|
| {
|
||||||
@ -1877,7 +1881,7 @@ export function changeSketchArguments(
|
|||||||
pathToNode: PathToNode
|
pathToNode: PathToNode
|
||||||
},
|
},
|
||||||
input: SegmentInputs
|
input: SegmentInputs
|
||||||
): { modifiedAst: Program; pathToNode: PathToNode } | Error {
|
): { modifiedAst: UnboxedNode<Program>; pathToNode: PathToNode } | Error {
|
||||||
const _node = { ...node }
|
const _node = { ...node }
|
||||||
const thePath =
|
const thePath =
|
||||||
sourceRangeOrPath.type === 'sourceRange'
|
sourceRangeOrPath.type === 'sourceRange'
|
||||||
@ -1906,7 +1910,7 @@ export function changeSketchArguments(
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function getConstraintInfo(
|
export function getConstraintInfo(
|
||||||
callExpression: CallExpression,
|
callExpression: UnboxedNode<CallExpression>,
|
||||||
code: string,
|
code: string,
|
||||||
pathToNode: PathToNode
|
pathToNode: PathToNode
|
||||||
): ConstrainInfo[] {
|
): ConstrainInfo[] {
|
||||||
@ -1944,7 +1948,7 @@ export function compareVec2Epsilon2(
|
|||||||
}
|
}
|
||||||
|
|
||||||
interface CreateLineFnCallArgs {
|
interface CreateLineFnCallArgs {
|
||||||
node: Program
|
node: UnboxedNode<Program>
|
||||||
programMemory: ProgramMemory
|
programMemory: ProgramMemory
|
||||||
input: SegmentInputs
|
input: SegmentInputs
|
||||||
fnName: ToolTip
|
fnName: ToolTip
|
||||||
@ -1961,7 +1965,7 @@ export function addNewSketchLn({
|
|||||||
spliceBetween = false,
|
spliceBetween = false,
|
||||||
}: CreateLineFnCallArgs):
|
}: CreateLineFnCallArgs):
|
||||||
| {
|
| {
|
||||||
modifiedAst: Program
|
modifiedAst: UnboxedNode<Program>
|
||||||
pathToNode: PathToNode
|
pathToNode: PathToNode
|
||||||
}
|
}
|
||||||
| Error {
|
| Error {
|
||||||
@ -1971,8 +1975,12 @@ export function addNewSketchLn({
|
|||||||
return new Error('not a sketch line helper')
|
return new Error('not a sketch line helper')
|
||||||
}
|
}
|
||||||
|
|
||||||
getNodeFromPath<VariableDeclarator>(node, pathToNode, 'VariableDeclarator')
|
getNodeFromPath<UnboxedNode<VariableDeclarator>>(
|
||||||
getNodeFromPath<PipeExpression | CallExpression>(
|
node,
|
||||||
|
pathToNode,
|
||||||
|
'VariableDeclarator'
|
||||||
|
)
|
||||||
|
getNodeFromPath<UnboxedNode<PipeExpression | CallExpression>>(
|
||||||
node,
|
node,
|
||||||
pathToNode,
|
pathToNode,
|
||||||
'PipeExpression'
|
'PipeExpression'
|
||||||
@ -1991,13 +1999,13 @@ export function addCallExpressionsToPipe({
|
|||||||
pathToNode,
|
pathToNode,
|
||||||
expressions,
|
expressions,
|
||||||
}: {
|
}: {
|
||||||
node: Program
|
node: UnboxedNode<Program>
|
||||||
programMemory: ProgramMemory
|
programMemory: ProgramMemory
|
||||||
pathToNode: PathToNode
|
pathToNode: PathToNode
|
||||||
expressions: CallExpression[]
|
expressions: UnboxedNode<CallExpression>[]
|
||||||
}) {
|
}) {
|
||||||
const _node = { ...node }
|
const _node = { ...node }
|
||||||
const pipeExpression = getNodeFromPath<PipeExpression>(
|
const pipeExpression = getNodeFromPath<UnboxedNode<PipeExpression>>(
|
||||||
_node,
|
_node,
|
||||||
pathToNode,
|
pathToNode,
|
||||||
'PipeExpression'
|
'PipeExpression'
|
||||||
@ -2046,7 +2054,7 @@ export function replaceSketchLine({
|
|||||||
replaceExistingCallback,
|
replaceExistingCallback,
|
||||||
referencedSegment,
|
referencedSegment,
|
||||||
}: {
|
}: {
|
||||||
node: Program
|
node: UnboxedNode<Program>
|
||||||
programMemory: ProgramMemory
|
programMemory: ProgramMemory
|
||||||
pathToNode: PathToNode
|
pathToNode: PathToNode
|
||||||
fnName: ToolTip
|
fnName: ToolTip
|
||||||
@ -2055,7 +2063,7 @@ export function replaceSketchLine({
|
|||||||
referencedSegment?: Path
|
referencedSegment?: Path
|
||||||
}):
|
}):
|
||||||
| {
|
| {
|
||||||
modifiedAst: Program
|
modifiedAst: UnboxedNode<Program>
|
||||||
valueUsedInTransform?: number
|
valueUsedInTransform?: number
|
||||||
pathToNode: PathToNode
|
pathToNode: PathToNode
|
||||||
}
|
}
|
||||||
@ -2107,7 +2115,7 @@ function addTagToChamfer(
|
|||||||
edgeCutMeta: EdgeCutInfo | null
|
edgeCutMeta: EdgeCutInfo | null
|
||||||
):
|
):
|
||||||
| {
|
| {
|
||||||
modifiedAst: Program
|
modifiedAst: UnboxedNode<Program>
|
||||||
tag: string
|
tag: string
|
||||||
}
|
}
|
||||||
| Error {
|
| Error {
|
||||||
@ -2234,7 +2242,7 @@ export function addTagForSketchOnFace(
|
|||||||
edgeCutMeta: EdgeCutInfo | null
|
edgeCutMeta: EdgeCutInfo | null
|
||||||
):
|
):
|
||||||
| {
|
| {
|
||||||
modifiedAst: Program
|
modifiedAst: UnboxedNode<Program>
|
||||||
tag: string
|
tag: string
|
||||||
}
|
}
|
||||||
| Error {
|
| Error {
|
||||||
@ -2272,12 +2280,14 @@ function isAngleLiteral(lineArugement: Expr): boolean {
|
|||||||
: false
|
: false
|
||||||
}
|
}
|
||||||
|
|
||||||
type addTagFn = (a: AddTagInfo) => { modifiedAst: Program; tag: string } | Error
|
type addTagFn = (
|
||||||
|
a: AddTagInfo
|
||||||
|
) => { modifiedAst: UnboxedNode<Program>; tag: string } | Error
|
||||||
|
|
||||||
function addTag(tagIndex = 2): addTagFn {
|
function addTag(tagIndex = 2): addTagFn {
|
||||||
return ({ node, pathToNode }) => {
|
return ({ node, pathToNode }) => {
|
||||||
const _node = { ...node }
|
const _node = { ...node }
|
||||||
const callExpr = getNodeFromPath<CallExpression>(
|
const callExpr = getNodeFromPath<UnboxedNode<CallExpression>>(
|
||||||
_node,
|
_node,
|
||||||
pathToNode,
|
pathToNode,
|
||||||
'CallExpression'
|
'CallExpression'
|
||||||
|
@ -49,6 +49,7 @@ import {
|
|||||||
getSketchSegmentFromSourceRange,
|
getSketchSegmentFromSourceRange,
|
||||||
} from './sketchConstraints'
|
} from './sketchConstraints'
|
||||||
import { getAngle, roundOff, normaliseAngle } from '../../lib/utils'
|
import { getAngle, roundOff, normaliseAngle } from '../../lib/utils'
|
||||||
|
import { UnboxedNode } from 'wasm-lib/kcl/bindings/UnboxedNode'
|
||||||
|
|
||||||
export type LineInputsType =
|
export type LineInputsType =
|
||||||
| 'xAbsolute'
|
| 'xAbsolute'
|
||||||
@ -325,7 +326,7 @@ const setHorzVertDistanceCreateNode =
|
|||||||
if (isUndef(refNum) || err(literalArg)) return REF_NUM_ERR
|
if (isUndef(refNum) || err(literalArg)) return REF_NUM_ERR
|
||||||
|
|
||||||
const valueUsedInTransform = roundOff(literalArg - refNum, 2)
|
const valueUsedInTransform = roundOff(literalArg - refNum, 2)
|
||||||
let finalValue: Expr = createBinaryExpressionWithUnary([
|
let finalValue: UnboxedNode<Expr> = createBinaryExpressionWithUnary([
|
||||||
createSegEnd(referenceSegName, !index),
|
createSegEnd(referenceSegName, !index),
|
||||||
forceValueUsedInTransform || createLiteral(valueUsedInTransform),
|
forceValueUsedInTransform || createLiteral(valueUsedInTransform),
|
||||||
])
|
])
|
||||||
@ -1541,7 +1542,7 @@ export function transformSecondarySketchLinesTagFirst({
|
|||||||
forceSegName,
|
forceSegName,
|
||||||
forceValueUsedInTransform,
|
forceValueUsedInTransform,
|
||||||
}: {
|
}: {
|
||||||
ast: Program
|
ast: UnboxedNode<Program>
|
||||||
selectionRanges: Selections
|
selectionRanges: Selections
|
||||||
transformInfos: TransformInfo[]
|
transformInfos: TransformInfo[]
|
||||||
programMemory: ProgramMemory
|
programMemory: ProgramMemory
|
||||||
@ -1549,7 +1550,7 @@ export function transformSecondarySketchLinesTagFirst({
|
|||||||
forceValueUsedInTransform?: BinaryPart
|
forceValueUsedInTransform?: BinaryPart
|
||||||
}):
|
}):
|
||||||
| {
|
| {
|
||||||
modifiedAst: Program
|
modifiedAst: UnboxedNode<Program>
|
||||||
valueUsedInTransform?: number
|
valueUsedInTransform?: number
|
||||||
pathToNodeMap: PathToNodeMap
|
pathToNodeMap: PathToNodeMap
|
||||||
tagInfo: {
|
tagInfo: {
|
||||||
@ -1620,7 +1621,7 @@ export function transformAstSketchLines({
|
|||||||
forceValueUsedInTransform,
|
forceValueUsedInTransform,
|
||||||
referencedSegmentRange,
|
referencedSegmentRange,
|
||||||
}: {
|
}: {
|
||||||
ast: Program
|
ast: UnboxedNode<Program>
|
||||||
selectionRanges: Selections | PathToNode[]
|
selectionRanges: Selections | PathToNode[]
|
||||||
transformInfos: TransformInfo[]
|
transformInfos: TransformInfo[]
|
||||||
programMemory: ProgramMemory
|
programMemory: ProgramMemory
|
||||||
@ -1629,7 +1630,7 @@ export function transformAstSketchLines({
|
|||||||
referencedSegmentRange?: Selection['range']
|
referencedSegmentRange?: Selection['range']
|
||||||
}):
|
}):
|
||||||
| {
|
| {
|
||||||
modifiedAst: Program
|
modifiedAst: UnboxedNode<Program>
|
||||||
valueUsedInTransform?: number
|
valueUsedInTransform?: number
|
||||||
pathToNodeMap: PathToNodeMap
|
pathToNodeMap: PathToNodeMap
|
||||||
}
|
}
|
||||||
@ -1647,7 +1648,7 @@ export function transformAstSketchLines({
|
|||||||
|
|
||||||
const getNode = getNodeFromPathCurry(node, _pathToNode)
|
const getNode = getNodeFromPathCurry(node, _pathToNode)
|
||||||
|
|
||||||
const callExp = getNode<CallExpression>('CallExpression')
|
const callExp = getNode<UnboxedNode<CallExpression>>('CallExpression')
|
||||||
if (err(callExp)) return callExp
|
if (err(callExp)) return callExp
|
||||||
const varDec = getNode<VariableDeclarator>('VariableDeclarator')
|
const varDec = getNode<VariableDeclarator>('VariableDeclarator')
|
||||||
if (err(varDec)) return varDec
|
if (err(varDec)) return varDec
|
||||||
@ -1806,13 +1807,16 @@ function createSegAngle(referenceSegName: string): BinaryPart {
|
|||||||
return createCallExpression('segAng', [createIdentifier(referenceSegName)])
|
return createCallExpression('segAng', [createIdentifier(referenceSegName)])
|
||||||
}
|
}
|
||||||
|
|
||||||
function createSegEnd(referenceSegName: string, isX: boolean): CallExpression {
|
function createSegEnd(
|
||||||
|
referenceSegName: string,
|
||||||
|
isX: boolean
|
||||||
|
): UnboxedNode<CallExpression> {
|
||||||
return createCallExpression(isX ? 'segEndX' : 'segEndY', [
|
return createCallExpression(isX ? 'segEndX' : 'segEndY', [
|
||||||
createIdentifier(referenceSegName),
|
createIdentifier(referenceSegName),
|
||||||
])
|
])
|
||||||
}
|
}
|
||||||
|
|
||||||
function createLastSeg(isX: boolean): CallExpression {
|
function createLastSeg(isX: boolean): UnboxedNode<CallExpression> {
|
||||||
return createCallExpression(isX ? 'lastSegX' : 'lastSegY', [
|
return createCallExpression(isX ? 'lastSegX' : 'lastSegY', [
|
||||||
createPipeSubstitution(),
|
createPipeSubstitution(),
|
||||||
])
|
])
|
||||||
@ -1830,7 +1834,7 @@ export function getConstraintLevelFromSourceRange(
|
|||||||
ast: Program | Error
|
ast: Program | Error
|
||||||
): Error | { range: [number, number]; level: ConstraintLevel } {
|
): Error | { range: [number, number]; level: ConstraintLevel } {
|
||||||
if (err(ast)) return ast
|
if (err(ast)) return ast
|
||||||
const nodeMeta = getNodeFromPath<CallExpression>(
|
const nodeMeta = getNodeFromPath<UnboxedNode<CallExpression>>(
|
||||||
ast,
|
ast,
|
||||||
getNodePathFromSourceRange(ast, cursorRange),
|
getNodePathFromSourceRange(ast, cursorRange),
|
||||||
'CallExpression'
|
'CallExpression'
|
||||||
|
@ -11,16 +11,17 @@ import {
|
|||||||
BinaryPart,
|
BinaryPart,
|
||||||
} from '../wasm'
|
} from '../wasm'
|
||||||
import { LineInputsType } from './sketchcombos'
|
import { LineInputsType } from './sketchcombos'
|
||||||
|
import { UnboxedNode } from 'wasm-lib/kcl/bindings/UnboxedNode'
|
||||||
|
|
||||||
export interface ModifyAstBase {
|
export interface ModifyAstBase {
|
||||||
node: Program
|
node: UnboxedNode<Program>
|
||||||
// TODO #896: Remove ProgramMemory from this interface
|
// TODO #896: Remove ProgramMemory from this interface
|
||||||
previousProgramMemory: ProgramMemory
|
previousProgramMemory: ProgramMemory
|
||||||
pathToNode: PathToNode
|
pathToNode: PathToNode
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface AddTagInfo {
|
export interface AddTagInfo {
|
||||||
node: Program
|
node: UnboxedNode<Program>
|
||||||
pathToNode: PathToNode
|
pathToNode: PathToNode
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -134,7 +135,7 @@ type _InputArg<T> =
|
|||||||
* Which is why a union type is used that can be type narrowed using the {@link RawArg.type} property
|
* 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
|
* {@link RawArg.expr} is common to all of these types
|
||||||
*/
|
*/
|
||||||
export type InputArg = _InputArg<Expr>
|
export type InputArg = _InputArg<UnboxedNode<Expr>>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@link RawArg.expr} is the literal equivalent of whatever current expression is
|
* {@link RawArg.expr} is the literal equivalent of whatever current expression is
|
||||||
@ -142,7 +143,7 @@ export type InputArg = _InputArg<Expr>
|
|||||||
* but of course works for expressions like myVar + someFn() etc too
|
* 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
|
* This is useful in cases where we want to "un-constrain" inputs to segments
|
||||||
*/
|
*/
|
||||||
type RawArg = _InputArg<Literal>
|
type RawArg = _InputArg<UnboxedNode<Literal>>
|
||||||
|
|
||||||
export type InputArgs = Array<InputArg>
|
export type InputArgs = Array<InputArg>
|
||||||
|
|
||||||
@ -186,7 +187,7 @@ export type CreateStdLibSketchCallExpr = (args: {
|
|||||||
inputs: InputArgs
|
inputs: InputArgs
|
||||||
rawArgs: RawArgs
|
rawArgs: RawArgs
|
||||||
referenceSegName: string
|
referenceSegName: string
|
||||||
tag?: Expr
|
tag?: UnboxedNode<Expr>
|
||||||
forceValueUsedInTransform?: BinaryPart
|
forceValueUsedInTransform?: BinaryPart
|
||||||
referencedSegment?: Path
|
referencedSegment?: Path
|
||||||
}) => CreatedSketchExprResult | Error
|
}) => CreatedSketchExprResult | Error
|
||||||
@ -215,26 +216,26 @@ export interface ConstrainInfo {
|
|||||||
export interface SketchLineHelper {
|
export interface SketchLineHelper {
|
||||||
add: (a: addCall) =>
|
add: (a: addCall) =>
|
||||||
| {
|
| {
|
||||||
modifiedAst: Program
|
modifiedAst: UnboxedNode<Program>
|
||||||
pathToNode: PathToNode
|
pathToNode: PathToNode
|
||||||
valueUsedInTransform?: number
|
valueUsedInTransform?: number
|
||||||
}
|
}
|
||||||
| Error
|
| Error
|
||||||
updateArgs: (a: updateArgs) =>
|
updateArgs: (a: updateArgs) =>
|
||||||
| {
|
| {
|
||||||
modifiedAst: Program
|
modifiedAst: UnboxedNode<Program>
|
||||||
pathToNode: PathToNode
|
pathToNode: PathToNode
|
||||||
}
|
}
|
||||||
| Error
|
| Error
|
||||||
getTag: (a: CallExpression) => string | Error
|
getTag: (a: CallExpression) => string | Error
|
||||||
addTag: (a: AddTagInfo) =>
|
addTag: (a: AddTagInfo) =>
|
||||||
| {
|
| {
|
||||||
modifiedAst: Program
|
modifiedAst: UnboxedNode<Program>
|
||||||
tag: string
|
tag: string
|
||||||
}
|
}
|
||||||
| Error
|
| Error
|
||||||
getConstraintInfo: (
|
getConstraintInfo: (
|
||||||
callExp: CallExpression,
|
callExp: UnboxedNode<CallExpression>,
|
||||||
code: string,
|
code: string,
|
||||||
pathToNode: PathToNode
|
pathToNode: PathToNode
|
||||||
) => ConstrainInfo[]
|
) => ConstrainInfo[]
|
||||||
|
13
src/lang/wasm.test.ts
Normal file
13
src/lang/wasm.test.ts
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
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,6 +42,7 @@ import { ExecState as RawExecState } from '../wasm-lib/kcl/bindings/ExecState'
|
|||||||
import { ProgramMemory as RawProgramMemory } from '../wasm-lib/kcl/bindings/ProgramMemory'
|
import { ProgramMemory as RawProgramMemory } from '../wasm-lib/kcl/bindings/ProgramMemory'
|
||||||
import { EnvironmentRef } from '../wasm-lib/kcl/bindings/EnvironmentRef'
|
import { EnvironmentRef } from '../wasm-lib/kcl/bindings/EnvironmentRef'
|
||||||
import { Environment } from '../wasm-lib/kcl/bindings/Environment'
|
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 { Program } from '../wasm-lib/kcl/bindings/Program'
|
||||||
export type { Expr } from '../wasm-lib/kcl/bindings/Expr'
|
export type { Expr } from '../wasm-lib/kcl/bindings/Expr'
|
||||||
@ -122,11 +123,11 @@ export const initPromise = initialise()
|
|||||||
export const rangeTypeFix = (ranges: number[][]): [number, number][] =>
|
export const rangeTypeFix = (ranges: number[][]): [number, number][] =>
|
||||||
ranges.map(([start, end]) => [start, end])
|
ranges.map(([start, end]) => [start, end])
|
||||||
|
|
||||||
export const parse = (code: string | Error): Program | Error => {
|
export const parse = (code: string | Error): UnboxedNode<Program> | Error => {
|
||||||
if (err(code)) return code
|
if (err(code)) return code
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const program: Program = parse_wasm(code)
|
const program: UnboxedNode<Program> = parse_wasm(code)
|
||||||
return program
|
return program
|
||||||
} catch (e: any) {
|
} catch (e: any) {
|
||||||
// throw e
|
// throw e
|
||||||
@ -378,7 +379,7 @@ export function sketchFromKclValue(
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const executor = async (
|
export const executor = async (
|
||||||
node: Program,
|
node: UnboxedNode<Program>,
|
||||||
programMemory: ProgramMemory | Error = ProgramMemory.empty(),
|
programMemory: ProgramMemory | Error = ProgramMemory.empty(),
|
||||||
idGenerator: IdGenerator = defaultIdGenerator(),
|
idGenerator: IdGenerator = defaultIdGenerator(),
|
||||||
engineCommandManager: EngineCommandManager,
|
engineCommandManager: EngineCommandManager,
|
||||||
@ -402,7 +403,7 @@ export const executor = async (
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const _executor = async (
|
export const _executor = async (
|
||||||
node: Program,
|
node: UnboxedNode<Program>,
|
||||||
programMemory: ProgramMemory | Error = ProgramMemory.empty(),
|
programMemory: ProgramMemory | Error = ProgramMemory.empty(),
|
||||||
idGenerator: IdGenerator = defaultIdGenerator(),
|
idGenerator: IdGenerator = defaultIdGenerator(),
|
||||||
engineCommandManager: EngineCommandManager,
|
engineCommandManager: EngineCommandManager,
|
||||||
@ -493,13 +494,13 @@ export function lexer(str: string): Token[] | Error {
|
|||||||
|
|
||||||
export const modifyAstForSketch = async (
|
export const modifyAstForSketch = async (
|
||||||
engineCommandManager: EngineCommandManager,
|
engineCommandManager: EngineCommandManager,
|
||||||
ast: Program,
|
ast: UnboxedNode<Program>,
|
||||||
variableName: string,
|
variableName: string,
|
||||||
currentPlane: string,
|
currentPlane: string,
|
||||||
engineId: string
|
engineId: string
|
||||||
): Promise<Program> => {
|
): Promise<UnboxedNode<Program>> => {
|
||||||
try {
|
try {
|
||||||
const updatedAst: Program = await modify_ast_for_sketch_wasm(
|
const updatedAst: UnboxedNode<Program> = await modify_ast_for_sketch_wasm(
|
||||||
engineCommandManager,
|
engineCommandManager,
|
||||||
JSON.stringify(ast),
|
JSON.stringify(ast),
|
||||||
variableName,
|
variableName,
|
||||||
|
@ -5,6 +5,7 @@ import { Selection } from './selections'
|
|||||||
import { Identifier, Expr, VariableDeclaration } from 'lang/wasm'
|
import { Identifier, Expr, VariableDeclaration } from 'lang/wasm'
|
||||||
import { commandBarMachine } from 'machines/commandBarMachine'
|
import { commandBarMachine } from 'machines/commandBarMachine'
|
||||||
import { ReactNode } from 'react'
|
import { ReactNode } from 'react'
|
||||||
|
import { UnboxedNode } from 'wasm-lib/kcl/bindings/UnboxedNode'
|
||||||
|
|
||||||
type Icon = CustomIconName
|
type Icon = CustomIconName
|
||||||
const PLATFORMS = ['both', 'web', 'desktop'] as const
|
const PLATFORMS = ['both', 'web', 'desktop'] as const
|
||||||
@ -23,8 +24,8 @@ export interface KclExpression {
|
|||||||
}
|
}
|
||||||
export interface KclExpressionWithVariable extends KclExpression {
|
export interface KclExpressionWithVariable extends KclExpression {
|
||||||
variableName: string
|
variableName: string
|
||||||
variableDeclarationAst: VariableDeclaration
|
variableDeclarationAst: UnboxedNode<VariableDeclaration>
|
||||||
variableIdentifierAst: Identifier
|
variableIdentifierAst: UnboxedNode<Identifier>
|
||||||
insertIndex: number
|
insertIndex: number
|
||||||
}
|
}
|
||||||
export type KclCommandValue = KclExpression | KclExpressionWithVariable
|
export type KclCommandValue = KclExpression | KclExpressionWithVariable
|
||||||
|
@ -36,6 +36,7 @@ import {
|
|||||||
getWallCodeRef,
|
getWallCodeRef,
|
||||||
ArtifactId,
|
ArtifactId,
|
||||||
} from 'lang/std/artifactGraph'
|
} from 'lang/std/artifactGraph'
|
||||||
|
import { UnboxedNode } from 'wasm-lib/kcl/bindings/UnboxedNode'
|
||||||
|
|
||||||
export const X_AXIS_UUID = 'ad792545-7fd3-482a-a602-a93924e3055b'
|
export const X_AXIS_UUID = 'ad792545-7fd3-482a-a602-a93924e3055b'
|
||||||
export const Y_AXIS_UUID = '680fd157-266f-4b8a-984f-cdf46b8bdf01'
|
export const Y_AXIS_UUID = '680fd157-266f-4b8a-984f-cdf46b8bdf01'
|
||||||
@ -244,7 +245,7 @@ export function getEventForSegmentSelection(
|
|||||||
const updatedAst = parse(codeManager.code)
|
const updatedAst = parse(codeManager.code)
|
||||||
if (err(updatedAst)) return null
|
if (err(updatedAst)) return null
|
||||||
|
|
||||||
const nodeMeta = getNodeFromPath<CallExpression>(
|
const nodeMeta = getNodeFromPath<UnboxedNode<CallExpression>>(
|
||||||
updatedAst,
|
updatedAst,
|
||||||
pathToNode,
|
pathToNode,
|
||||||
'CallExpression'
|
'CallExpression'
|
||||||
@ -362,7 +363,7 @@ function updateSceneObjectColors(codeBasedSelections: Selection[]) {
|
|||||||
|
|
||||||
Object.values(sceneEntitiesManager.activeSegments).forEach((segmentGroup) => {
|
Object.values(sceneEntitiesManager.activeSegments).forEach((segmentGroup) => {
|
||||||
if (!SEGMENT_BODIES_PLUS_PROFILE_START.includes(segmentGroup?.name)) return
|
if (!SEGMENT_BODIES_PLUS_PROFILE_START.includes(segmentGroup?.name)) return
|
||||||
const nodeMeta = getNodeFromPath<CallExpression>(
|
const nodeMeta = getNodeFromPath<UnboxedNode<CallExpression>>(
|
||||||
updated,
|
updated,
|
||||||
segmentGroup.userData.pathToNode,
|
segmentGroup.userData.pathToNode,
|
||||||
'CallExpression'
|
'CallExpression'
|
||||||
|
@ -17,6 +17,7 @@ import { DefaultPlanes } from 'wasm-lib/kcl/bindings/DefaultPlanes'
|
|||||||
import { err, reportRejection } from 'lib/trap'
|
import { err, reportRejection } from 'lib/trap'
|
||||||
import { toSync } from './utils'
|
import { toSync } from './utils'
|
||||||
import { IdGenerator } from 'wasm-lib/kcl/bindings/IdGenerator'
|
import { IdGenerator } from 'wasm-lib/kcl/bindings/IdGenerator'
|
||||||
|
import { UnboxedNode } from 'wasm-lib/kcl/bindings/UnboxedNode'
|
||||||
|
|
||||||
type WebSocketResponse = Models['WebSocketResponse_type']
|
type WebSocketResponse = Models['WebSocketResponse_type']
|
||||||
|
|
||||||
@ -84,7 +85,7 @@ class MockEngineCommandManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function enginelessExecutor(
|
export async function enginelessExecutor(
|
||||||
ast: Program | Error,
|
ast: UnboxedNode<Program> | Error,
|
||||||
pm: ProgramMemory | Error = ProgramMemory.empty(),
|
pm: ProgramMemory | Error = ProgramMemory.empty(),
|
||||||
idGenerator: IdGenerator = defaultIdGenerator()
|
idGenerator: IdGenerator = defaultIdGenerator()
|
||||||
): Promise<ExecState> {
|
): Promise<ExecState> {
|
||||||
@ -109,7 +110,7 @@ export async function enginelessExecutor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function executor(
|
export async function executor(
|
||||||
ast: Program,
|
ast: UnboxedNode<Program>,
|
||||||
pm: ProgramMemory = ProgramMemory.empty(),
|
pm: ProgramMemory = ProgramMemory.empty(),
|
||||||
idGenerator: IdGenerator = defaultIdGenerator()
|
idGenerator: IdGenerator = defaultIdGenerator()
|
||||||
): Promise<ExecState> {
|
): Promise<ExecState> {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
extern crate alloc;
|
extern crate alloc;
|
||||||
use kcl_lib::ast::types::{
|
use kcl_lib::ast::types::{
|
||||||
BodyItem, Expr, Identifier, ItemVisibility, Literal, LiteralValue, NonCodeMeta, Program, VariableDeclaration,
|
BodyItem, Expr, Identifier, ItemVisibility, Literal, LiteralValue, Program, UnboxedNode, VariableDeclaration,
|
||||||
VariableDeclarator, VariableKind,
|
VariableDeclarator, VariableKind,
|
||||||
};
|
};
|
||||||
use kcl_macros::parse;
|
use kcl_macros::parse;
|
||||||
@ -9,36 +9,46 @@ use pretty_assertions::assert_eq;
|
|||||||
#[test]
|
#[test]
|
||||||
fn basic() {
|
fn basic() {
|
||||||
let actual = parse!("const y = 4");
|
let actual = parse!("const y = 4");
|
||||||
let expected = Program {
|
let expected = UnboxedNode {
|
||||||
start: 0,
|
inner: Program {
|
||||||
end: 11,
|
body: vec![BodyItem::VariableDeclaration(UnboxedNode::new(
|
||||||
body: vec![BodyItem::VariableDeclaration(VariableDeclaration {
|
VariableDeclaration {
|
||||||
start: 0,
|
declarations: vec![UnboxedNode::new(
|
||||||
end: 11,
|
VariableDeclarator {
|
||||||
declarations: vec![VariableDeclarator {
|
id: UnboxedNode::new(
|
||||||
start: 6,
|
Identifier {
|
||||||
end: 11,
|
name: "y".to_owned(),
|
||||||
id: Identifier {
|
digest: None,
|
||||||
start: 6,
|
},
|
||||||
end: 7,
|
6,
|
||||||
name: "y".to_owned(),
|
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,
|
digest: None,
|
||||||
},
|
},
|
||||||
init: Expr::Literal(Box::new(Literal {
|
0,
|
||||||
start: 10,
|
11,
|
||||||
end: 11,
|
))],
|
||||||
value: LiteralValue::IInteger(4),
|
non_code_meta: Default::default(),
|
||||||
raw: "4".to_owned(),
|
|
||||||
digest: None,
|
|
||||||
})),
|
|
||||||
digest: None,
|
|
||||||
}],
|
|
||||||
visibility: ItemVisibility::Default,
|
|
||||||
kind: VariableKind::Const,
|
|
||||||
digest: None,
|
digest: None,
|
||||||
})],
|
},
|
||||||
non_code_meta: NonCodeMeta::default(),
|
start: 0,
|
||||||
digest: None,
|
end: 11,
|
||||||
};
|
};
|
||||||
assert_eq!(expected, actual);
|
assert_eq!(expected, actual);
|
||||||
}
|
}
|
||||||
|
@ -16,6 +16,8 @@ use crate::{
|
|||||||
executor::{Point2d, SourceRange},
|
executor::{Point2d, SourceRange},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
use super::types::UnboxedNode;
|
||||||
|
|
||||||
type Point3d = kcmc::shared::Point3d<f64>;
|
type Point3d = kcmc::shared::Point3d<f64>;
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
@ -35,7 +37,7 @@ const EPSILON: f64 = 0.015625; // or 2^-6
|
|||||||
/// a move or a new line.
|
/// a move or a new line.
|
||||||
pub async fn modify_ast_for_sketch(
|
pub async fn modify_ast_for_sketch(
|
||||||
engine: &Arc<Box<dyn EngineManager>>,
|
engine: &Arc<Box<dyn EngineManager>>,
|
||||||
program: &mut Program,
|
program: &mut UnboxedNode<Program>,
|
||||||
// The name of the sketch.
|
// The name of the sketch.
|
||||||
sketch_name: &str,
|
sketch_name: &str,
|
||||||
// The type of plane the sketch is on. `XY` or `XZ`, etc
|
// The type of plane the sketch is on. `XY` or `XZ`, etc
|
||||||
@ -195,7 +197,7 @@ fn create_start_sketch_on(
|
|||||||
end: [f64; 2],
|
end: [f64; 2],
|
||||||
plane: crate::executor::PlaneType,
|
plane: crate::executor::PlaneType,
|
||||||
additional_lines: Vec<[f64; 2]>,
|
additional_lines: Vec<[f64; 2]>,
|
||||||
) -> Result<VariableDeclarator, KclError> {
|
) -> Result<UnboxedNode<VariableDeclarator>, KclError> {
|
||||||
let start_sketch_on = CallExpression::new("startSketchOn", vec![Literal::new(plane.to_string().into()).into()])?;
|
let start_sketch_on = CallExpression::new("startSketchOn", vec![Literal::new(plane.to_string().into()).into()])?;
|
||||||
let start_profile_at = CallExpression::new(
|
let start_profile_at = CallExpression::new(
|
||||||
"startProfileAt",
|
"startProfileAt",
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -1,9 +1,10 @@
|
|||||||
use crate::executor::Metadata;
|
|
||||||
use crate::executor::SourceRange;
|
use crate::executor::SourceRange;
|
||||||
|
|
||||||
use super::impl_value_meta;
|
|
||||||
use super::ConstraintLevel;
|
use super::ConstraintLevel;
|
||||||
use super::Hover;
|
use super::Hover;
|
||||||
|
use super::Node;
|
||||||
|
use super::NodeList;
|
||||||
|
use super::UnboxedNode;
|
||||||
use super::{Digest, Expr};
|
use super::{Digest, Expr};
|
||||||
use databake::*;
|
use databake::*;
|
||||||
use schemars::JsonSchema;
|
use schemars::JsonSchema;
|
||||||
@ -19,12 +20,10 @@ type IfBlock = crate::ast::types::Program;
|
|||||||
#[ts(export)]
|
#[ts(export)]
|
||||||
#[serde(tag = "type")]
|
#[serde(tag = "type")]
|
||||||
pub struct IfExpression {
|
pub struct IfExpression {
|
||||||
pub start: usize,
|
|
||||||
pub end: usize,
|
|
||||||
pub cond: Box<Expr>,
|
pub cond: Box<Expr>,
|
||||||
pub then_val: Box<IfBlock>,
|
pub then_val: Node<IfBlock>,
|
||||||
pub else_ifs: Vec<ElseIf>,
|
pub else_ifs: NodeList<ElseIf>,
|
||||||
pub final_else: Box<IfBlock>,
|
pub final_else: Node<IfBlock>,
|
||||||
|
|
||||||
pub digest: Option<Digest>,
|
pub digest: Option<Digest>,
|
||||||
}
|
}
|
||||||
@ -34,57 +33,21 @@ pub struct IfExpression {
|
|||||||
#[ts(export)]
|
#[ts(export)]
|
||||||
#[serde(tag = "type")]
|
#[serde(tag = "type")]
|
||||||
pub struct ElseIf {
|
pub struct ElseIf {
|
||||||
pub start: usize,
|
|
||||||
pub end: usize,
|
|
||||||
pub cond: Expr,
|
pub cond: Expr,
|
||||||
pub then_val: Box<IfBlock>,
|
pub then_val: Node<IfBlock>,
|
||||||
|
|
||||||
pub digest: Option<Digest>,
|
pub digest: Option<Digest>,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Source code metadata
|
// Source code metadata
|
||||||
|
|
||||||
impl_value_meta!(IfExpression);
|
impl UnboxedNode<IfExpression> {
|
||||||
impl_value_meta!(ElseIf);
|
|
||||||
|
|
||||||
impl IfExpression {
|
|
||||||
fn source_ranges(&self) -> Vec<SourceRange> {
|
fn source_ranges(&self) -> Vec<SourceRange> {
|
||||||
vec![SourceRange::from(self)]
|
vec![SourceRange::from(self)]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<IfExpression> for Metadata {
|
impl UnboxedNode<ElseIf> {
|
||||||
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)]
|
#[allow(dead_code)]
|
||||||
fn source_ranges(&self) -> Vec<SourceRange> {
|
fn source_ranges(&self) -> Vec<SourceRange> {
|
||||||
vec![SourceRange([self.start, self.end])]
|
vec![SourceRange([self.start, self.end])]
|
||||||
@ -93,6 +56,15 @@ impl ElseIf {
|
|||||||
|
|
||||||
// IDE support and refactors
|
// 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 {
|
impl IfExpression {
|
||||||
pub fn get_hover_value_for_position(&self, pos: usize, code: &str) -> Option<Hover> {
|
pub fn get_hover_value_for_position(&self, pos: usize, code: &str) -> Option<Hover> {
|
||||||
self.cond
|
self.cond
|
||||||
@ -115,12 +87,7 @@ impl IfExpression {
|
|||||||
}
|
}
|
||||||
self.final_else.rename_identifiers(old_name, new_name);
|
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) {
|
pub fn replace_value(&mut self, source_range: SourceRange, new_value: Expr) {
|
||||||
self.cond.replace_value(source_range, new_value.clone());
|
self.cond.replace_value(source_range, new_value.clone());
|
||||||
for else_if in &mut self.else_ifs {
|
for else_if in &mut self.else_ifs {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
use super::{
|
use super::{
|
||||||
human_friendly_type, ArrayExpression, ArrayRangeExpression, BinaryExpression, BinaryOperator, BinaryPart,
|
human_friendly_type, ArrayExpression, ArrayRangeExpression, BinaryExpression, BinaryOperator, BinaryPart,
|
||||||
CallExpression, Expr, IfExpression, LiteralIdentifier, LiteralValue, MemberExpression, MemberObject,
|
CallExpression, Expr, IfExpression, LiteralIdentifier, LiteralValue, MemberExpression, MemberObject,
|
||||||
ObjectExpression, TagDeclarator, UnaryExpression, UnaryOperator,
|
ObjectExpression, TagDeclarator, UnaryExpression, UnaryOperator, UnboxedNode,
|
||||||
};
|
};
|
||||||
use crate::{
|
use crate::{
|
||||||
errors::{KclError, KclErrorDetails},
|
errors::{KclError, KclErrorDetails},
|
||||||
@ -32,7 +32,7 @@ impl BinaryPart {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl MemberExpression {
|
impl UnboxedNode<MemberExpression> {
|
||||||
pub fn get_result_array(&self, exec_state: &mut ExecState, index: usize) -> Result<KclValue, KclError> {
|
pub fn get_result_array(&self, exec_state: &mut ExecState, index: usize) -> Result<KclValue, KclError> {
|
||||||
let array = match &self.object {
|
let array = match &self.object {
|
||||||
MemberObject::MemberExpression(member_expr) => member_expr.get_result(exec_state)?,
|
MemberObject::MemberExpression(member_expr) => member_expr.get_result(exec_state)?,
|
||||||
@ -137,7 +137,7 @@ impl MemberExpression {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl BinaryExpression {
|
impl UnboxedNode<BinaryExpression> {
|
||||||
#[async_recursion]
|
#[async_recursion]
|
||||||
pub async fn get_result(&self, exec_state: &mut ExecState, ctx: &ExecutorContext) -> Result<KclValue, KclError> {
|
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()?;
|
let left_json_value = self.left.get_result(exec_state, ctx).await?.get_json_value()?;
|
||||||
@ -186,7 +186,7 @@ impl BinaryExpression {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl UnaryExpression {
|
impl UnboxedNode<UnaryExpression> {
|
||||||
pub async fn get_result(&self, exec_state: &mut ExecState, ctx: &ExecutorContext) -> Result<KclValue, KclError> {
|
pub async fn get_result(&self, exec_state: &mut ExecState, ctx: &ExecutorContext) -> Result<KclValue, KclError> {
|
||||||
if self.operator == UnaryOperator::Not {
|
if self.operator == UnaryOperator::Not {
|
||||||
let value = self.argument.get_result(exec_state, ctx).await?.get_json_value()?;
|
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)
|
Ok(final_output)
|
||||||
}
|
}
|
||||||
|
|
||||||
impl CallExpression {
|
impl UnboxedNode<CallExpression> {
|
||||||
#[async_recursion]
|
#[async_recursion]
|
||||||
pub async fn execute(&self, exec_state: &mut ExecState, ctx: &ExecutorContext) -> Result<KclValue, KclError> {
|
pub async fn execute(&self, exec_state: &mut ExecState, ctx: &ExecutorContext) -> Result<KclValue, KclError> {
|
||||||
let fn_name = &self.callee.name;
|
let fn_name = &self.callee.name;
|
||||||
@ -502,7 +502,7 @@ impl CallExpression {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl TagDeclarator {
|
impl UnboxedNode<TagDeclarator> {
|
||||||
pub async fn execute(&self, exec_state: &mut ExecState) -> Result<KclValue, KclError> {
|
pub async fn execute(&self, exec_state: &mut ExecState) -> Result<KclValue, KclError> {
|
||||||
let memory_item = KclValue::TagIdentifier(Box::new(TagIdentifier {
|
let memory_item = KclValue::TagIdentifier(Box::new(TagIdentifier {
|
||||||
value: self.name.clone(),
|
value: self.name.clone(),
|
||||||
@ -518,7 +518,7 @@ impl TagDeclarator {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ArrayExpression {
|
impl UnboxedNode<ArrayExpression> {
|
||||||
#[async_recursion]
|
#[async_recursion]
|
||||||
pub async fn execute(&self, exec_state: &mut ExecState, ctx: &ExecutorContext) -> Result<KclValue, KclError> {
|
pub async fn execute(&self, exec_state: &mut ExecState, ctx: &ExecutorContext) -> Result<KclValue, KclError> {
|
||||||
let mut results = Vec::with_capacity(self.elements.len());
|
let mut results = Vec::with_capacity(self.elements.len());
|
||||||
@ -543,21 +543,21 @@ impl ArrayExpression {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ArrayRangeExpression {
|
impl UnboxedNode<ArrayRangeExpression> {
|
||||||
#[async_recursion]
|
#[async_recursion]
|
||||||
pub async fn execute(&self, exec_state: &mut ExecState, ctx: &ExecutorContext) -> Result<KclValue, KclError> {
|
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
|
let start = ctx
|
||||||
.execute_expr(&self.start_element, exec_state, &metadata, StatementKind::Expression)
|
.execute_expr(&self.start_element, exec_state, &metadata, StatementKind::Expression)
|
||||||
.await?
|
.await?
|
||||||
.get_json_value()?;
|
.get_json_value()?;
|
||||||
let start = parse_json_number_as_u64(&start, (&*self.start_element).into())?;
|
let start = parse_json_number_as_u64(&start, (&self.start_element).into())?;
|
||||||
let metadata = Metadata::from(&*self.end_element);
|
let metadata = Metadata::from(&self.end_element);
|
||||||
let end = ctx
|
let end = ctx
|
||||||
.execute_expr(&self.end_element, exec_state, &metadata, StatementKind::Expression)
|
.execute_expr(&self.end_element, exec_state, &metadata, StatementKind::Expression)
|
||||||
.await?
|
.await?
|
||||||
.get_json_value()?;
|
.get_json_value()?;
|
||||||
let end = parse_json_number_as_u64(&end, (&*self.end_element).into())?;
|
let end = parse_json_number_as_u64(&end, (&self.end_element).into())?;
|
||||||
|
|
||||||
if end < start {
|
if end < start {
|
||||||
return Err(KclError::Semantic(KclErrorDetails {
|
return Err(KclError::Semantic(KclErrorDetails {
|
||||||
@ -581,7 +581,7 @@ impl ArrayRangeExpression {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ObjectExpression {
|
impl UnboxedNode<ObjectExpression> {
|
||||||
#[async_recursion]
|
#[async_recursion]
|
||||||
pub async fn execute(&self, exec_state: &mut ExecState, ctx: &ExecutorContext) -> Result<KclValue, KclError> {
|
pub async fn execute(&self, exec_state: &mut ExecState, ctx: &ExecutorContext) -> Result<KclValue, KclError> {
|
||||||
let mut object = serde_json::Map::new();
|
let mut object = serde_json::Map::new();
|
||||||
@ -655,7 +655,7 @@ pub fn json_as_bool(j: &serde_json::Value) -> Option<bool> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl IfExpression {
|
impl UnboxedNode<IfExpression> {
|
||||||
#[async_recursion]
|
#[async_recursion]
|
||||||
pub async fn get_result(&self, exec_state: &mut ExecState, ctx: &ExecutorContext) -> Result<KclValue, KclError> {
|
pub async fn get_result(&self, exec_state: &mut ExecState, ctx: &ExecutorContext) -> Result<KclValue, KclError> {
|
||||||
// Check the `if` branch.
|
// Check the `if` branch.
|
||||||
@ -717,7 +717,7 @@ impl Property {
|
|||||||
let property_src: SourceRange = value.clone().into();
|
let property_src: SourceRange = value.clone().into();
|
||||||
match value {
|
match value {
|
||||||
LiteralIdentifier::Identifier(identifier) => {
|
LiteralIdentifier::Identifier(identifier) => {
|
||||||
let name = identifier.name;
|
let name = &identifier.name;
|
||||||
if !computed {
|
if !computed {
|
||||||
// Treat the property as a literal
|
// Treat the property as a literal
|
||||||
Ok(Property::String(name.to_string()))
|
Ok(Property::String(name.to_string()))
|
||||||
|
@ -5,6 +5,8 @@ use serde_json::Value as JValue;
|
|||||||
|
|
||||||
use crate::ast::types::{Expr, Literal};
|
use crate::ast::types::{Expr, Literal};
|
||||||
|
|
||||||
|
use super::UnboxedNode;
|
||||||
|
|
||||||
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, ts_rs::TS, JsonSchema, Bake)]
|
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, ts_rs::TS, JsonSchema, Bake)]
|
||||||
#[databake(path = kcl_lib::ast::types)]
|
#[databake(path = kcl_lib::ast::types)]
|
||||||
#[ts(export)]
|
#[ts(export)]
|
||||||
@ -33,9 +35,9 @@ impl LiteralValue {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<Literal> for Expr {
|
impl From<UnboxedNode<Literal>> for Expr {
|
||||||
fn from(literal: Literal) -> Self {
|
fn from(literal: UnboxedNode<Literal>) -> Self {
|
||||||
Expr::Literal(Box::new(literal))
|
Expr::Literal(literal)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,8 +26,8 @@ type Point3D = kcmc::shared::Point3d<f64>;
|
|||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
ast::types::{
|
ast::types::{
|
||||||
human_friendly_type, BodyItem, Expr, ExpressionStatement, FunctionExpression, ImportStatement, ItemVisibility,
|
human_friendly_type, BodyItem, Expr, FunctionExpression, ItemVisibility, KclNone, NodeRef, Program,
|
||||||
KclNone, Program, ReturnStatement, TagDeclarator,
|
TagDeclarator, TagNode, UnboxedNode,
|
||||||
},
|
},
|
||||||
engine::{EngineManager, ExecutionKind},
|
engine::{EngineManager, ExecutionKind},
|
||||||
errors::{KclError, KclErrorDetails},
|
errors::{KclError, KclErrorDetails},
|
||||||
@ -339,7 +339,7 @@ impl IdGenerator {
|
|||||||
pub enum KclValue {
|
pub enum KclValue {
|
||||||
UserVal(UserVal),
|
UserVal(UserVal),
|
||||||
TagIdentifier(Box<TagIdentifier>),
|
TagIdentifier(Box<TagIdentifier>),
|
||||||
TagDeclarator(Box<TagDeclarator>),
|
TagDeclarator(crate::ast::types::Node<TagDeclarator>),
|
||||||
Plane(Box<Plane>),
|
Plane(Box<Plane>),
|
||||||
Face(Box<Face>),
|
Face(Box<Face>),
|
||||||
|
|
||||||
@ -352,7 +352,7 @@ pub enum KclValue {
|
|||||||
Function {
|
Function {
|
||||||
#[serde(skip)]
|
#[serde(skip)]
|
||||||
func: Option<MemoryFunction>,
|
func: Option<MemoryFunction>,
|
||||||
expression: Box<FunctionExpression>,
|
expression: crate::ast::types::Node<FunctionExpression>,
|
||||||
memory: Box<ProgramMemory>,
|
memory: Box<ProgramMemory>,
|
||||||
#[serde(rename = "__meta")]
|
#[serde(rename = "__meta")]
|
||||||
meta: Vec<Metadata>,
|
meta: Vec<Metadata>,
|
||||||
@ -890,7 +890,7 @@ pub type MemoryFunction =
|
|||||||
fn(
|
fn(
|
||||||
s: Vec<KclValue>,
|
s: Vec<KclValue>,
|
||||||
memory: ProgramMemory,
|
memory: ProgramMemory,
|
||||||
expression: Box<FunctionExpression>,
|
expression: crate::ast::types::Node<FunctionExpression>,
|
||||||
metadata: Vec<Metadata>,
|
metadata: Vec<Metadata>,
|
||||||
exec_state: &ExecState,
|
exec_state: &ExecState,
|
||||||
ctx: ExecutorContext,
|
ctx: ExecutorContext,
|
||||||
@ -900,7 +900,7 @@ impl From<KclValue> for Vec<SourceRange> {
|
|||||||
fn from(item: KclValue) -> Self {
|
fn from(item: KclValue) -> Self {
|
||||||
match item {
|
match item {
|
||||||
KclValue::UserVal(u) => u.meta.iter().map(|m| m.source_range).collect(),
|
KclValue::UserVal(u) => u.meta.iter().map(|m| m.source_range).collect(),
|
||||||
KclValue::TagDeclarator(t) => t.into(),
|
KclValue::TagDeclarator(t) => vec![(&t).into()],
|
||||||
KclValue::TagIdentifier(t) => t.meta.iter().map(|m| m.source_range).collect(),
|
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::Solid(e) => e.meta.iter().map(|m| m.source_range).collect(),
|
||||||
KclValue::Solids { value } => value
|
KclValue::Solids { value } => value
|
||||||
@ -1043,9 +1043,9 @@ impl KclValue {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Get a tag declarator from a memory item.
|
/// Get a tag declarator from a memory item.
|
||||||
pub fn get_tag_declarator(&self) -> Result<TagDeclarator, KclError> {
|
pub fn get_tag_declarator(&self) -> Result<TagNode, KclError> {
|
||||||
match self {
|
match self {
|
||||||
KclValue::TagDeclarator(t) => Ok(*t.clone()),
|
KclValue::TagDeclarator(t) => Ok((**t).clone()),
|
||||||
_ => Err(KclError::Semantic(KclErrorDetails {
|
_ => Err(KclError::Semantic(KclErrorDetails {
|
||||||
message: format!("Not a tag declarator: {:?}", self),
|
message: format!("Not a tag declarator: {:?}", self),
|
||||||
source_ranges: self.clone().into(),
|
source_ranges: self.clone().into(),
|
||||||
@ -1054,9 +1054,9 @@ impl KclValue {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Get an optional tag from a memory item.
|
/// Get an optional tag from a memory item.
|
||||||
pub fn get_tag_declarator_opt(&self) -> Result<Option<TagDeclarator>, KclError> {
|
pub fn get_tag_declarator_opt(&self) -> Result<Option<TagNode>, KclError> {
|
||||||
match self {
|
match self {
|
||||||
KclValue::TagDeclarator(t) => Ok(Some(*t.clone())),
|
KclValue::TagDeclarator(t) => Ok(Some((**t).clone())),
|
||||||
_ => Err(KclError::Semantic(KclErrorDetails {
|
_ => Err(KclError::Semantic(KclErrorDetails {
|
||||||
message: format!("Not a tag declarator: {:?}", self),
|
message: format!("Not a tag declarator: {:?}", self),
|
||||||
source_ranges: self.clone().into(),
|
source_ranges: self.clone().into(),
|
||||||
@ -1200,7 +1200,7 @@ pub struct GetTangentialInfoFromPathsResult {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl Sketch {
|
impl Sketch {
|
||||||
pub(crate) fn add_tag(&mut self, tag: &TagDeclarator, current_path: &Path) {
|
pub(crate) fn add_tag(&mut self, tag: NodeRef<'_, TagDeclarator>, current_path: &Path) {
|
||||||
let mut tag_identifier: TagIdentifier = tag.into();
|
let mut tag_identifier: TagIdentifier = tag.into();
|
||||||
let base = current_path.get_base();
|
let base = current_path.get_base();
|
||||||
tag_identifier.info = Some(TagEngineInfo {
|
tag_identifier.info = Some(TagEngineInfo {
|
||||||
@ -1326,7 +1326,7 @@ pub enum EdgeCut {
|
|||||||
/// The engine id of the edge to fillet.
|
/// The engine id of the edge to fillet.
|
||||||
#[serde(rename = "edgeId")]
|
#[serde(rename = "edgeId")]
|
||||||
edge_id: uuid::Uuid,
|
edge_id: uuid::Uuid,
|
||||||
tag: Box<Option<TagDeclarator>>,
|
tag: Box<Option<TagNode>>,
|
||||||
},
|
},
|
||||||
/// A chamfer.
|
/// A chamfer.
|
||||||
Chamfer {
|
Chamfer {
|
||||||
@ -1336,7 +1336,7 @@ pub enum EdgeCut {
|
|||||||
/// The engine id of the edge to chamfer.
|
/// The engine id of the edge to chamfer.
|
||||||
#[serde(rename = "edgeId")]
|
#[serde(rename = "edgeId")]
|
||||||
edge_id: uuid::Uuid,
|
edge_id: uuid::Uuid,
|
||||||
tag: Box<Option<TagDeclarator>>,
|
tag: Box<Option<TagNode>>,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1355,7 +1355,7 @@ impl EdgeCut {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn tag(&self) -> Option<TagDeclarator> {
|
pub fn tag(&self) -> Option<TagNode> {
|
||||||
match self {
|
match self {
|
||||||
EdgeCut::Fillet { tag, .. } => *tag.clone(),
|
EdgeCut::Fillet { tag, .. } => *tag.clone(),
|
||||||
EdgeCut::Chamfer { tag, .. } => *tag.clone(),
|
EdgeCut::Chamfer { tag, .. } => *tag.clone(),
|
||||||
@ -1529,26 +1529,10 @@ impl From<SourceRange> for Metadata {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<&ImportStatement> for Metadata {
|
impl<T> From<NodeRef<'_, T>> for Metadata {
|
||||||
fn from(stmt: &ImportStatement) -> Self {
|
fn from(node: NodeRef<'_, T>) -> Self {
|
||||||
Self {
|
Self {
|
||||||
source_range: SourceRange::new(stmt.start, stmt.end),
|
source_range: SourceRange::new(node.start, node.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),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1573,7 +1557,7 @@ pub struct BasePath {
|
|||||||
#[ts(type = "[number, number]")]
|
#[ts(type = "[number, number]")]
|
||||||
pub to: [f64; 2],
|
pub to: [f64; 2],
|
||||||
/// The tag of the path.
|
/// The tag of the path.
|
||||||
pub tag: Option<TagDeclarator>,
|
pub tag: Option<TagNode>,
|
||||||
/// Metadata.
|
/// Metadata.
|
||||||
#[serde(rename = "__geoMeta")]
|
#[serde(rename = "__geoMeta")]
|
||||||
pub geo_meta: GeoMeta,
|
pub geo_meta: GeoMeta,
|
||||||
@ -1671,7 +1655,7 @@ impl Path {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_tag(&self) -> Option<TagDeclarator> {
|
pub fn get_tag(&self) -> Option<TagNode> {
|
||||||
match self {
|
match self {
|
||||||
Path::ToPoint { base } => base.tag.clone(),
|
Path::ToPoint { base } => base.tag.clone(),
|
||||||
Path::Horizontal { base, .. } => base.tag.clone(),
|
Path::Horizontal { base, .. } => base.tag.clone(),
|
||||||
@ -1728,7 +1712,7 @@ pub struct ChamferSurface {
|
|||||||
/// The id for the chamfer surface.
|
/// The id for the chamfer surface.
|
||||||
pub face_id: uuid::Uuid,
|
pub face_id: uuid::Uuid,
|
||||||
/// The tag.
|
/// The tag.
|
||||||
pub tag: Option<TagDeclarator>,
|
pub tag: Option<UnboxedNode<TagDeclarator>>,
|
||||||
/// Metadata.
|
/// Metadata.
|
||||||
#[serde(flatten)]
|
#[serde(flatten)]
|
||||||
pub geo_meta: GeoMeta,
|
pub geo_meta: GeoMeta,
|
||||||
@ -1742,7 +1726,7 @@ pub struct FilletSurface {
|
|||||||
/// The id for the fillet surface.
|
/// The id for the fillet surface.
|
||||||
pub face_id: uuid::Uuid,
|
pub face_id: uuid::Uuid,
|
||||||
/// The tag.
|
/// The tag.
|
||||||
pub tag: Option<TagDeclarator>,
|
pub tag: Option<UnboxedNode<TagDeclarator>>,
|
||||||
/// Metadata.
|
/// Metadata.
|
||||||
#[serde(flatten)]
|
#[serde(flatten)]
|
||||||
pub geo_meta: GeoMeta,
|
pub geo_meta: GeoMeta,
|
||||||
@ -1756,7 +1740,7 @@ pub struct ExtrudePlane {
|
|||||||
/// The face id for the extrude plane.
|
/// The face id for the extrude plane.
|
||||||
pub face_id: uuid::Uuid,
|
pub face_id: uuid::Uuid,
|
||||||
/// The tag.
|
/// The tag.
|
||||||
pub tag: Option<TagDeclarator>,
|
pub tag: Option<UnboxedNode<TagDeclarator>>,
|
||||||
/// Metadata.
|
/// Metadata.
|
||||||
#[serde(flatten)]
|
#[serde(flatten)]
|
||||||
pub geo_meta: GeoMeta,
|
pub geo_meta: GeoMeta,
|
||||||
@ -1770,7 +1754,7 @@ pub struct ExtrudeArc {
|
|||||||
/// The face id for the extrude plane.
|
/// The face id for the extrude plane.
|
||||||
pub face_id: uuid::Uuid,
|
pub face_id: uuid::Uuid,
|
||||||
/// The tag.
|
/// The tag.
|
||||||
pub tag: Option<TagDeclarator>,
|
pub tag: Option<UnboxedNode<TagDeclarator>>,
|
||||||
/// Metadata.
|
/// Metadata.
|
||||||
#[serde(flatten)]
|
#[serde(flatten)]
|
||||||
pub geo_meta: GeoMeta,
|
pub geo_meta: GeoMeta,
|
||||||
@ -1786,7 +1770,7 @@ impl ExtrudeSurface {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_tag(&self) -> Option<TagDeclarator> {
|
pub fn get_tag(&self) -> Option<UnboxedNode<TagDeclarator>> {
|
||||||
match self {
|
match self {
|
||||||
ExtrudeSurface::ExtrudePlane(ep) => ep.tag.clone(),
|
ExtrudeSurface::ExtrudePlane(ep) => ep.tag.clone(),
|
||||||
ExtrudeSurface::ExtrudeArc(ea) => ea.tag.clone(),
|
ExtrudeSurface::ExtrudeArc(ea) => ea.tag.clone(),
|
||||||
@ -1997,7 +1981,7 @@ impl ExecutorContext {
|
|||||||
/// Kurt uses this for partial execution.
|
/// Kurt uses this for partial execution.
|
||||||
pub async fn run(
|
pub async fn run(
|
||||||
&self,
|
&self,
|
||||||
program: &crate::ast::types::Program,
|
program: NodeRef<'_, crate::ast::types::Program>,
|
||||||
memory: Option<ProgramMemory>,
|
memory: Option<ProgramMemory>,
|
||||||
id_generator: IdGenerator,
|
id_generator: IdGenerator,
|
||||||
project_directory: Option<String>,
|
project_directory: Option<String>,
|
||||||
@ -2011,7 +1995,7 @@ impl ExecutorContext {
|
|||||||
/// Kurt uses this for partial execution.
|
/// Kurt uses this for partial execution.
|
||||||
pub async fn run_with_session_data(
|
pub async fn run_with_session_data(
|
||||||
&self,
|
&self,
|
||||||
program: &crate::ast::types::Program,
|
program: NodeRef<'_, crate::ast::types::Program>,
|
||||||
memory: Option<ProgramMemory>,
|
memory: Option<ProgramMemory>,
|
||||||
id_generator: IdGenerator,
|
id_generator: IdGenerator,
|
||||||
project_directory: Option<String>,
|
project_directory: Option<String>,
|
||||||
@ -2053,9 +2037,9 @@ impl ExecutorContext {
|
|||||||
|
|
||||||
/// Execute an AST's program.
|
/// Execute an AST's program.
|
||||||
#[async_recursion]
|
#[async_recursion]
|
||||||
pub(crate) async fn inner_execute(
|
pub(crate) async fn inner_execute<'a>(
|
||||||
&self,
|
&'a self,
|
||||||
program: &crate::ast::types::Program,
|
program: NodeRef<'a, crate::ast::types::Program>,
|
||||||
exec_state: &mut ExecState,
|
exec_state: &mut ExecState,
|
||||||
body_type: BodyType,
|
body_type: BodyType,
|
||||||
) -> Result<Option<KclValue>, KclError> {
|
) -> Result<Option<KclValue>, KclError> {
|
||||||
@ -2291,7 +2275,7 @@ impl ExecutorContext {
|
|||||||
/// Execute the program, then get a PNG screenshot.
|
/// Execute the program, then get a PNG screenshot.
|
||||||
pub async fn execute_and_prepare_snapshot(
|
pub async fn execute_and_prepare_snapshot(
|
||||||
&self,
|
&self,
|
||||||
program: &Program,
|
program: NodeRef<'_, Program>,
|
||||||
id_generator: IdGenerator,
|
id_generator: IdGenerator,
|
||||||
project_directory: Option<String>,
|
project_directory: Option<String>,
|
||||||
) -> Result<TakeSnapshot> {
|
) -> Result<TakeSnapshot> {
|
||||||
@ -2336,7 +2320,7 @@ impl ExecutorContext {
|
|||||||
/// assign it to a parameter of the function, in the given block of function memory.
|
/// 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.
|
/// Returns Err if too few/too many arguments were given for the function.
|
||||||
fn assign_args_to_params(
|
fn assign_args_to_params(
|
||||||
function_expression: &FunctionExpression,
|
function_expression: NodeRef<'_, FunctionExpression>,
|
||||||
args: Vec<KclValue>,
|
args: Vec<KclValue>,
|
||||||
mut fn_memory: ProgramMemory,
|
mut fn_memory: ProgramMemory,
|
||||||
) -> Result<ProgramMemory, KclError> {
|
) -> Result<ProgramMemory, KclError> {
|
||||||
@ -2388,7 +2372,7 @@ fn assign_args_to_params(
|
|||||||
pub(crate) async fn call_user_defined_function(
|
pub(crate) async fn call_user_defined_function(
|
||||||
args: Vec<KclValue>,
|
args: Vec<KclValue>,
|
||||||
memory: &ProgramMemory,
|
memory: &ProgramMemory,
|
||||||
function_expression: &FunctionExpression,
|
function_expression: NodeRef<'_, FunctionExpression>,
|
||||||
exec_state: &mut ExecState,
|
exec_state: &mut ExecState,
|
||||||
ctx: &ExecutorContext,
|
ctx: &ExecutorContext,
|
||||||
) -> Result<Option<KclValue>, KclError> {
|
) -> Result<Option<KclValue>, KclError> {
|
||||||
@ -2427,7 +2411,7 @@ mod tests {
|
|||||||
use pretty_assertions::assert_eq;
|
use pretty_assertions::assert_eq;
|
||||||
|
|
||||||
use super::*;
|
use super::*;
|
||||||
use crate::ast::types::{Identifier, Parameter};
|
use crate::ast::types::{Identifier, Parameter, UnboxedNode};
|
||||||
|
|
||||||
pub async fn parse_execute(code: &str) -> Result<ProgramMemory> {
|
pub async fn parse_execute(code: &str) -> Result<ProgramMemory> {
|
||||||
let tokens = crate::token::lexer(code)?;
|
let tokens = crate::token::lexer(code)?;
|
||||||
@ -3399,13 +3383,11 @@ let w = f() + f()
|
|||||||
meta: Default::default(),
|
meta: Default::default(),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
fn ident(s: &'static str) -> Identifier {
|
fn ident(s: &'static str) -> UnboxedNode<Identifier> {
|
||||||
Identifier {
|
UnboxedNode::no_src(Identifier {
|
||||||
start: 0,
|
|
||||||
end: 0,
|
|
||||||
name: s.to_owned(),
|
name: s.to_owned(),
|
||||||
digest: None,
|
digest: None,
|
||||||
}
|
})
|
||||||
}
|
}
|
||||||
fn opt_param(s: &'static str) -> Parameter {
|
fn opt_param(s: &'static str) -> Parameter {
|
||||||
Parameter {
|
Parameter {
|
||||||
@ -3497,20 +3479,20 @@ let w = f() + f()
|
|||||||
),
|
),
|
||||||
] {
|
] {
|
||||||
// Run each test.
|
// Run each test.
|
||||||
let func_expr = &FunctionExpression {
|
let func_expr = &UnboxedNode::no_src(FunctionExpression {
|
||||||
start: 0,
|
|
||||||
end: 0,
|
|
||||||
params,
|
params,
|
||||||
body: crate::ast::types::Program {
|
body: UnboxedNode {
|
||||||
|
inner: crate::ast::types::Program {
|
||||||
|
body: Vec::new(),
|
||||||
|
non_code_meta: Default::default(),
|
||||||
|
digest: None,
|
||||||
|
},
|
||||||
start: 0,
|
start: 0,
|
||||||
end: 0,
|
end: 0,
|
||||||
body: Vec::new(),
|
|
||||||
non_code_meta: Default::default(),
|
|
||||||
digest: None,
|
|
||||||
},
|
},
|
||||||
return_type: None,
|
return_type: None,
|
||||||
digest: None,
|
digest: None,
|
||||||
};
|
});
|
||||||
let actual = assign_args_to_params(func_expr, args, ProgramMemory::new());
|
let actual = assign_args_to_params(func_expr, args, ProgramMemory::new());
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
actual, expected,
|
actual, expected,
|
||||||
|
@ -13,7 +13,7 @@ use crate::{
|
|||||||
pub struct FunctionParam<'a> {
|
pub struct FunctionParam<'a> {
|
||||||
pub inner: Option<&'a MemoryFunction>,
|
pub inner: Option<&'a MemoryFunction>,
|
||||||
pub memory: ProgramMemory,
|
pub memory: ProgramMemory,
|
||||||
pub fn_expr: Box<FunctionExpression>,
|
pub fn_expr: crate::ast::types::Node<FunctionExpression>,
|
||||||
pub meta: Vec<Metadata>,
|
pub meta: Vec<Metadata>,
|
||||||
pub ctx: ExecutorContext,
|
pub ctx: ExecutorContext,
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,7 @@ use std::sync::Arc;
|
|||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
ast::types::CallExpression,
|
ast::types::{CallExpression, NodeRef},
|
||||||
docs::StdLibFn,
|
docs::StdLibFn,
|
||||||
executor::SourceRange,
|
executor::SourceRange,
|
||||||
lint::rule::{def_finding, Discovered, Finding},
|
lint::rule::{def_finding, Discovered, Finding},
|
||||||
@ -18,7 +18,10 @@ 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."
|
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: &CallExpression) -> Result<Vec<Discovered>> {
|
fn lint_too_many_args_std_lib_function(
|
||||||
|
f: Box<dyn StdLibFn>,
|
||||||
|
exp: NodeRef<'_, CallExpression>,
|
||||||
|
) -> Result<Vec<Discovered>> {
|
||||||
let mut findings = vec![];
|
let mut findings = vec![];
|
||||||
|
|
||||||
if f.name() == "pow" {
|
if f.name() == "pow" {
|
||||||
|
@ -3,14 +3,14 @@
|
|||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use tower_lsp::lsp_types::notification::Notification;
|
use tower_lsp::lsp_types::notification::Notification;
|
||||||
|
|
||||||
use crate::settings::types::UnitLength;
|
use crate::{ast::types::UnboxedNode, settings::types::UnitLength};
|
||||||
|
|
||||||
/// A notification that the AST has changed.
|
/// A notification that the AST has changed.
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub enum AstUpdated {}
|
pub enum AstUpdated {}
|
||||||
|
|
||||||
impl Notification for AstUpdated {
|
impl Notification for AstUpdated {
|
||||||
type Params = crate::ast::types::Program;
|
type Params = UnboxedNode<crate::ast::types::Program>;
|
||||||
const METHOD: &'static str = "kcl/astUpdated";
|
const METHOD: &'static str = "kcl/astUpdated";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ use tower_lsp::{
|
|||||||
};
|
};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
ast::types::{Expr, VariableKind},
|
ast::types::{Expr, NodeRef, UnboxedNode, VariableKind},
|
||||||
executor::{IdGenerator, SourceRange},
|
executor::{IdGenerator, SourceRange},
|
||||||
lsp::{backend::Backend as _, util::IntoDiagnostic},
|
lsp::{backend::Backend as _, util::IntoDiagnostic},
|
||||||
parser::PIPE_OPERATOR,
|
parser::PIPE_OPERATOR,
|
||||||
@ -99,7 +99,7 @@ pub struct Backend {
|
|||||||
/// Token maps.
|
/// Token maps.
|
||||||
pub token_map: DashMap<String, Vec<crate::token::Token>>,
|
pub token_map: DashMap<String, Vec<crate::token::Token>>,
|
||||||
/// AST maps.
|
/// AST maps.
|
||||||
pub ast_map: DashMap<String, crate::ast::types::Program>,
|
pub ast_map: DashMap<String, UnboxedNode<crate::ast::types::Program>>,
|
||||||
/// Memory maps.
|
/// Memory maps.
|
||||||
pub memory_map: DashMap<String, crate::executor::ProgramMemory>,
|
pub memory_map: DashMap<String, crate::executor::ProgramMemory>,
|
||||||
/// Current code.
|
/// Current code.
|
||||||
@ -571,7 +571,7 @@ impl Backend {
|
|||||||
self.client.publish_diagnostics(params.uri.clone(), items, None).await;
|
self.client.publish_diagnostics(params.uri.clone(), items, None).await;
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn execute(&self, params: &TextDocumentItem, ast: &crate::ast::types::Program) -> Result<()> {
|
async fn execute(&self, params: &TextDocumentItem, ast: NodeRef<'_, crate::ast::types::Program>) -> Result<()> {
|
||||||
// Check if we can execute.
|
// Check if we can execute.
|
||||||
if !self.can_execute().await {
|
if !self.can_execute().await {
|
||||||
return Ok(());
|
return Ok(());
|
||||||
|
@ -7,6 +7,7 @@ use tower_lsp::{
|
|||||||
};
|
};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
|
ast::types::{Program, UnboxedNode},
|
||||||
executor::ProgramMemory,
|
executor::ProgramMemory,
|
||||||
lsp::test_util::{copilot_lsp_server, kcl_lsp_server},
|
lsp::test_util::{copilot_lsp_server, kcl_lsp_server},
|
||||||
};
|
};
|
||||||
@ -1070,7 +1071,7 @@ fn myFn = (param1) => {
|
|||||||
|
|
||||||
// Get the ast.
|
// Get the ast.
|
||||||
let ast = server.ast_map.get("file:///test.kcl").unwrap().clone();
|
let ast = server.ast_map.get("file:///test.kcl").unwrap().clone();
|
||||||
assert!(ast != crate::ast::types::Program::default());
|
assert!(ast != UnboxedNode::<Program>::default());
|
||||||
|
|
||||||
// Send semantic tokens request.
|
// Send semantic tokens request.
|
||||||
let semantic_tokens = server
|
let semantic_tokens = server
|
||||||
@ -2396,7 +2397,7 @@ async fn kcl_test_kcl_lsp_full_to_empty_file_updates_ast_and_memory() {
|
|||||||
|
|
||||||
// Get the ast.
|
// Get the ast.
|
||||||
let ast = server.ast_map.get("file:///test.kcl").unwrap().clone();
|
let ast = server.ast_map.get("file:///test.kcl").unwrap().clone();
|
||||||
assert!(ast != crate::ast::types::Program::default());
|
assert!(ast != UnboxedNode::<Program>::default());
|
||||||
// Get the memory.
|
// Get the memory.
|
||||||
let memory = server.memory_map.get("file:///test.kcl").unwrap().clone();
|
let memory = server.memory_map.get("file:///test.kcl").unwrap().clone();
|
||||||
assert!(memory != ProgramMemory::default());
|
assert!(memory != ProgramMemory::default());
|
||||||
@ -2416,7 +2417,7 @@ async fn kcl_test_kcl_lsp_full_to_empty_file_updates_ast_and_memory() {
|
|||||||
})
|
})
|
||||||
.await;
|
.await;
|
||||||
|
|
||||||
let mut default_hashed = crate::ast::types::Program::default();
|
let mut default_hashed = UnboxedNode::<Program>::default();
|
||||||
default_hashed.compute_digest();
|
default_hashed.compute_digest();
|
||||||
|
|
||||||
// Get the ast.
|
// Get the ast.
|
||||||
@ -2453,7 +2454,7 @@ async fn kcl_test_kcl_lsp_code_unchanged_but_has_diagnostics_reexecute() {
|
|||||||
|
|
||||||
// Get the ast.
|
// Get the ast.
|
||||||
let ast = server.ast_map.get("file:///test.kcl").unwrap().clone();
|
let ast = server.ast_map.get("file:///test.kcl").unwrap().clone();
|
||||||
assert!(ast != crate::ast::types::Program::default());
|
assert!(ast != UnboxedNode::<Program>::default());
|
||||||
// Get the memory.
|
// Get the memory.
|
||||||
let memory = server.memory_map.get("file:///test.kcl").unwrap().clone();
|
let memory = server.memory_map.get("file:///test.kcl").unwrap().clone();
|
||||||
assert!(memory != ProgramMemory::default());
|
assert!(memory != ProgramMemory::default());
|
||||||
@ -2487,9 +2488,9 @@ async fn kcl_test_kcl_lsp_code_unchanged_but_has_diagnostics_reexecute() {
|
|||||||
// Clear the ast and memory.
|
// Clear the ast and memory.
|
||||||
server
|
server
|
||||||
.ast_map
|
.ast_map
|
||||||
.insert("file:///test.kcl".to_string(), crate::ast::types::Program::default());
|
.insert("file:///test.kcl".to_string(), UnboxedNode::<Program>::default());
|
||||||
let ast = server.ast_map.get("file:///test.kcl").unwrap().clone();
|
let ast = server.ast_map.get("file:///test.kcl").unwrap().clone();
|
||||||
assert_eq!(ast, crate::ast::types::Program::default());
|
assert_eq!(ast, UnboxedNode::<Program>::default());
|
||||||
server
|
server
|
||||||
.memory_map
|
.memory_map
|
||||||
.insert("file:///test.kcl".to_string(), ProgramMemory::default());
|
.insert("file:///test.kcl".to_string(), ProgramMemory::default());
|
||||||
@ -2513,7 +2514,7 @@ async fn kcl_test_kcl_lsp_code_unchanged_but_has_diagnostics_reexecute() {
|
|||||||
|
|
||||||
// Get the ast.
|
// Get the ast.
|
||||||
let ast = server.ast_map.get("file:///test.kcl").unwrap().clone();
|
let ast = server.ast_map.get("file:///test.kcl").unwrap().clone();
|
||||||
assert!(ast != crate::ast::types::Program::default());
|
assert!(ast != UnboxedNode::<Program>::default());
|
||||||
// Get the memory.
|
// Get the memory.
|
||||||
let memory = server.memory_map.get("file:///test.kcl").unwrap().clone();
|
let memory = server.memory_map.get("file:///test.kcl").unwrap().clone();
|
||||||
assert!(memory != ProgramMemory::default());
|
assert!(memory != ProgramMemory::default());
|
||||||
@ -2549,7 +2550,7 @@ async fn kcl_test_kcl_lsp_code_and_ast_unchanged_but_has_diagnostics_reexecute()
|
|||||||
|
|
||||||
// Get the ast.
|
// Get the ast.
|
||||||
let ast = server.ast_map.get("file:///test.kcl").unwrap().clone();
|
let ast = server.ast_map.get("file:///test.kcl").unwrap().clone();
|
||||||
assert!(ast != crate::ast::types::Program::default());
|
assert!(ast != UnboxedNode::<Program>::default());
|
||||||
// Get the memory.
|
// Get the memory.
|
||||||
let memory = server.memory_map.get("file:///test.kcl").unwrap().clone();
|
let memory = server.memory_map.get("file:///test.kcl").unwrap().clone();
|
||||||
assert!(memory != ProgramMemory::default());
|
assert!(memory != ProgramMemory::default());
|
||||||
@ -2604,7 +2605,7 @@ async fn kcl_test_kcl_lsp_code_and_ast_unchanged_but_has_diagnostics_reexecute()
|
|||||||
|
|
||||||
// Get the ast.
|
// Get the ast.
|
||||||
let ast = server.ast_map.get("file:///test.kcl").unwrap().clone();
|
let ast = server.ast_map.get("file:///test.kcl").unwrap().clone();
|
||||||
assert!(ast != crate::ast::types::Program::default());
|
assert!(ast != UnboxedNode::<Program>::default());
|
||||||
// Get the memory.
|
// Get the memory.
|
||||||
let memory = server.memory_map.get("file:///test.kcl").unwrap().clone();
|
let memory = server.memory_map.get("file:///test.kcl").unwrap().clone();
|
||||||
assert!(memory != ProgramMemory::default());
|
assert!(memory != ProgramMemory::default());
|
||||||
@ -2640,7 +2641,7 @@ async fn kcl_test_kcl_lsp_code_and_ast_units_unchanged_but_has_diagnostics_reexe
|
|||||||
|
|
||||||
// Get the ast.
|
// Get the ast.
|
||||||
let ast = server.ast_map.get("file:///test.kcl").unwrap().clone();
|
let ast = server.ast_map.get("file:///test.kcl").unwrap().clone();
|
||||||
assert!(ast != crate::ast::types::Program::default());
|
assert!(ast != UnboxedNode::<Program>::default());
|
||||||
// Get the memory.
|
// Get the memory.
|
||||||
let memory = server.memory_map.get("file:///test.kcl").unwrap().clone();
|
let memory = server.memory_map.get("file:///test.kcl").unwrap().clone();
|
||||||
assert!(memory != ProgramMemory::default());
|
assert!(memory != ProgramMemory::default());
|
||||||
@ -2698,7 +2699,7 @@ async fn kcl_test_kcl_lsp_code_and_ast_units_unchanged_but_has_diagnostics_reexe
|
|||||||
|
|
||||||
// Get the ast.
|
// Get the ast.
|
||||||
let ast = server.ast_map.get("file:///test.kcl").unwrap().clone();
|
let ast = server.ast_map.get("file:///test.kcl").unwrap().clone();
|
||||||
assert!(ast != crate::ast::types::Program::default());
|
assert!(ast != UnboxedNode::<Program>::default());
|
||||||
// Get the memory.
|
// Get the memory.
|
||||||
let memory = server.memory_map.get("file:///test.kcl").unwrap().clone();
|
let memory = server.memory_map.get("file:///test.kcl").unwrap().clone();
|
||||||
assert!(memory != ProgramMemory::default());
|
assert!(memory != ProgramMemory::default());
|
||||||
@ -2734,7 +2735,7 @@ async fn kcl_test_kcl_lsp_code_and_ast_units_unchanged_but_has_memory_reexecute_
|
|||||||
|
|
||||||
// Get the ast.
|
// Get the ast.
|
||||||
let ast = server.ast_map.get("file:///test.kcl").unwrap().clone();
|
let ast = server.ast_map.get("file:///test.kcl").unwrap().clone();
|
||||||
assert!(ast != crate::ast::types::Program::default());
|
assert!(ast != UnboxedNode::<Program>::default());
|
||||||
// Get the memory.
|
// Get the memory.
|
||||||
let memory = server.memory_map.get("file:///test.kcl").unwrap().clone();
|
let memory = server.memory_map.get("file:///test.kcl").unwrap().clone();
|
||||||
assert!(memory != ProgramMemory::default());
|
assert!(memory != ProgramMemory::default());
|
||||||
@ -2770,7 +2771,7 @@ async fn kcl_test_kcl_lsp_code_and_ast_units_unchanged_but_has_memory_reexecute_
|
|||||||
|
|
||||||
// Get the ast.
|
// Get the ast.
|
||||||
let ast = server.ast_map.get("file:///test.kcl").unwrap().clone();
|
let ast = server.ast_map.get("file:///test.kcl").unwrap().clone();
|
||||||
assert!(ast != crate::ast::types::Program::default());
|
assert!(ast != UnboxedNode::<Program>::default());
|
||||||
// Get the memory.
|
// Get the memory.
|
||||||
let memory = server.memory_map.get("file:///test.kcl").unwrap().clone();
|
let memory = server.memory_map.get("file:///test.kcl").unwrap().clone();
|
||||||
assert!(memory != ProgramMemory::default());
|
assert!(memory != ProgramMemory::default());
|
||||||
@ -2806,7 +2807,7 @@ async fn kcl_test_kcl_lsp_cant_execute_set() {
|
|||||||
|
|
||||||
// Get the ast.
|
// Get the ast.
|
||||||
let ast = server.ast_map.get("file:///test.kcl").unwrap().clone();
|
let ast = server.ast_map.get("file:///test.kcl").unwrap().clone();
|
||||||
assert!(ast != crate::ast::types::Program::default());
|
assert!(ast != UnboxedNode::<Program>::default());
|
||||||
// Get the memory.
|
// Get the memory.
|
||||||
let memory = server.memory_map.get("file:///test.kcl").unwrap().clone();
|
let memory = server.memory_map.get("file:///test.kcl").unwrap().clone();
|
||||||
assert!(memory != ProgramMemory::default());
|
assert!(memory != ProgramMemory::default());
|
||||||
@ -2841,7 +2842,7 @@ async fn kcl_test_kcl_lsp_cant_execute_set() {
|
|||||||
|
|
||||||
// Get the ast.
|
// Get the ast.
|
||||||
let ast = server.ast_map.get("file:///test.kcl").unwrap().clone();
|
let ast = server.ast_map.get("file:///test.kcl").unwrap().clone();
|
||||||
assert!(ast != crate::ast::types::Program::default());
|
assert!(ast != UnboxedNode::<Program>::default());
|
||||||
// Get the memory.
|
// Get the memory.
|
||||||
let memory = server.memory_map.get("file:///test.kcl").unwrap().clone();
|
let memory = server.memory_map.get("file:///test.kcl").unwrap().clone();
|
||||||
assert!(memory != ProgramMemory::default());
|
assert!(memory != ProgramMemory::default());
|
||||||
@ -2883,7 +2884,7 @@ async fn kcl_test_kcl_lsp_cant_execute_set() {
|
|||||||
let units = server.executor_ctx().await.clone().unwrap().settings.units;
|
let units = server.executor_ctx().await.clone().unwrap().settings.units;
|
||||||
assert_eq!(units, crate::settings::types::UnitLength::Mm);
|
assert_eq!(units, crate::settings::types::UnitLength::Mm);
|
||||||
|
|
||||||
let mut default_hashed = crate::ast::types::Program::default();
|
let mut default_hashed = UnboxedNode::<Program>::default();
|
||||||
default_hashed.compute_digest();
|
default_hashed.compute_digest();
|
||||||
|
|
||||||
// Get the ast.
|
// Get the ast.
|
||||||
@ -2924,7 +2925,7 @@ async fn kcl_test_kcl_lsp_cant_execute_set() {
|
|||||||
|
|
||||||
// Get the ast.
|
// Get the ast.
|
||||||
let ast = server.ast_map.get("file:///test.kcl").unwrap().clone();
|
let ast = server.ast_map.get("file:///test.kcl").unwrap().clone();
|
||||||
assert!(ast != crate::ast::types::Program::default());
|
assert!(ast != UnboxedNode::<Program>::default());
|
||||||
// Get the memory.
|
// Get the memory.
|
||||||
let memory = server.memory_map.get("file:///test.kcl").unwrap().clone();
|
let memory = server.memory_map.get("file:///test.kcl").unwrap().clone();
|
||||||
// Now it should NOT be the default memory.
|
// Now it should NOT be the default memory.
|
||||||
@ -3064,7 +3065,7 @@ const part001 = startSketchOn('XY')
|
|||||||
|
|
||||||
// Get the ast.
|
// Get the ast.
|
||||||
let ast = server.ast_map.get("file:///test.kcl").unwrap().clone();
|
let ast = server.ast_map.get("file:///test.kcl").unwrap().clone();
|
||||||
assert!(ast != crate::ast::types::Program::default());
|
assert!(ast != UnboxedNode::<Program>::default());
|
||||||
|
|
||||||
// Assure we have one diagnostics.
|
// Assure we have one diagnostics.
|
||||||
let diagnostics = server.diagnostics_map.get("file:///test.kcl").unwrap().clone();
|
let diagnostics = server.diagnostics_map.get("file:///test.kcl").unwrap().clone();
|
||||||
@ -3087,7 +3088,7 @@ const part001 = startSketchOn('XY')
|
|||||||
|
|
||||||
// Get the ast.
|
// Get the ast.
|
||||||
let ast = server.ast_map.get("file:///test.kcl").unwrap().clone();
|
let ast = server.ast_map.get("file:///test.kcl").unwrap().clone();
|
||||||
assert!(ast != crate::ast::types::Program::default());
|
assert!(ast != UnboxedNode::<Program>::default());
|
||||||
|
|
||||||
// Assure we have one diagnostics.
|
// Assure we have one diagnostics.
|
||||||
let diagnostics = server.diagnostics_map.get("file:///test.kcl").unwrap().clone();
|
let diagnostics = server.diagnostics_map.get("file:///test.kcl").unwrap().clone();
|
||||||
@ -3183,7 +3184,7 @@ const part001 = startSketchOn('XY')
|
|||||||
|
|
||||||
// Get the ast.
|
// Get the ast.
|
||||||
let ast = server.ast_map.get("file:///test.kcl").unwrap().clone();
|
let ast = server.ast_map.get("file:///test.kcl").unwrap().clone();
|
||||||
assert!(ast != crate::ast::types::Program::default());
|
assert!(ast != UnboxedNode::<Program>::default());
|
||||||
// Get the memory.
|
// Get the memory.
|
||||||
let memory = server.memory_map.get("file:///test.kcl");
|
let memory = server.memory_map.get("file:///test.kcl");
|
||||||
assert!(memory.is_none());
|
assert!(memory.is_none());
|
||||||
@ -3205,7 +3206,7 @@ const part001 = startSketchOn('XY')
|
|||||||
|
|
||||||
// Get the ast.
|
// Get the ast.
|
||||||
let ast = server.ast_map.get("file:///test.kcl").unwrap().clone();
|
let ast = server.ast_map.get("file:///test.kcl").unwrap().clone();
|
||||||
assert!(ast != crate::ast::types::Program::default());
|
assert!(ast != UnboxedNode::<Program>::default());
|
||||||
// Get the memory.
|
// Get the memory.
|
||||||
let memory = server.memory_map.get("file:///test.kcl");
|
let memory = server.memory_map.get("file:///test.kcl");
|
||||||
assert!(memory.is_none());
|
assert!(memory.is_none());
|
||||||
@ -3248,7 +3249,7 @@ const part001 = startSketchOn('XY')
|
|||||||
|
|
||||||
// Get the ast.
|
// Get the ast.
|
||||||
let ast = server.ast_map.get("file:///test.kcl").unwrap().clone();
|
let ast = server.ast_map.get("file:///test.kcl").unwrap().clone();
|
||||||
assert!(ast != crate::ast::types::Program::default());
|
assert!(ast != UnboxedNode::<Program>::default());
|
||||||
// Get the memory.
|
// Get the memory.
|
||||||
let memory = server.memory_map.get("file:///test.kcl");
|
let memory = server.memory_map.get("file:///test.kcl");
|
||||||
assert!(memory.is_none());
|
assert!(memory.is_none());
|
||||||
@ -3278,7 +3279,7 @@ const NEW_LINT = 1"#
|
|||||||
|
|
||||||
// Get the ast.
|
// Get the ast.
|
||||||
let ast = server.ast_map.get("file:///test.kcl").unwrap().clone();
|
let ast = server.ast_map.get("file:///test.kcl").unwrap().clone();
|
||||||
assert!(ast != crate::ast::types::Program::default());
|
assert!(ast != UnboxedNode::<Program>::default());
|
||||||
// Get the memory.
|
// Get the memory.
|
||||||
let memory = server.memory_map.get("file:///test.kcl");
|
let memory = server.memory_map.get("file:///test.kcl");
|
||||||
assert!(memory.is_none());
|
assert!(memory.is_none());
|
||||||
@ -3394,7 +3395,7 @@ const part001 = startSketchOn('XY')
|
|||||||
|
|
||||||
// Get the ast.
|
// Get the ast.
|
||||||
let ast = server.ast_map.get("file:///test.kcl").unwrap().clone();
|
let ast = server.ast_map.get("file:///test.kcl").unwrap().clone();
|
||||||
assert!(ast != crate::ast::types::Program::default());
|
assert!(ast != UnboxedNode::<Program>::default());
|
||||||
|
|
||||||
// Get the symbols map.
|
// Get the symbols map.
|
||||||
let symbols_map = server.symbols_map.get("file:///test.kcl").unwrap().clone();
|
let symbols_map = server.symbols_map.get("file:///test.kcl").unwrap().clone();
|
||||||
@ -3489,7 +3490,7 @@ const part001 = startSketchOn('XY')
|
|||||||
|
|
||||||
// Get the ast.
|
// Get the ast.
|
||||||
let ast = server.ast_map.get("file:///test.kcl").unwrap().clone();
|
let ast = server.ast_map.get("file:///test.kcl").unwrap().clone();
|
||||||
assert!(ast != crate::ast::types::Program::default());
|
assert!(ast != UnboxedNode::<Program>::default());
|
||||||
|
|
||||||
// Get the symbols map.
|
// Get the symbols map.
|
||||||
let symbols_map = server.symbols_map.get("file:///test.kcl").unwrap().clone();
|
let symbols_map = server.symbols_map.get("file:///test.kcl").unwrap().clone();
|
||||||
@ -3532,7 +3533,7 @@ const part001 = startSketchOn('XY')
|
|||||||
|
|
||||||
// Get the ast.
|
// Get the ast.
|
||||||
let ast = server.ast_map.get("file:///test.kcl").unwrap().clone();
|
let ast = server.ast_map.get("file:///test.kcl").unwrap().clone();
|
||||||
assert!(ast != crate::ast::types::Program::default());
|
assert!(ast != UnboxedNode::<Program>::default());
|
||||||
|
|
||||||
// Get the symbols map.
|
// Get the symbols map.
|
||||||
let symbols_map = server.symbols_map.get("file:///test.kcl").unwrap().clone();
|
let symbols_map = server.symbols_map.get("file:///test.kcl").unwrap().clone();
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
use crate::{
|
use crate::{
|
||||||
ast::types::Program,
|
ast::types::{Program, UnboxedNode},
|
||||||
errors::{KclError, KclErrorDetails},
|
errors::{KclError, KclErrorDetails},
|
||||||
executor::SourceRange,
|
executor::SourceRange,
|
||||||
token::{Token, TokenType},
|
token::{Token, TokenType},
|
||||||
@ -13,7 +13,7 @@ pub const PIPE_SUBSTITUTION_OPERATOR: &str = "%";
|
|||||||
pub const PIPE_OPERATOR: &str = "|>";
|
pub const PIPE_OPERATOR: &str = "|>";
|
||||||
|
|
||||||
/// Parse the given KCL code into an AST.
|
/// Parse the given KCL code into an AST.
|
||||||
pub fn parse(code: &str) -> Result<Program, KclError> {
|
pub fn parse(code: &str) -> Result<UnboxedNode<Program>, KclError> {
|
||||||
let tokens = crate::token::lexer(code)?;
|
let tokens = crate::token::lexer(code)?;
|
||||||
let parser = Parser::new(tokens);
|
let parser = Parser::new(tokens);
|
||||||
parser.ast()
|
parser.ast()
|
||||||
@ -33,7 +33,7 @@ impl Parser {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Run the parser
|
/// Run the parser
|
||||||
pub fn ast(&self) -> Result<Program, KclError> {
|
pub fn ast(&self) -> Result<UnboxedNode<Program>, KclError> {
|
||||||
if !self.unknown_tokens.is_empty() {
|
if !self.unknown_tokens.is_empty() {
|
||||||
let source_ranges = self.unknown_tokens.iter().map(SourceRange::from).collect();
|
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<_>>();
|
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.
|
// Important, to not call this before the unknown tokens check.
|
||||||
if self.tokens.is_empty() {
|
if self.tokens.is_empty() {
|
||||||
// Empty file should just do nothing.
|
// Empty file should just do nothing.
|
||||||
return Ok(Program::default());
|
return Ok(UnboxedNode::<Program>::default());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check all the tokens are whitespace or comments.
|
// Check all the tokens are whitespace or comments.
|
||||||
@ -57,7 +57,7 @@ impl Parser {
|
|||||||
.iter()
|
.iter()
|
||||||
.all(|t| t.token_type.is_whitespace() || t.token_type.is_comment())
|
.all(|t| t.token_type.is_whitespace() || t.token_type.is_comment())
|
||||||
{
|
{
|
||||||
return Ok(Program::default());
|
return Ok(UnboxedNode::<Program>::default());
|
||||||
}
|
}
|
||||||
|
|
||||||
parser_impl::run_parser(&mut self.tokens.as_slice())
|
parser_impl::run_parser(&mut self.tokens.as_slice())
|
||||||
|
@ -1,18 +1,18 @@
|
|||||||
use crate::{
|
use crate::{
|
||||||
ast::types::{BinaryExpression, BinaryOperator, BinaryPart},
|
ast::types::{BinaryExpression, BinaryOperator, BinaryPart, UnboxedNode},
|
||||||
errors::{KclError, KclErrorDetails},
|
errors::{KclError, KclErrorDetails},
|
||||||
executor::SourceRange,
|
executor::SourceRange,
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Parses a list of tokens (in infix order, i.e. as the user typed them)
|
/// Parses a list of tokens (in infix order, i.e. as the user typed them)
|
||||||
/// into a binary expression tree.
|
/// into a binary expression tree.
|
||||||
pub fn parse(infix_tokens: Vec<BinaryExpressionToken>) -> Result<BinaryExpression, KclError> {
|
pub fn parse(infix_tokens: Vec<BinaryExpressionToken>) -> Result<UnboxedNode<BinaryExpression>, KclError> {
|
||||||
let rpn = postfix(infix_tokens);
|
let rpn = postfix(infix_tokens);
|
||||||
evaluate(rpn)
|
evaluate(rpn)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Parses a list of tokens (in postfix order) into a binary expression tree.
|
/// Parses a list of tokens (in postfix order) into a binary expression tree.
|
||||||
fn evaluate(rpn: Vec<BinaryExpressionToken>) -> Result<BinaryExpression, KclError> {
|
fn evaluate(rpn: Vec<BinaryExpressionToken>) -> Result<UnboxedNode<BinaryExpression>, KclError> {
|
||||||
let source_ranges = source_range(&rpn);
|
let source_ranges = source_range(&rpn);
|
||||||
let mut operand_stack: Vec<BinaryPart> = Vec::new();
|
let mut operand_stack: Vec<BinaryPart> = Vec::new();
|
||||||
let e = KclError::Internal(KclErrorDetails {
|
let e = KclError::Internal(KclErrorDetails {
|
||||||
@ -28,14 +28,19 @@ fn evaluate(rpn: Vec<BinaryExpressionToken>) -> Result<BinaryExpression, KclErro
|
|||||||
let Some(left) = operand_stack.pop() else {
|
let Some(left) = operand_stack.pop() else {
|
||||||
return Err(e);
|
return Err(e);
|
||||||
};
|
};
|
||||||
BinaryPart::BinaryExpression(Box::new(BinaryExpression {
|
let start = left.start();
|
||||||
start: left.start(),
|
let end = right.end();
|
||||||
end: right.end(),
|
|
||||||
operator,
|
BinaryPart::BinaryExpression(UnboxedNode::boxed(
|
||||||
left,
|
BinaryExpression {
|
||||||
right,
|
operator,
|
||||||
digest: None,
|
left,
|
||||||
}))
|
right,
|
||||||
|
digest: None,
|
||||||
|
},
|
||||||
|
start,
|
||||||
|
end,
|
||||||
|
))
|
||||||
}
|
}
|
||||||
BinaryExpressionToken::Operand(o) => o,
|
BinaryExpressionToken::Operand(o) => o,
|
||||||
};
|
};
|
||||||
@ -125,13 +130,15 @@ mod tests {
|
|||||||
fn parse_and_evaluate() {
|
fn parse_and_evaluate() {
|
||||||
/// Make a literal
|
/// Make a literal
|
||||||
fn lit(n: u8) -> BinaryPart {
|
fn lit(n: u8) -> BinaryPart {
|
||||||
BinaryPart::Literal(Box::new(Literal {
|
BinaryPart::Literal(UnboxedNode::new(
|
||||||
start: 0,
|
Literal {
|
||||||
end: 0,
|
value: n.into(),
|
||||||
value: n.into(),
|
raw: n.to_string(),
|
||||||
raw: n.to_string(),
|
digest: None,
|
||||||
digest: None,
|
},
|
||||||
}))
|
0,
|
||||||
|
0,
|
||||||
|
))
|
||||||
}
|
}
|
||||||
let tests: Vec<Vec<BinaryExpressionToken>> = vec![
|
let tests: Vec<Vec<BinaryExpressionToken>> = vec![
|
||||||
// 3 + 4 × 2 ÷ ( 1 − 5 ) ^ 2 ^ 3
|
// 3 + 4 × 2 ÷ ( 1 − 5 ) ^ 2 ^ 3
|
||||||
@ -142,14 +149,16 @@ mod tests {
|
|||||||
BinaryOperator::Mul.into(),
|
BinaryOperator::Mul.into(),
|
||||||
lit(2).into(),
|
lit(2).into(),
|
||||||
BinaryOperator::Div.into(),
|
BinaryOperator::Div.into(),
|
||||||
BinaryPart::BinaryExpression(Box::new(BinaryExpression {
|
BinaryPart::BinaryExpression(UnboxedNode::boxed(
|
||||||
start: 0,
|
BinaryExpression {
|
||||||
end: 0,
|
operator: BinaryOperator::Sub,
|
||||||
operator: BinaryOperator::Sub,
|
left: lit(1),
|
||||||
left: lit(1),
|
right: lit(5),
|
||||||
right: lit(5),
|
digest: None,
|
||||||
digest: None,
|
},
|
||||||
}))
|
0,
|
||||||
|
0,
|
||||||
|
))
|
||||||
.into(),
|
.into(),
|
||||||
BinaryOperator::Pow.into(),
|
BinaryOperator::Pow.into(),
|
||||||
lit(2).into(),
|
lit(2).into(),
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -1,26 +1,36 @@
|
|||||||
---
|
---
|
||||||
source: kcl/src/parser/parser_impl.rs
|
source: kcl/src/parser/parser_impl.rs
|
||||||
|
assertion_line: 3567
|
||||||
expression: actual
|
expression: actual
|
||||||
---
|
---
|
||||||
{
|
{
|
||||||
"type": "BinaryExpression",
|
"type": "UnboxedNode",
|
||||||
"start": 0,
|
"kind": {
|
||||||
"end": 5,
|
"type": "BinaryExpression",
|
||||||
"operator": "+",
|
"operator": "+",
|
||||||
"left": {
|
"left": {
|
||||||
"type": "Literal",
|
"type": "Literal",
|
||||||
"type": "Literal",
|
"type": "UnboxedNode",
|
||||||
"start": 0,
|
"kind": {
|
||||||
"end": 1,
|
"type": "Literal",
|
||||||
"value": 1,
|
"value": 1,
|
||||||
"raw": "1"
|
"raw": "1"
|
||||||
|
},
|
||||||
|
"start": 0,
|
||||||
|
"end": 1
|
||||||
|
},
|
||||||
|
"right": {
|
||||||
|
"type": "Literal",
|
||||||
|
"type": "UnboxedNode",
|
||||||
|
"kind": {
|
||||||
|
"type": "Literal",
|
||||||
|
"value": 2,
|
||||||
|
"raw": "2"
|
||||||
|
},
|
||||||
|
"start": 4,
|
||||||
|
"end": 5
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"right": {
|
"start": 0,
|
||||||
"type": "Literal",
|
"end": 5
|
||||||
"type": "Literal",
|
|
||||||
"start": 4,
|
|
||||||
"end": 5,
|
|
||||||
"value": 2,
|
|
||||||
"raw": "2"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -1,26 +1,36 @@
|
|||||||
---
|
---
|
||||||
source: kcl/src/parser/parser_impl.rs
|
source: kcl/src/parser/parser_impl.rs
|
||||||
|
assertion_line: 3568
|
||||||
expression: actual
|
expression: actual
|
||||||
---
|
---
|
||||||
{
|
{
|
||||||
"type": "BinaryExpression",
|
"type": "UnboxedNode",
|
||||||
"start": 0,
|
"kind": {
|
||||||
"end": 3,
|
"type": "BinaryExpression",
|
||||||
"operator": "+",
|
"operator": "+",
|
||||||
"left": {
|
"left": {
|
||||||
"type": "Literal",
|
"type": "Literal",
|
||||||
"type": "Literal",
|
"type": "UnboxedNode",
|
||||||
"start": 0,
|
"kind": {
|
||||||
"end": 1,
|
"type": "Literal",
|
||||||
"value": 1,
|
"value": 1,
|
||||||
"raw": "1"
|
"raw": "1"
|
||||||
|
},
|
||||||
|
"start": 0,
|
||||||
|
"end": 1
|
||||||
|
},
|
||||||
|
"right": {
|
||||||
|
"type": "Literal",
|
||||||
|
"type": "UnboxedNode",
|
||||||
|
"kind": {
|
||||||
|
"type": "Literal",
|
||||||
|
"value": 2,
|
||||||
|
"raw": "2"
|
||||||
|
},
|
||||||
|
"start": 2,
|
||||||
|
"end": 3
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"right": {
|
"start": 0,
|
||||||
"type": "Literal",
|
"end": 3
|
||||||
"type": "Literal",
|
|
||||||
"start": 2,
|
|
||||||
"end": 3,
|
|
||||||
"value": 2,
|
|
||||||
"raw": "2"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -1,26 +1,36 @@
|
|||||||
---
|
---
|
||||||
source: kcl/src/parser/parser_impl.rs
|
source: kcl/src/parser/parser_impl.rs
|
||||||
|
assertion_line: 3569
|
||||||
expression: actual
|
expression: actual
|
||||||
---
|
---
|
||||||
{
|
{
|
||||||
"type": "BinaryExpression",
|
"type": "UnboxedNode",
|
||||||
"start": 0,
|
"kind": {
|
||||||
"end": 4,
|
"type": "BinaryExpression",
|
||||||
"operator": "-",
|
"operator": "-",
|
||||||
"left": {
|
"left": {
|
||||||
"type": "Literal",
|
"type": "Literal",
|
||||||
"type": "Literal",
|
"type": "UnboxedNode",
|
||||||
"start": 0,
|
"kind": {
|
||||||
"end": 1,
|
"type": "Literal",
|
||||||
"value": 1,
|
"value": 1,
|
||||||
"raw": "1"
|
"raw": "1"
|
||||||
|
},
|
||||||
|
"start": 0,
|
||||||
|
"end": 1
|
||||||
|
},
|
||||||
|
"right": {
|
||||||
|
"type": "Literal",
|
||||||
|
"type": "UnboxedNode",
|
||||||
|
"kind": {
|
||||||
|
"type": "Literal",
|
||||||
|
"value": 2,
|
||||||
|
"raw": "2"
|
||||||
|
},
|
||||||
|
"start": 3,
|
||||||
|
"end": 4
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"right": {
|
"start": 0,
|
||||||
"type": "Literal",
|
"end": 4
|
||||||
"type": "Literal",
|
|
||||||
"start": 3,
|
|
||||||
"end": 4,
|
|
||||||
"value": 2,
|
|
||||||
"raw": "2"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -1,41 +1,57 @@
|
|||||||
---
|
---
|
||||||
source: kcl/src/parser/parser_impl.rs
|
source: kcl/src/parser/parser_impl.rs
|
||||||
|
assertion_line: 3570
|
||||||
expression: actual
|
expression: actual
|
||||||
---
|
---
|
||||||
{
|
{
|
||||||
"type": "BinaryExpression",
|
"type": "UnboxedNode",
|
||||||
"start": 0,
|
"kind": {
|
||||||
"end": 9,
|
|
||||||
"operator": "+",
|
|
||||||
"left": {
|
|
||||||
"type": "Literal",
|
|
||||||
"type": "Literal",
|
|
||||||
"start": 0,
|
|
||||||
"end": 1,
|
|
||||||
"value": 1,
|
|
||||||
"raw": "1"
|
|
||||||
},
|
|
||||||
"right": {
|
|
||||||
"type": "BinaryExpression",
|
"type": "BinaryExpression",
|
||||||
"type": "BinaryExpression",
|
"operator": "+",
|
||||||
"start": 4,
|
|
||||||
"end": 9,
|
|
||||||
"operator": "*",
|
|
||||||
"left": {
|
"left": {
|
||||||
"type": "Literal",
|
"type": "Literal",
|
||||||
"type": "Literal",
|
"type": "UnboxedNode",
|
||||||
"start": 4,
|
"kind": {
|
||||||
"end": 5,
|
"type": "Literal",
|
||||||
"value": 2,
|
"value": 1,
|
||||||
"raw": "2"
|
"raw": "1"
|
||||||
|
},
|
||||||
|
"start": 0,
|
||||||
|
"end": 1
|
||||||
},
|
},
|
||||||
"right": {
|
"right": {
|
||||||
"type": "Literal",
|
"type": "BinaryExpression",
|
||||||
"type": "Literal",
|
"type": "UnboxedNode",
|
||||||
"start": 8,
|
"kind": {
|
||||||
"end": 9,
|
"type": "BinaryExpression",
|
||||||
"value": 3,
|
"operator": "*",
|
||||||
"raw": "3"
|
"left": {
|
||||||
|
"type": "Literal",
|
||||||
|
"type": "UnboxedNode",
|
||||||
|
"kind": {
|
||||||
|
"type": "Literal",
|
||||||
|
"value": 2,
|
||||||
|
"raw": "2"
|
||||||
|
},
|
||||||
|
"start": 4,
|
||||||
|
"end": 5
|
||||||
|
},
|
||||||
|
"right": {
|
||||||
|
"type": "Literal",
|
||||||
|
"type": "UnboxedNode",
|
||||||
|
"kind": {
|
||||||
|
"type": "Literal",
|
||||||
|
"value": 3,
|
||||||
|
"raw": "3"
|
||||||
|
},
|
||||||
|
"start": 8,
|
||||||
|
"end": 9
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"start": 4,
|
||||||
|
"end": 9
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
"start": 0,
|
||||||
|
"end": 9
|
||||||
}
|
}
|
||||||
|
@ -1,41 +1,57 @@
|
|||||||
---
|
---
|
||||||
source: kcl/src/parser/parser_impl.rs
|
source: kcl/src/parser/parser_impl.rs
|
||||||
|
assertion_line: 3571
|
||||||
expression: actual
|
expression: actual
|
||||||
---
|
---
|
||||||
{
|
{
|
||||||
"type": "BinaryExpression",
|
"type": "UnboxedNode",
|
||||||
"start": 0,
|
"kind": {
|
||||||
"end": 11,
|
|
||||||
"operator": "*",
|
|
||||||
"left": {
|
|
||||||
"type": "Literal",
|
|
||||||
"type": "Literal",
|
|
||||||
"start": 0,
|
|
||||||
"end": 1,
|
|
||||||
"value": 1,
|
|
||||||
"raw": "1"
|
|
||||||
},
|
|
||||||
"right": {
|
|
||||||
"type": "BinaryExpression",
|
"type": "BinaryExpression",
|
||||||
"type": "BinaryExpression",
|
"operator": "*",
|
||||||
"start": 6,
|
|
||||||
"end": 11,
|
|
||||||
"operator": "+",
|
|
||||||
"left": {
|
"left": {
|
||||||
"type": "Literal",
|
"type": "Literal",
|
||||||
"type": "Literal",
|
"type": "UnboxedNode",
|
||||||
"start": 6,
|
"kind": {
|
||||||
"end": 7,
|
"type": "Literal",
|
||||||
"value": 2,
|
"value": 1,
|
||||||
"raw": "2"
|
"raw": "1"
|
||||||
|
},
|
||||||
|
"start": 0,
|
||||||
|
"end": 1
|
||||||
},
|
},
|
||||||
"right": {
|
"right": {
|
||||||
"type": "Literal",
|
"type": "BinaryExpression",
|
||||||
"type": "Literal",
|
"type": "UnboxedNode",
|
||||||
"start": 10,
|
"kind": {
|
||||||
"end": 11,
|
"type": "BinaryExpression",
|
||||||
"value": 3,
|
"operator": "+",
|
||||||
"raw": "3"
|
"left": {
|
||||||
|
"type": "Literal",
|
||||||
|
"type": "UnboxedNode",
|
||||||
|
"kind": {
|
||||||
|
"type": "Literal",
|
||||||
|
"value": 2,
|
||||||
|
"raw": "2"
|
||||||
|
},
|
||||||
|
"start": 6,
|
||||||
|
"end": 7
|
||||||
|
},
|
||||||
|
"right": {
|
||||||
|
"type": "Literal",
|
||||||
|
"type": "UnboxedNode",
|
||||||
|
"kind": {
|
||||||
|
"type": "Literal",
|
||||||
|
"value": 3,
|
||||||
|
"raw": "3"
|
||||||
|
},
|
||||||
|
"start": 10,
|
||||||
|
"end": 11
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"start": 6,
|
||||||
|
"end": 11
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
"start": 0,
|
||||||
|
"end": 11
|
||||||
}
|
}
|
||||||
|
@ -1,56 +1,78 @@
|
|||||||
---
|
---
|
||||||
source: kcl/src/parser/parser_impl.rs
|
source: kcl/src/parser/parser_impl.rs
|
||||||
|
assertion_line: 3572
|
||||||
expression: actual
|
expression: actual
|
||||||
---
|
---
|
||||||
{
|
{
|
||||||
"type": "BinaryExpression",
|
"type": "UnboxedNode",
|
||||||
"start": 0,
|
"kind": {
|
||||||
"end": 17,
|
|
||||||
"operator": "/",
|
|
||||||
"left": {
|
|
||||||
"type": "BinaryExpression",
|
"type": "BinaryExpression",
|
||||||
"type": "BinaryExpression",
|
"operator": "/",
|
||||||
"start": 0,
|
|
||||||
"end": 11,
|
|
||||||
"operator": "*",
|
|
||||||
"left": {
|
"left": {
|
||||||
"type": "Literal",
|
"type": "BinaryExpression",
|
||||||
"type": "Literal",
|
"type": "UnboxedNode",
|
||||||
|
"kind": {
|
||||||
|
"type": "BinaryExpression",
|
||||||
|
"operator": "*",
|
||||||
|
"left": {
|
||||||
|
"type": "Literal",
|
||||||
|
"type": "UnboxedNode",
|
||||||
|
"kind": {
|
||||||
|
"type": "Literal",
|
||||||
|
"value": 1,
|
||||||
|
"raw": "1"
|
||||||
|
},
|
||||||
|
"start": 0,
|
||||||
|
"end": 1
|
||||||
|
},
|
||||||
|
"right": {
|
||||||
|
"type": "BinaryExpression",
|
||||||
|
"type": "UnboxedNode",
|
||||||
|
"kind": {
|
||||||
|
"type": "BinaryExpression",
|
||||||
|
"operator": "+",
|
||||||
|
"left": {
|
||||||
|
"type": "Literal",
|
||||||
|
"type": "UnboxedNode",
|
||||||
|
"kind": {
|
||||||
|
"type": "Literal",
|
||||||
|
"value": 2,
|
||||||
|
"raw": "2"
|
||||||
|
},
|
||||||
|
"start": 6,
|
||||||
|
"end": 7
|
||||||
|
},
|
||||||
|
"right": {
|
||||||
|
"type": "Literal",
|
||||||
|
"type": "UnboxedNode",
|
||||||
|
"kind": {
|
||||||
|
"type": "Literal",
|
||||||
|
"value": 3,
|
||||||
|
"raw": "3"
|
||||||
|
},
|
||||||
|
"start": 10,
|
||||||
|
"end": 11
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"start": 6,
|
||||||
|
"end": 11
|
||||||
|
}
|
||||||
|
},
|
||||||
"start": 0,
|
"start": 0,
|
||||||
"end": 1,
|
"end": 11
|
||||||
"value": 1,
|
|
||||||
"raw": "1"
|
|
||||||
},
|
},
|
||||||
"right": {
|
"right": {
|
||||||
"type": "BinaryExpression",
|
"type": "Literal",
|
||||||
"type": "BinaryExpression",
|
"type": "UnboxedNode",
|
||||||
"start": 6,
|
"kind": {
|
||||||
"end": 11,
|
|
||||||
"operator": "+",
|
|
||||||
"left": {
|
|
||||||
"type": "Literal",
|
"type": "Literal",
|
||||||
"type": "Literal",
|
"value": 4,
|
||||||
"start": 6,
|
"raw": "4"
|
||||||
"end": 7,
|
|
||||||
"value": 2,
|
|
||||||
"raw": "2"
|
|
||||||
},
|
},
|
||||||
"right": {
|
"start": 16,
|
||||||
"type": "Literal",
|
"end": 17
|
||||||
"type": "Literal",
|
|
||||||
"start": 10,
|
|
||||||
"end": 11,
|
|
||||||
"value": 3,
|
|
||||||
"raw": "3"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"right": {
|
"start": 0,
|
||||||
"type": "Literal",
|
"end": 17
|
||||||
"type": "Literal",
|
|
||||||
"start": 16,
|
|
||||||
"end": 17,
|
|
||||||
"value": 4,
|
|
||||||
"raw": "4"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -1,56 +1,78 @@
|
|||||||
---
|
---
|
||||||
source: kcl/src/parser/parser_impl.rs
|
source: kcl/src/parser/parser_impl.rs
|
||||||
|
assertion_line: 3573
|
||||||
expression: actual
|
expression: actual
|
||||||
---
|
---
|
||||||
{
|
{
|
||||||
"type": "BinaryExpression",
|
"type": "UnboxedNode",
|
||||||
"start": 0,
|
"kind": {
|
||||||
"end": 17,
|
|
||||||
"operator": "+",
|
|
||||||
"left": {
|
|
||||||
"type": "Literal",
|
|
||||||
"type": "Literal",
|
|
||||||
"start": 0,
|
|
||||||
"end": 1,
|
|
||||||
"value": 1,
|
|
||||||
"raw": "1"
|
|
||||||
},
|
|
||||||
"right": {
|
|
||||||
"type": "BinaryExpression",
|
"type": "BinaryExpression",
|
||||||
"type": "BinaryExpression",
|
"operator": "+",
|
||||||
"start": 6,
|
|
||||||
"end": 17,
|
|
||||||
"operator": "/",
|
|
||||||
"left": {
|
"left": {
|
||||||
"type": "BinaryExpression",
|
"type": "Literal",
|
||||||
"type": "BinaryExpression",
|
"type": "UnboxedNode",
|
||||||
"start": 6,
|
"kind": {
|
||||||
"end": 11,
|
|
||||||
"operator": "+",
|
|
||||||
"left": {
|
|
||||||
"type": "Literal",
|
"type": "Literal",
|
||||||
"type": "Literal",
|
"value": 1,
|
||||||
"start": 6,
|
"raw": "1"
|
||||||
"end": 7,
|
|
||||||
"value": 2,
|
|
||||||
"raw": "2"
|
|
||||||
},
|
},
|
||||||
"right": {
|
"start": 0,
|
||||||
"type": "Literal",
|
"end": 1
|
||||||
"type": "Literal",
|
|
||||||
"start": 10,
|
|
||||||
"end": 11,
|
|
||||||
"value": 3,
|
|
||||||
"raw": "3"
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"right": {
|
"right": {
|
||||||
"type": "Literal",
|
"type": "BinaryExpression",
|
||||||
"type": "Literal",
|
"type": "UnboxedNode",
|
||||||
"start": 16,
|
"kind": {
|
||||||
"end": 17,
|
"type": "BinaryExpression",
|
||||||
"value": 4,
|
"operator": "/",
|
||||||
"raw": "4"
|
"left": {
|
||||||
|
"type": "BinaryExpression",
|
||||||
|
"type": "UnboxedNode",
|
||||||
|
"kind": {
|
||||||
|
"type": "BinaryExpression",
|
||||||
|
"operator": "+",
|
||||||
|
"left": {
|
||||||
|
"type": "Literal",
|
||||||
|
"type": "UnboxedNode",
|
||||||
|
"kind": {
|
||||||
|
"type": "Literal",
|
||||||
|
"value": 2,
|
||||||
|
"raw": "2"
|
||||||
|
},
|
||||||
|
"start": 6,
|
||||||
|
"end": 7
|
||||||
|
},
|
||||||
|
"right": {
|
||||||
|
"type": "Literal",
|
||||||
|
"type": "UnboxedNode",
|
||||||
|
"kind": {
|
||||||
|
"type": "Literal",
|
||||||
|
"value": 3,
|
||||||
|
"raw": "3"
|
||||||
|
},
|
||||||
|
"start": 10,
|
||||||
|
"end": 11
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"start": 6,
|
||||||
|
"end": 11
|
||||||
|
},
|
||||||
|
"right": {
|
||||||
|
"type": "Literal",
|
||||||
|
"type": "UnboxedNode",
|
||||||
|
"kind": {
|
||||||
|
"type": "Literal",
|
||||||
|
"value": 4,
|
||||||
|
"raw": "4"
|
||||||
|
},
|
||||||
|
"start": 16,
|
||||||
|
"end": 17
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"start": 6,
|
||||||
|
"end": 17
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
"start": 0,
|
||||||
|
"end": 17
|
||||||
}
|
}
|
||||||
|
@ -1,71 +1,99 @@
|
|||||||
---
|
---
|
||||||
source: kcl/src/parser/parser_impl.rs
|
source: kcl/src/parser/parser_impl.rs
|
||||||
|
assertion_line: 3574
|
||||||
expression: actual
|
expression: actual
|
||||||
---
|
---
|
||||||
{
|
{
|
||||||
"type": "BinaryExpression",
|
"type": "UnboxedNode",
|
||||||
"start": 0,
|
"kind": {
|
||||||
"end": 22,
|
|
||||||
"operator": "*",
|
|
||||||
"left": {
|
|
||||||
"type": "Literal",
|
|
||||||
"type": "Literal",
|
|
||||||
"start": 0,
|
|
||||||
"end": 1,
|
|
||||||
"value": 1,
|
|
||||||
"raw": "1"
|
|
||||||
},
|
|
||||||
"right": {
|
|
||||||
"type": "BinaryExpression",
|
"type": "BinaryExpression",
|
||||||
"type": "BinaryExpression",
|
"operator": "*",
|
||||||
"start": 7,
|
|
||||||
"end": 22,
|
|
||||||
"operator": "+",
|
|
||||||
"left": {
|
"left": {
|
||||||
|
"type": "Literal",
|
||||||
|
"type": "UnboxedNode",
|
||||||
|
"kind": {
|
||||||
|
"type": "Literal",
|
||||||
|
"value": 1,
|
||||||
|
"raw": "1"
|
||||||
|
},
|
||||||
|
"start": 0,
|
||||||
|
"end": 1
|
||||||
|
},
|
||||||
|
"right": {
|
||||||
"type": "BinaryExpression",
|
"type": "BinaryExpression",
|
||||||
"type": "BinaryExpression",
|
"type": "UnboxedNode",
|
||||||
"start": 7,
|
"kind": {
|
||||||
"end": 18,
|
|
||||||
"operator": "/",
|
|
||||||
"left": {
|
|
||||||
"type": "BinaryExpression",
|
"type": "BinaryExpression",
|
||||||
"type": "BinaryExpression",
|
|
||||||
"start": 7,
|
|
||||||
"end": 12,
|
|
||||||
"operator": "+",
|
"operator": "+",
|
||||||
"left": {
|
"left": {
|
||||||
"type": "Literal",
|
"type": "BinaryExpression",
|
||||||
"type": "Literal",
|
"type": "UnboxedNode",
|
||||||
|
"kind": {
|
||||||
|
"type": "BinaryExpression",
|
||||||
|
"operator": "/",
|
||||||
|
"left": {
|
||||||
|
"type": "BinaryExpression",
|
||||||
|
"type": "UnboxedNode",
|
||||||
|
"kind": {
|
||||||
|
"type": "BinaryExpression",
|
||||||
|
"operator": "+",
|
||||||
|
"left": {
|
||||||
|
"type": "Literal",
|
||||||
|
"type": "UnboxedNode",
|
||||||
|
"kind": {
|
||||||
|
"type": "Literal",
|
||||||
|
"value": 2,
|
||||||
|
"raw": "2"
|
||||||
|
},
|
||||||
|
"start": 7,
|
||||||
|
"end": 8
|
||||||
|
},
|
||||||
|
"right": {
|
||||||
|
"type": "Literal",
|
||||||
|
"type": "UnboxedNode",
|
||||||
|
"kind": {
|
||||||
|
"type": "Literal",
|
||||||
|
"value": 3,
|
||||||
|
"raw": "3"
|
||||||
|
},
|
||||||
|
"start": 11,
|
||||||
|
"end": 12
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"start": 7,
|
||||||
|
"end": 12
|
||||||
|
},
|
||||||
|
"right": {
|
||||||
|
"type": "Literal",
|
||||||
|
"type": "UnboxedNode",
|
||||||
|
"kind": {
|
||||||
|
"type": "Literal",
|
||||||
|
"value": 4,
|
||||||
|
"raw": "4"
|
||||||
|
},
|
||||||
|
"start": 17,
|
||||||
|
"end": 18
|
||||||
|
}
|
||||||
|
},
|
||||||
"start": 7,
|
"start": 7,
|
||||||
"end": 8,
|
"end": 18
|
||||||
"value": 2,
|
|
||||||
"raw": "2"
|
|
||||||
},
|
},
|
||||||
"right": {
|
"right": {
|
||||||
"type": "Literal",
|
"type": "Literal",
|
||||||
"type": "Literal",
|
"type": "UnboxedNode",
|
||||||
"start": 11,
|
"kind": {
|
||||||
"end": 12,
|
"type": "Literal",
|
||||||
"value": 3,
|
"value": 5,
|
||||||
"raw": "3"
|
"raw": "5"
|
||||||
|
},
|
||||||
|
"start": 21,
|
||||||
|
"end": 22
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"right": {
|
"start": 7,
|
||||||
"type": "Literal",
|
"end": 22
|
||||||
"type": "Literal",
|
|
||||||
"start": 17,
|
|
||||||
"end": 18,
|
|
||||||
"value": 4,
|
|
||||||
"raw": "4"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"right": {
|
|
||||||
"type": "Literal",
|
|
||||||
"type": "Literal",
|
|
||||||
"start": 21,
|
|
||||||
"end": 22,
|
|
||||||
"value": 5,
|
|
||||||
"raw": "5"
|
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
"start": 0,
|
||||||
|
"end": 22
|
||||||
}
|
}
|
||||||
|
@ -1,41 +1,57 @@
|
|||||||
---
|
---
|
||||||
source: kcl/src/parser/parser_impl.rs
|
source: kcl/src/parser/parser_impl.rs
|
||||||
|
assertion_line: 3575
|
||||||
expression: actual
|
expression: actual
|
||||||
---
|
---
|
||||||
{
|
{
|
||||||
"type": "BinaryExpression",
|
"type": "UnboxedNode",
|
||||||
"start": 0,
|
"kind": {
|
||||||
"end": 13,
|
|
||||||
"operator": "*",
|
|
||||||
"left": {
|
|
||||||
"type": "Literal",
|
|
||||||
"type": "Literal",
|
|
||||||
"start": 0,
|
|
||||||
"end": 1,
|
|
||||||
"value": 1,
|
|
||||||
"raw": "1"
|
|
||||||
},
|
|
||||||
"right": {
|
|
||||||
"type": "BinaryExpression",
|
"type": "BinaryExpression",
|
||||||
"type": "BinaryExpression",
|
"operator": "*",
|
||||||
"start": 8,
|
|
||||||
"end": 13,
|
|
||||||
"operator": "+",
|
|
||||||
"left": {
|
"left": {
|
||||||
"type": "Literal",
|
"type": "Literal",
|
||||||
"type": "Literal",
|
"type": "UnboxedNode",
|
||||||
"start": 8,
|
"kind": {
|
||||||
"end": 9,
|
"type": "Literal",
|
||||||
"value": 2,
|
"value": 1,
|
||||||
"raw": "2"
|
"raw": "1"
|
||||||
|
},
|
||||||
|
"start": 0,
|
||||||
|
"end": 1
|
||||||
},
|
},
|
||||||
"right": {
|
"right": {
|
||||||
"type": "Literal",
|
"type": "BinaryExpression",
|
||||||
"type": "Literal",
|
"type": "UnboxedNode",
|
||||||
"start": 12,
|
"kind": {
|
||||||
"end": 13,
|
"type": "BinaryExpression",
|
||||||
"value": 3,
|
"operator": "+",
|
||||||
"raw": "3"
|
"left": {
|
||||||
|
"type": "Literal",
|
||||||
|
"type": "UnboxedNode",
|
||||||
|
"kind": {
|
||||||
|
"type": "Literal",
|
||||||
|
"value": 2,
|
||||||
|
"raw": "2"
|
||||||
|
},
|
||||||
|
"start": 8,
|
||||||
|
"end": 9
|
||||||
|
},
|
||||||
|
"right": {
|
||||||
|
"type": "Literal",
|
||||||
|
"type": "UnboxedNode",
|
||||||
|
"kind": {
|
||||||
|
"type": "Literal",
|
||||||
|
"value": 3,
|
||||||
|
"raw": "3"
|
||||||
|
},
|
||||||
|
"start": 12,
|
||||||
|
"end": 13
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"start": 8,
|
||||||
|
"end": 13
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
"start": 0,
|
||||||
|
"end": 13
|
||||||
}
|
}
|
||||||
|
@ -1,81 +1,115 @@
|
|||||||
---
|
---
|
||||||
source: kcl/src/parser/parser_impl.rs
|
source: kcl/src/parser/parser_impl.rs
|
||||||
|
assertion_line: 3576
|
||||||
expression: actual
|
expression: actual
|
||||||
---
|
---
|
||||||
{
|
{
|
||||||
"type": "BinaryExpression",
|
"type": "UnboxedNode",
|
||||||
"start": 0,
|
"kind": {
|
||||||
"end": 44,
|
|
||||||
"operator": "/",
|
|
||||||
"left": {
|
|
||||||
"type": "BinaryExpression",
|
"type": "BinaryExpression",
|
||||||
"type": "BinaryExpression",
|
"operator": "/",
|
||||||
"start": 0,
|
|
||||||
"end": 22,
|
|
||||||
"operator": "*",
|
|
||||||
"left": {
|
"left": {
|
||||||
"type": "BinaryExpression",
|
"type": "BinaryExpression",
|
||||||
"type": "BinaryExpression",
|
"type": "UnboxedNode",
|
||||||
|
"kind": {
|
||||||
|
"type": "BinaryExpression",
|
||||||
|
"operator": "*",
|
||||||
|
"left": {
|
||||||
|
"type": "BinaryExpression",
|
||||||
|
"type": "UnboxedNode",
|
||||||
|
"kind": {
|
||||||
|
"type": "BinaryExpression",
|
||||||
|
"operator": "*",
|
||||||
|
"left": {
|
||||||
|
"type": "BinaryExpression",
|
||||||
|
"type": "UnboxedNode",
|
||||||
|
"kind": {
|
||||||
|
"type": "BinaryExpression",
|
||||||
|
"operator": "*",
|
||||||
|
"left": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"type": "UnboxedNode",
|
||||||
|
"kind": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"name": "distance"
|
||||||
|
},
|
||||||
|
"start": 0,
|
||||||
|
"end": 8
|
||||||
|
},
|
||||||
|
"right": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"type": "UnboxedNode",
|
||||||
|
"kind": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"name": "p"
|
||||||
|
},
|
||||||
|
"start": 11,
|
||||||
|
"end": 12
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"start": 0,
|
||||||
|
"end": 12
|
||||||
|
},
|
||||||
|
"right": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"type": "UnboxedNode",
|
||||||
|
"kind": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"name": "FOS"
|
||||||
|
},
|
||||||
|
"start": 15,
|
||||||
|
"end": 18
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"start": 0,
|
||||||
|
"end": 18
|
||||||
|
},
|
||||||
|
"right": {
|
||||||
|
"type": "Literal",
|
||||||
|
"type": "UnboxedNode",
|
||||||
|
"kind": {
|
||||||
|
"type": "Literal",
|
||||||
|
"value": 6,
|
||||||
|
"raw": "6"
|
||||||
|
},
|
||||||
|
"start": 21,
|
||||||
|
"end": 22
|
||||||
|
}
|
||||||
|
},
|
||||||
"start": 0,
|
"start": 0,
|
||||||
"end": 18,
|
"end": 22
|
||||||
"operator": "*",
|
},
|
||||||
"left": {
|
"right": {
|
||||||
|
"type": "BinaryExpression",
|
||||||
|
"type": "UnboxedNode",
|
||||||
|
"kind": {
|
||||||
"type": "BinaryExpression",
|
"type": "BinaryExpression",
|
||||||
"type": "BinaryExpression",
|
|
||||||
"start": 0,
|
|
||||||
"end": 12,
|
|
||||||
"operator": "*",
|
"operator": "*",
|
||||||
"left": {
|
"left": {
|
||||||
"type": "Identifier",
|
"type": "Identifier",
|
||||||
"type": "Identifier",
|
"type": "UnboxedNode",
|
||||||
"start": 0,
|
"kind": {
|
||||||
"end": 8,
|
"type": "Identifier",
|
||||||
"name": "distance"
|
"name": "sigmaAllow"
|
||||||
|
},
|
||||||
|
"start": 26,
|
||||||
|
"end": 36
|
||||||
},
|
},
|
||||||
"right": {
|
"right": {
|
||||||
"type": "Identifier",
|
"type": "Identifier",
|
||||||
"type": "Identifier",
|
"type": "UnboxedNode",
|
||||||
"start": 11,
|
"kind": {
|
||||||
"end": 12,
|
"type": "Identifier",
|
||||||
"name": "p"
|
"name": "width"
|
||||||
|
},
|
||||||
|
"start": 39,
|
||||||
|
"end": 44
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"right": {
|
"start": 26,
|
||||||
"type": "Identifier",
|
"end": 44
|
||||||
"type": "Identifier",
|
|
||||||
"start": 15,
|
|
||||||
"end": 18,
|
|
||||||
"name": "FOS"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"right": {
|
|
||||||
"type": "Literal",
|
|
||||||
"type": "Literal",
|
|
||||||
"start": 21,
|
|
||||||
"end": 22,
|
|
||||||
"value": 6,
|
|
||||||
"raw": "6"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"right": {
|
"start": 0,
|
||||||
"type": "BinaryExpression",
|
"end": 44
|
||||||
"type": "BinaryExpression",
|
|
||||||
"start": 26,
|
|
||||||
"end": 44,
|
|
||||||
"operator": "*",
|
|
||||||
"left": {
|
|
||||||
"type": "Identifier",
|
|
||||||
"type": "Identifier",
|
|
||||||
"start": 26,
|
|
||||||
"end": 36,
|
|
||||||
"name": "sigmaAllow"
|
|
||||||
},
|
|
||||||
"right": {
|
|
||||||
"type": "Identifier",
|
|
||||||
"type": "Identifier",
|
|
||||||
"start": 39,
|
|
||||||
"end": 44,
|
|
||||||
"name": "width"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -1,26 +1,36 @@
|
|||||||
---
|
---
|
||||||
source: kcl/src/parser/parser_impl.rs
|
source: kcl/src/parser/parser_impl.rs
|
||||||
|
assertion_line: 3577
|
||||||
expression: actual
|
expression: actual
|
||||||
---
|
---
|
||||||
{
|
{
|
||||||
"type": "BinaryExpression",
|
"type": "UnboxedNode",
|
||||||
"start": 0,
|
"kind": {
|
||||||
"end": 8,
|
"type": "BinaryExpression",
|
||||||
"operator": "+",
|
"operator": "+",
|
||||||
"left": {
|
"left": {
|
||||||
"type": "Literal",
|
"type": "Literal",
|
||||||
"type": "Literal",
|
"type": "UnboxedNode",
|
||||||
"start": 0,
|
"kind": {
|
||||||
"end": 1,
|
"type": "Literal",
|
||||||
"value": 2,
|
"value": 2,
|
||||||
"raw": "2"
|
"raw": "2"
|
||||||
|
},
|
||||||
|
"start": 0,
|
||||||
|
"end": 1
|
||||||
|
},
|
||||||
|
"right": {
|
||||||
|
"type": "Literal",
|
||||||
|
"type": "UnboxedNode",
|
||||||
|
"kind": {
|
||||||
|
"type": "Literal",
|
||||||
|
"value": 3,
|
||||||
|
"raw": "3"
|
||||||
|
},
|
||||||
|
"start": 7,
|
||||||
|
"end": 8
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"right": {
|
"start": 0,
|
||||||
"type": "Literal",
|
"end": 8
|
||||||
"type": "Literal",
|
|
||||||
"start": 7,
|
|
||||||
"end": 8,
|
|
||||||
"value": 3,
|
|
||||||
"raw": "3"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -1,255 +1,358 @@
|
|||||||
---
|
---
|
||||||
source: kcl/src/parser/parser_impl.rs
|
source: kcl/src/parser/parser_impl.rs
|
||||||
|
assertion_line: 3606
|
||||||
expression: actual
|
expression: actual
|
||||||
---
|
---
|
||||||
{
|
{
|
||||||
"start": 0,
|
"type": "UnboxedNode",
|
||||||
"end": 144,
|
"kind": {
|
||||||
"body": [
|
"body": [
|
||||||
{
|
{
|
||||||
"type": "VariableDeclaration",
|
"type": "VariableDeclaration",
|
||||||
"type": "VariableDeclaration",
|
"type": "UnboxedNode",
|
||||||
"start": 0,
|
"kind": {
|
||||||
"end": 143,
|
"type": "VariableDeclaration",
|
||||||
"declarations": [
|
"declarations": [
|
||||||
{
|
{
|
||||||
"type": "VariableDeclarator",
|
"type": "UnboxedNode",
|
||||||
"start": 6,
|
"kind": {
|
||||||
"end": 143,
|
"type": "VariableDeclarator",
|
||||||
"id": {
|
"id": {
|
||||||
"type": "Identifier",
|
"type": "UnboxedNode",
|
||||||
"start": 6,
|
"kind": {
|
||||||
"end": 15,
|
"type": "Identifier",
|
||||||
"name": "boxSketch"
|
"name": "boxSketch"
|
||||||
},
|
},
|
||||||
"init": {
|
"start": 6,
|
||||||
"type": "PipeExpression",
|
"end": 15
|
||||||
"type": "PipeExpression",
|
},
|
||||||
"start": 18,
|
"init": {
|
||||||
"end": 143,
|
"type": "PipeExpression",
|
||||||
"body": [
|
"type": "UnboxedNode",
|
||||||
{
|
"kind": {
|
||||||
"type": "CallExpression",
|
"type": "PipeExpression",
|
||||||
"type": "CallExpression",
|
"body": [
|
||||||
"start": 18,
|
{
|
||||||
"end": 39,
|
"type": "CallExpression",
|
||||||
"callee": {
|
"type": "UnboxedNode",
|
||||||
"type": "Identifier",
|
"kind": {
|
||||||
|
"type": "CallExpression",
|
||||||
|
"callee": {
|
||||||
|
"type": "UnboxedNode",
|
||||||
|
"kind": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"name": "startSketchAt"
|
||||||
|
},
|
||||||
|
"start": 18,
|
||||||
|
"end": 31
|
||||||
|
},
|
||||||
|
"arguments": [
|
||||||
|
{
|
||||||
|
"type": "ArrayExpression",
|
||||||
|
"type": "UnboxedNode",
|
||||||
|
"kind": {
|
||||||
|
"type": "ArrayExpression",
|
||||||
|
"elements": [
|
||||||
|
{
|
||||||
|
"type": "Literal",
|
||||||
|
"type": "UnboxedNode",
|
||||||
|
"kind": {
|
||||||
|
"type": "Literal",
|
||||||
|
"value": 0,
|
||||||
|
"raw": "0"
|
||||||
|
},
|
||||||
|
"start": 33,
|
||||||
|
"end": 34
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "Literal",
|
||||||
|
"type": "UnboxedNode",
|
||||||
|
"kind": {
|
||||||
|
"type": "Literal",
|
||||||
|
"value": 0,
|
||||||
|
"raw": "0"
|
||||||
|
},
|
||||||
|
"start": 36,
|
||||||
|
"end": 37
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"start": 32,
|
||||||
|
"end": 38
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"optional": false
|
||||||
|
},
|
||||||
|
"start": 18,
|
||||||
|
"end": 39
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "CallExpression",
|
||||||
|
"type": "UnboxedNode",
|
||||||
|
"kind": {
|
||||||
|
"type": "CallExpression",
|
||||||
|
"callee": {
|
||||||
|
"type": "UnboxedNode",
|
||||||
|
"kind": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"name": "line"
|
||||||
|
},
|
||||||
|
"start": 47,
|
||||||
|
"end": 51
|
||||||
|
},
|
||||||
|
"arguments": [
|
||||||
|
{
|
||||||
|
"type": "ArrayExpression",
|
||||||
|
"type": "UnboxedNode",
|
||||||
|
"kind": {
|
||||||
|
"type": "ArrayExpression",
|
||||||
|
"elements": [
|
||||||
|
{
|
||||||
|
"type": "Literal",
|
||||||
|
"type": "UnboxedNode",
|
||||||
|
"kind": {
|
||||||
|
"type": "Literal",
|
||||||
|
"value": 0,
|
||||||
|
"raw": "0"
|
||||||
|
},
|
||||||
|
"start": 53,
|
||||||
|
"end": 54
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "Literal",
|
||||||
|
"type": "UnboxedNode",
|
||||||
|
"kind": {
|
||||||
|
"type": "Literal",
|
||||||
|
"value": 10,
|
||||||
|
"raw": "10"
|
||||||
|
},
|
||||||
|
"start": 56,
|
||||||
|
"end": 58
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"start": 52,
|
||||||
|
"end": 59
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "PipeSubstitution",
|
||||||
|
"type": "UnboxedNode",
|
||||||
|
"kind": {
|
||||||
|
"type": "PipeSubstitution"
|
||||||
|
},
|
||||||
|
"start": 61,
|
||||||
|
"end": 62
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"optional": false
|
||||||
|
},
|
||||||
|
"start": 47,
|
||||||
|
"end": 63
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "CallExpression",
|
||||||
|
"type": "UnboxedNode",
|
||||||
|
"kind": {
|
||||||
|
"type": "CallExpression",
|
||||||
|
"callee": {
|
||||||
|
"type": "UnboxedNode",
|
||||||
|
"kind": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"name": "tangentialArc"
|
||||||
|
},
|
||||||
|
"start": 71,
|
||||||
|
"end": 84
|
||||||
|
},
|
||||||
|
"arguments": [
|
||||||
|
{
|
||||||
|
"type": "ArrayExpression",
|
||||||
|
"type": "UnboxedNode",
|
||||||
|
"kind": {
|
||||||
|
"type": "ArrayExpression",
|
||||||
|
"elements": [
|
||||||
|
{
|
||||||
|
"type": "UnaryExpression",
|
||||||
|
"type": "UnboxedNode",
|
||||||
|
"kind": {
|
||||||
|
"type": "UnaryExpression",
|
||||||
|
"operator": "-",
|
||||||
|
"argument": {
|
||||||
|
"type": "Literal",
|
||||||
|
"type": "UnboxedNode",
|
||||||
|
"kind": {
|
||||||
|
"type": "Literal",
|
||||||
|
"value": 5,
|
||||||
|
"raw": "5"
|
||||||
|
},
|
||||||
|
"start": 87,
|
||||||
|
"end": 88
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"start": 86,
|
||||||
|
"end": 88
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "Literal",
|
||||||
|
"type": "UnboxedNode",
|
||||||
|
"kind": {
|
||||||
|
"type": "Literal",
|
||||||
|
"value": 5,
|
||||||
|
"raw": "5"
|
||||||
|
},
|
||||||
|
"start": 90,
|
||||||
|
"end": 91
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"start": 85,
|
||||||
|
"end": 92
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "PipeSubstitution",
|
||||||
|
"type": "UnboxedNode",
|
||||||
|
"kind": {
|
||||||
|
"type": "PipeSubstitution"
|
||||||
|
},
|
||||||
|
"start": 94,
|
||||||
|
"end": 95
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"optional": false
|
||||||
|
},
|
||||||
|
"start": 71,
|
||||||
|
"end": 96
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "CallExpression",
|
||||||
|
"type": "UnboxedNode",
|
||||||
|
"kind": {
|
||||||
|
"type": "CallExpression",
|
||||||
|
"callee": {
|
||||||
|
"type": "UnboxedNode",
|
||||||
|
"kind": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"name": "line"
|
||||||
|
},
|
||||||
|
"start": 104,
|
||||||
|
"end": 108
|
||||||
|
},
|
||||||
|
"arguments": [
|
||||||
|
{
|
||||||
|
"type": "ArrayExpression",
|
||||||
|
"type": "UnboxedNode",
|
||||||
|
"kind": {
|
||||||
|
"type": "ArrayExpression",
|
||||||
|
"elements": [
|
||||||
|
{
|
||||||
|
"type": "Literal",
|
||||||
|
"type": "UnboxedNode",
|
||||||
|
"kind": {
|
||||||
|
"type": "Literal",
|
||||||
|
"value": 5,
|
||||||
|
"raw": "5"
|
||||||
|
},
|
||||||
|
"start": 110,
|
||||||
|
"end": 111
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "UnaryExpression",
|
||||||
|
"type": "UnboxedNode",
|
||||||
|
"kind": {
|
||||||
|
"type": "UnaryExpression",
|
||||||
|
"operator": "-",
|
||||||
|
"argument": {
|
||||||
|
"type": "Literal",
|
||||||
|
"type": "UnboxedNode",
|
||||||
|
"kind": {
|
||||||
|
"type": "Literal",
|
||||||
|
"value": 15,
|
||||||
|
"raw": "15"
|
||||||
|
},
|
||||||
|
"start": 114,
|
||||||
|
"end": 116
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"start": 113,
|
||||||
|
"end": 116
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"start": 109,
|
||||||
|
"end": 117
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "PipeSubstitution",
|
||||||
|
"type": "UnboxedNode",
|
||||||
|
"kind": {
|
||||||
|
"type": "PipeSubstitution"
|
||||||
|
},
|
||||||
|
"start": 119,
|
||||||
|
"end": 120
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"optional": false
|
||||||
|
},
|
||||||
|
"start": 104,
|
||||||
|
"end": 121
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "CallExpression",
|
||||||
|
"type": "UnboxedNode",
|
||||||
|
"kind": {
|
||||||
|
"type": "CallExpression",
|
||||||
|
"callee": {
|
||||||
|
"type": "UnboxedNode",
|
||||||
|
"kind": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"name": "extrude"
|
||||||
|
},
|
||||||
|
"start": 129,
|
||||||
|
"end": 136
|
||||||
|
},
|
||||||
|
"arguments": [
|
||||||
|
{
|
||||||
|
"type": "Literal",
|
||||||
|
"type": "UnboxedNode",
|
||||||
|
"kind": {
|
||||||
|
"type": "Literal",
|
||||||
|
"value": 10,
|
||||||
|
"raw": "10"
|
||||||
|
},
|
||||||
|
"start": 137,
|
||||||
|
"end": 139
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "PipeSubstitution",
|
||||||
|
"type": "UnboxedNode",
|
||||||
|
"kind": {
|
||||||
|
"type": "PipeSubstitution"
|
||||||
|
},
|
||||||
|
"start": 141,
|
||||||
|
"end": 142
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"optional": false
|
||||||
|
},
|
||||||
|
"start": 129,
|
||||||
|
"end": 143
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
"start": 18,
|
"start": 18,
|
||||||
"end": 31,
|
"end": 143
|
||||||
"name": "startSketchAt"
|
}
|
||||||
},
|
|
||||||
"arguments": [
|
|
||||||
{
|
|
||||||
"type": "ArrayExpression",
|
|
||||||
"type": "ArrayExpression",
|
|
||||||
"start": 32,
|
|
||||||
"end": 38,
|
|
||||||
"elements": [
|
|
||||||
{
|
|
||||||
"type": "Literal",
|
|
||||||
"type": "Literal",
|
|
||||||
"start": 33,
|
|
||||||
"end": 34,
|
|
||||||
"value": 0,
|
|
||||||
"raw": "0"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "Literal",
|
|
||||||
"type": "Literal",
|
|
||||||
"start": 36,
|
|
||||||
"end": 37,
|
|
||||||
"value": 0,
|
|
||||||
"raw": "0"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"optional": false
|
|
||||||
},
|
},
|
||||||
{
|
"start": 6,
|
||||||
"type": "CallExpression",
|
"end": 143
|
||||||
"type": "CallExpression",
|
}
|
||||||
"start": 47,
|
],
|
||||||
"end": 63,
|
"kind": "const"
|
||||||
"callee": {
|
},
|
||||||
"type": "Identifier",
|
"start": 0,
|
||||||
"start": 47,
|
"end": 143
|
||||||
"end": 51,
|
}
|
||||||
"name": "line"
|
]
|
||||||
},
|
},
|
||||||
"arguments": [
|
"start": 0,
|
||||||
{
|
"end": 144
|
||||||
"type": "ArrayExpression",
|
|
||||||
"type": "ArrayExpression",
|
|
||||||
"start": 52,
|
|
||||||
"end": 59,
|
|
||||||
"elements": [
|
|
||||||
{
|
|
||||||
"type": "Literal",
|
|
||||||
"type": "Literal",
|
|
||||||
"start": 53,
|
|
||||||
"end": 54,
|
|
||||||
"value": 0,
|
|
||||||
"raw": "0"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "Literal",
|
|
||||||
"type": "Literal",
|
|
||||||
"start": 56,
|
|
||||||
"end": 58,
|
|
||||||
"value": 10,
|
|
||||||
"raw": "10"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "PipeSubstitution",
|
|
||||||
"type": "PipeSubstitution",
|
|
||||||
"start": 61,
|
|
||||||
"end": 62
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"optional": false
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "CallExpression",
|
|
||||||
"type": "CallExpression",
|
|
||||||
"start": 71,
|
|
||||||
"end": 96,
|
|
||||||
"callee": {
|
|
||||||
"type": "Identifier",
|
|
||||||
"start": 71,
|
|
||||||
"end": 84,
|
|
||||||
"name": "tangentialArc"
|
|
||||||
},
|
|
||||||
"arguments": [
|
|
||||||
{
|
|
||||||
"type": "ArrayExpression",
|
|
||||||
"type": "ArrayExpression",
|
|
||||||
"start": 85,
|
|
||||||
"end": 92,
|
|
||||||
"elements": [
|
|
||||||
{
|
|
||||||
"type": "UnaryExpression",
|
|
||||||
"type": "UnaryExpression",
|
|
||||||
"start": 86,
|
|
||||||
"end": 88,
|
|
||||||
"operator": "-",
|
|
||||||
"argument": {
|
|
||||||
"type": "Literal",
|
|
||||||
"type": "Literal",
|
|
||||||
"start": 87,
|
|
||||||
"end": 88,
|
|
||||||
"value": 5,
|
|
||||||
"raw": "5"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "Literal",
|
|
||||||
"type": "Literal",
|
|
||||||
"start": 90,
|
|
||||||
"end": 91,
|
|
||||||
"value": 5,
|
|
||||||
"raw": "5"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "PipeSubstitution",
|
|
||||||
"type": "PipeSubstitution",
|
|
||||||
"start": 94,
|
|
||||||
"end": 95
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"optional": false
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "CallExpression",
|
|
||||||
"type": "CallExpression",
|
|
||||||
"start": 104,
|
|
||||||
"end": 121,
|
|
||||||
"callee": {
|
|
||||||
"type": "Identifier",
|
|
||||||
"start": 104,
|
|
||||||
"end": 108,
|
|
||||||
"name": "line"
|
|
||||||
},
|
|
||||||
"arguments": [
|
|
||||||
{
|
|
||||||
"type": "ArrayExpression",
|
|
||||||
"type": "ArrayExpression",
|
|
||||||
"start": 109,
|
|
||||||
"end": 117,
|
|
||||||
"elements": [
|
|
||||||
{
|
|
||||||
"type": "Literal",
|
|
||||||
"type": "Literal",
|
|
||||||
"start": 110,
|
|
||||||
"end": 111,
|
|
||||||
"value": 5,
|
|
||||||
"raw": "5"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "UnaryExpression",
|
|
||||||
"type": "UnaryExpression",
|
|
||||||
"start": 113,
|
|
||||||
"end": 116,
|
|
||||||
"operator": "-",
|
|
||||||
"argument": {
|
|
||||||
"type": "Literal",
|
|
||||||
"type": "Literal",
|
|
||||||
"start": 114,
|
|
||||||
"end": 116,
|
|
||||||
"value": 15,
|
|
||||||
"raw": "15"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "PipeSubstitution",
|
|
||||||
"type": "PipeSubstitution",
|
|
||||||
"start": 119,
|
|
||||||
"end": 120
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"optional": false
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "CallExpression",
|
|
||||||
"type": "CallExpression",
|
|
||||||
"start": 129,
|
|
||||||
"end": 143,
|
|
||||||
"callee": {
|
|
||||||
"type": "Identifier",
|
|
||||||
"start": 129,
|
|
||||||
"end": 136,
|
|
||||||
"name": "extrude"
|
|
||||||
},
|
|
||||||
"arguments": [
|
|
||||||
{
|
|
||||||
"type": "Literal",
|
|
||||||
"type": "Literal",
|
|
||||||
"start": 137,
|
|
||||||
"end": 139,
|
|
||||||
"value": 10,
|
|
||||||
"raw": "10"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "PipeSubstitution",
|
|
||||||
"type": "PipeSubstitution",
|
|
||||||
"start": 141,
|
|
||||||
"end": 142
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"optional": false
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"kind": "const"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
|
@ -1,44 +1,63 @@
|
|||||||
---
|
---
|
||||||
source: kcl/src/parser/parser_impl.rs
|
source: kcl/src/parser/parser_impl.rs
|
||||||
|
assertion_line: 3676
|
||||||
expression: actual
|
expression: actual
|
||||||
---
|
---
|
||||||
{
|
{
|
||||||
"start": 0,
|
"type": "UnboxedNode",
|
||||||
"end": 17,
|
"kind": {
|
||||||
"body": [
|
"body": [
|
||||||
{
|
{
|
||||||
"type": "VariableDeclaration",
|
"type": "VariableDeclaration",
|
||||||
"type": "VariableDeclaration",
|
"type": "UnboxedNode",
|
||||||
"start": 0,
|
"kind": {
|
||||||
"end": 17,
|
"type": "VariableDeclaration",
|
||||||
"declarations": [
|
"declarations": [
|
||||||
{
|
{
|
||||||
"type": "VariableDeclarator",
|
"type": "UnboxedNode",
|
||||||
"start": 6,
|
"kind": {
|
||||||
"end": 17,
|
"type": "VariableDeclarator",
|
||||||
"id": {
|
"id": {
|
||||||
"type": "Identifier",
|
"type": "UnboxedNode",
|
||||||
"start": 6,
|
"kind": {
|
||||||
"end": 8,
|
"type": "Identifier",
|
||||||
"name": "sg"
|
"name": "sg"
|
||||||
},
|
},
|
||||||
"init": {
|
"start": 6,
|
||||||
"type": "UnaryExpression",
|
"end": 8
|
||||||
"type": "UnaryExpression",
|
},
|
||||||
"start": 11,
|
"init": {
|
||||||
"end": 17,
|
"type": "UnaryExpression",
|
||||||
"operator": "-",
|
"type": "UnboxedNode",
|
||||||
"argument": {
|
"kind": {
|
||||||
"type": "Identifier",
|
"type": "UnaryExpression",
|
||||||
"type": "Identifier",
|
"operator": "-",
|
||||||
"start": 12,
|
"argument": {
|
||||||
"end": 17,
|
"type": "Identifier",
|
||||||
"name": "scale"
|
"type": "UnboxedNode",
|
||||||
|
"kind": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"name": "scale"
|
||||||
|
},
|
||||||
|
"start": 12,
|
||||||
|
"end": 17
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"start": 11,
|
||||||
|
"end": 17
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"start": 6,
|
||||||
|
"end": 17
|
||||||
}
|
}
|
||||||
}
|
],
|
||||||
}
|
"kind": "const"
|
||||||
],
|
},
|
||||||
"kind": "const"
|
"start": 0,
|
||||||
}
|
"end": 17
|
||||||
]
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"start": 0,
|
||||||
|
"end": 17
|
||||||
}
|
}
|
||||||
|
@ -1,81 +1,115 @@
|
|||||||
---
|
---
|
||||||
source: kcl/src/parser/parser_impl.rs
|
source: kcl/src/parser/parser_impl.rs
|
||||||
|
assertion_line: 3677
|
||||||
expression: actual
|
expression: actual
|
||||||
---
|
---
|
||||||
{
|
{
|
||||||
"start": 0,
|
"type": "UnboxedNode",
|
||||||
"end": 23,
|
"kind": {
|
||||||
"body": [
|
"body": [
|
||||||
{
|
{
|
||||||
"type": "ExpressionStatement",
|
"type": "ExpressionStatement",
|
||||||
"type": "ExpressionStatement",
|
"type": "UnboxedNode",
|
||||||
"start": 0,
|
"kind": {
|
||||||
"end": 23,
|
"type": "ExpressionStatement",
|
||||||
"expression": {
|
"expression": {
|
||||||
"type": "CallExpression",
|
"type": "CallExpression",
|
||||||
"type": "CallExpression",
|
"type": "UnboxedNode",
|
||||||
"start": 0,
|
"kind": {
|
||||||
"end": 23,
|
"type": "CallExpression",
|
||||||
"callee": {
|
"callee": {
|
||||||
"type": "Identifier",
|
"type": "UnboxedNode",
|
||||||
"start": 0,
|
"kind": {
|
||||||
"end": 6,
|
|
||||||
"name": "lineTo"
|
|
||||||
},
|
|
||||||
"arguments": [
|
|
||||||
{
|
|
||||||
"type": "ObjectExpression",
|
|
||||||
"type": "ObjectExpression",
|
|
||||||
"start": 7,
|
|
||||||
"end": 22,
|
|
||||||
"properties": [
|
|
||||||
{
|
|
||||||
"type": "ObjectProperty",
|
|
||||||
"start": 9,
|
|
||||||
"end": 20,
|
|
||||||
"key": {
|
|
||||||
"type": "Identifier",
|
"type": "Identifier",
|
||||||
"start": 9,
|
"name": "lineTo"
|
||||||
"end": 11,
|
|
||||||
"name": "to"
|
|
||||||
},
|
},
|
||||||
"value": {
|
"start": 0,
|
||||||
"type": "ArrayExpression",
|
"end": 6
|
||||||
"type": "ArrayExpression",
|
},
|
||||||
"start": 13,
|
"arguments": [
|
||||||
"end": 20,
|
{
|
||||||
"elements": [
|
"type": "ObjectExpression",
|
||||||
{
|
"type": "UnboxedNode",
|
||||||
"type": "Literal",
|
"kind": {
|
||||||
"type": "Literal",
|
"type": "ObjectExpression",
|
||||||
"start": 14,
|
"properties": [
|
||||||
"end": 15,
|
{
|
||||||
"value": 0,
|
"type": "UnboxedNode",
|
||||||
"raw": "0"
|
"kind": {
|
||||||
},
|
"type": "ObjectProperty",
|
||||||
{
|
"key": {
|
||||||
"type": "UnaryExpression",
|
"type": "UnboxedNode",
|
||||||
"type": "UnaryExpression",
|
"kind": {
|
||||||
"start": 17,
|
"type": "Identifier",
|
||||||
"end": 19,
|
"name": "to"
|
||||||
"operator": "-",
|
},
|
||||||
"argument": {
|
"start": 9,
|
||||||
"type": "Literal",
|
"end": 11
|
||||||
"type": "Literal",
|
},
|
||||||
"start": 18,
|
"value": {
|
||||||
"end": 19,
|
"type": "ArrayExpression",
|
||||||
"value": 1,
|
"type": "UnboxedNode",
|
||||||
"raw": "1"
|
"kind": {
|
||||||
|
"type": "ArrayExpression",
|
||||||
|
"elements": [
|
||||||
|
{
|
||||||
|
"type": "Literal",
|
||||||
|
"type": "UnboxedNode",
|
||||||
|
"kind": {
|
||||||
|
"type": "Literal",
|
||||||
|
"value": 0,
|
||||||
|
"raw": "0"
|
||||||
|
},
|
||||||
|
"start": 14,
|
||||||
|
"end": 15
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "UnaryExpression",
|
||||||
|
"type": "UnboxedNode",
|
||||||
|
"kind": {
|
||||||
|
"type": "UnaryExpression",
|
||||||
|
"operator": "-",
|
||||||
|
"argument": {
|
||||||
|
"type": "Literal",
|
||||||
|
"type": "UnboxedNode",
|
||||||
|
"kind": {
|
||||||
|
"type": "Literal",
|
||||||
|
"value": 1,
|
||||||
|
"raw": "1"
|
||||||
|
},
|
||||||
|
"start": 18,
|
||||||
|
"end": 19
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"start": 17,
|
||||||
|
"end": 19
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"start": 13,
|
||||||
|
"end": 20
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"start": 9,
|
||||||
|
"end": 20
|
||||||
}
|
}
|
||||||
}
|
]
|
||||||
]
|
},
|
||||||
|
"start": 7,
|
||||||
|
"end": 22
|
||||||
}
|
}
|
||||||
}
|
],
|
||||||
]
|
"optional": false
|
||||||
|
},
|
||||||
|
"start": 0,
|
||||||
|
"end": 23
|
||||||
}
|
}
|
||||||
],
|
},
|
||||||
"optional": false
|
"start": 0,
|
||||||
|
"end": 23
|
||||||
}
|
}
|
||||||
}
|
]
|
||||||
]
|
},
|
||||||
|
"start": 0,
|
||||||
|
"end": 23
|
||||||
}
|
}
|
||||||
|
@ -1,53 +1,75 @@
|
|||||||
---
|
---
|
||||||
source: kcl/src/parser/parser_impl.rs
|
source: kcl/src/parser/parser_impl.rs
|
||||||
|
assertion_line: 3678
|
||||||
expression: actual
|
expression: actual
|
||||||
---
|
---
|
||||||
{
|
{
|
||||||
|
"type": "UnboxedNode",
|
||||||
|
"kind": {
|
||||||
|
"body": [
|
||||||
|
{
|
||||||
|
"type": "VariableDeclaration",
|
||||||
|
"type": "UnboxedNode",
|
||||||
|
"kind": {
|
||||||
|
"type": "VariableDeclaration",
|
||||||
|
"declarations": [
|
||||||
|
{
|
||||||
|
"type": "UnboxedNode",
|
||||||
|
"kind": {
|
||||||
|
"type": "VariableDeclarator",
|
||||||
|
"id": {
|
||||||
|
"type": "UnboxedNode",
|
||||||
|
"kind": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"name": "myArray"
|
||||||
|
},
|
||||||
|
"start": 6,
|
||||||
|
"end": 13
|
||||||
|
},
|
||||||
|
"init": {
|
||||||
|
"type": "ArrayRangeExpression",
|
||||||
|
"type": "UnboxedNode",
|
||||||
|
"kind": {
|
||||||
|
"type": "ArrayRangeExpression",
|
||||||
|
"startElement": {
|
||||||
|
"type": "Literal",
|
||||||
|
"type": "UnboxedNode",
|
||||||
|
"kind": {
|
||||||
|
"type": "Literal",
|
||||||
|
"value": 0,
|
||||||
|
"raw": "0"
|
||||||
|
},
|
||||||
|
"start": 17,
|
||||||
|
"end": 18
|
||||||
|
},
|
||||||
|
"endElement": {
|
||||||
|
"type": "Literal",
|
||||||
|
"type": "UnboxedNode",
|
||||||
|
"kind": {
|
||||||
|
"type": "Literal",
|
||||||
|
"value": 10,
|
||||||
|
"raw": "10"
|
||||||
|
},
|
||||||
|
"start": 20,
|
||||||
|
"end": 22
|
||||||
|
},
|
||||||
|
"endInclusive": true
|
||||||
|
},
|
||||||
|
"start": 16,
|
||||||
|
"end": 23
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"start": 6,
|
||||||
|
"end": 23
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"kind": "const"
|
||||||
|
},
|
||||||
|
"start": 0,
|
||||||
|
"end": 23
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
"start": 0,
|
"start": 0,
|
||||||
"end": 23,
|
"end": 23
|
||||||
"body": [
|
|
||||||
{
|
|
||||||
"type": "VariableDeclaration",
|
|
||||||
"type": "VariableDeclaration",
|
|
||||||
"start": 0,
|
|
||||||
"end": 23,
|
|
||||||
"declarations": [
|
|
||||||
{
|
|
||||||
"type": "VariableDeclarator",
|
|
||||||
"start": 6,
|
|
||||||
"end": 23,
|
|
||||||
"id": {
|
|
||||||
"type": "Identifier",
|
|
||||||
"start": 6,
|
|
||||||
"end": 13,
|
|
||||||
"name": "myArray"
|
|
||||||
},
|
|
||||||
"init": {
|
|
||||||
"type": "ArrayRangeExpression",
|
|
||||||
"type": "ArrayRangeExpression",
|
|
||||||
"start": 16,
|
|
||||||
"end": 23,
|
|
||||||
"startElement": {
|
|
||||||
"type": "Literal",
|
|
||||||
"type": "Literal",
|
|
||||||
"start": 17,
|
|
||||||
"end": 18,
|
|
||||||
"value": 0,
|
|
||||||
"raw": "0"
|
|
||||||
},
|
|
||||||
"endElement": {
|
|
||||||
"type": "Literal",
|
|
||||||
"type": "Literal",
|
|
||||||
"start": 20,
|
|
||||||
"end": 22,
|
|
||||||
"value": 10,
|
|
||||||
"raw": "10"
|
|
||||||
},
|
|
||||||
"endInclusive": true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"kind": "const"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
|
@ -1,77 +1,111 @@
|
|||||||
---
|
---
|
||||||
source: kcl/src/parser/parser_impl.rs
|
source: kcl/src/parser/parser_impl.rs
|
||||||
|
assertion_line: 3679
|
||||||
expression: actual
|
expression: actual
|
||||||
---
|
---
|
||||||
{
|
{
|
||||||
"start": 0,
|
"type": "UnboxedNode",
|
||||||
"end": 80,
|
"kind": {
|
||||||
"body": [
|
"body": [
|
||||||
{
|
{
|
||||||
"type": "VariableDeclaration",
|
"type": "VariableDeclaration",
|
||||||
"type": "VariableDeclaration",
|
"type": "UnboxedNode",
|
||||||
"start": 5,
|
"kind": {
|
||||||
"end": 57,
|
"type": "VariableDeclaration",
|
||||||
"declarations": [
|
"declarations": [
|
||||||
{
|
{
|
||||||
"type": "VariableDeclarator",
|
"type": "UnboxedNode",
|
||||||
"start": 8,
|
"kind": {
|
||||||
"end": 57,
|
"type": "VariableDeclarator",
|
||||||
"id": {
|
"id": {
|
||||||
"type": "Identifier",
|
"type": "UnboxedNode",
|
||||||
"start": 8,
|
"kind": {
|
||||||
"end": 24,
|
"type": "Identifier",
|
||||||
"name": "firstPrimeNumber"
|
"name": "firstPrimeNumber"
|
||||||
},
|
},
|
||||||
"init": {
|
"start": 8,
|
||||||
"type": "FunctionExpression",
|
"end": 24
|
||||||
"type": "FunctionExpression",
|
},
|
||||||
"start": 27,
|
"init": {
|
||||||
"end": 57,
|
"type": "FunctionExpression",
|
||||||
"params": [],
|
"type": "UnboxedNode",
|
||||||
"body": {
|
"kind": {
|
||||||
"start": 33,
|
"type": "FunctionExpression",
|
||||||
"end": 57,
|
"params": [],
|
||||||
"body": [
|
"body": {
|
||||||
{
|
"type": "UnboxedNode",
|
||||||
"type": "ReturnStatement",
|
"kind": {
|
||||||
"type": "ReturnStatement",
|
"body": [
|
||||||
"start": 43,
|
{
|
||||||
"end": 51,
|
"type": "ReturnStatement",
|
||||||
"argument": {
|
"type": "UnboxedNode",
|
||||||
"type": "Literal",
|
"kind": {
|
||||||
"type": "Literal",
|
"type": "ReturnStatement",
|
||||||
"start": 50,
|
"argument": {
|
||||||
"end": 51,
|
"type": "Literal",
|
||||||
"value": 2,
|
"type": "UnboxedNode",
|
||||||
"raw": "2"
|
"kind": {
|
||||||
}
|
"type": "Literal",
|
||||||
|
"value": 2,
|
||||||
|
"raw": "2"
|
||||||
|
},
|
||||||
|
"start": 50,
|
||||||
|
"end": 51
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"start": 43,
|
||||||
|
"end": 51
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"start": 33,
|
||||||
|
"end": 57
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"start": 27,
|
||||||
|
"end": 57
|
||||||
}
|
}
|
||||||
]
|
},
|
||||||
|
"start": 8,
|
||||||
|
"end": 57
|
||||||
}
|
}
|
||||||
}
|
],
|
||||||
}
|
"kind": "fn"
|
||||||
],
|
|
||||||
"kind": "fn"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "ExpressionStatement",
|
|
||||||
"type": "ExpressionStatement",
|
|
||||||
"start": 62,
|
|
||||||
"end": 80,
|
|
||||||
"expression": {
|
|
||||||
"type": "CallExpression",
|
|
||||||
"type": "CallExpression",
|
|
||||||
"start": 62,
|
|
||||||
"end": 80,
|
|
||||||
"callee": {
|
|
||||||
"type": "Identifier",
|
|
||||||
"start": 62,
|
|
||||||
"end": 78,
|
|
||||||
"name": "firstPrimeNumber"
|
|
||||||
},
|
},
|
||||||
"arguments": [],
|
"start": 5,
|
||||||
"optional": false
|
"end": 57
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "ExpressionStatement",
|
||||||
|
"type": "UnboxedNode",
|
||||||
|
"kind": {
|
||||||
|
"type": "ExpressionStatement",
|
||||||
|
"expression": {
|
||||||
|
"type": "CallExpression",
|
||||||
|
"type": "UnboxedNode",
|
||||||
|
"kind": {
|
||||||
|
"type": "CallExpression",
|
||||||
|
"callee": {
|
||||||
|
"type": "UnboxedNode",
|
||||||
|
"kind": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"name": "firstPrimeNumber"
|
||||||
|
},
|
||||||
|
"start": 62,
|
||||||
|
"end": 78
|
||||||
|
},
|
||||||
|
"arguments": [],
|
||||||
|
"optional": false
|
||||||
|
},
|
||||||
|
"start": 62,
|
||||||
|
"end": 80
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"start": 62,
|
||||||
|
"end": 80
|
||||||
}
|
}
|
||||||
}
|
]
|
||||||
]
|
},
|
||||||
|
"start": 0,
|
||||||
|
"end": 80
|
||||||
}
|
}
|
||||||
|
@ -1,97 +1,137 @@
|
|||||||
---
|
---
|
||||||
source: kcl/src/parser/parser_impl.rs
|
source: kcl/src/parser/parser_impl.rs
|
||||||
|
assertion_line: 3687
|
||||||
expression: actual
|
expression: actual
|
||||||
---
|
---
|
||||||
{
|
{
|
||||||
"start": 0,
|
"type": "UnboxedNode",
|
||||||
"end": 66,
|
"kind": {
|
||||||
"body": [
|
"body": [
|
||||||
{
|
{
|
||||||
"type": "VariableDeclaration",
|
"type": "VariableDeclaration",
|
||||||
"type": "VariableDeclaration",
|
"type": "UnboxedNode",
|
||||||
"start": 0,
|
"kind": {
|
||||||
"end": 49,
|
"type": "VariableDeclaration",
|
||||||
"declarations": [
|
"declarations": [
|
||||||
{
|
{
|
||||||
"type": "VariableDeclarator",
|
"type": "UnboxedNode",
|
||||||
"start": 3,
|
"kind": {
|
||||||
"end": 49,
|
"type": "VariableDeclarator",
|
||||||
"id": {
|
"id": {
|
||||||
"type": "Identifier",
|
"type": "UnboxedNode",
|
||||||
"start": 3,
|
"kind": {
|
||||||
"end": 8,
|
"type": "Identifier",
|
||||||
"name": "thing"
|
"name": "thing"
|
||||||
},
|
},
|
||||||
"init": {
|
"start": 3,
|
||||||
"type": "FunctionExpression",
|
"end": 8
|
||||||
"type": "FunctionExpression",
|
|
||||||
"start": 11,
|
|
||||||
"end": 49,
|
|
||||||
"params": [
|
|
||||||
{
|
|
||||||
"type": "Parameter",
|
|
||||||
"identifier": {
|
|
||||||
"type": "Identifier",
|
|
||||||
"start": 12,
|
|
||||||
"end": 17,
|
|
||||||
"name": "param"
|
|
||||||
},
|
},
|
||||||
"optional": false
|
"init": {
|
||||||
}
|
"type": "FunctionExpression",
|
||||||
],
|
"type": "UnboxedNode",
|
||||||
"body": {
|
"kind": {
|
||||||
"start": 22,
|
"type": "FunctionExpression",
|
||||||
"end": 49,
|
"params": [
|
||||||
"body": [
|
{
|
||||||
{
|
"type": "Parameter",
|
||||||
"type": "ReturnStatement",
|
"identifier": {
|
||||||
"type": "ReturnStatement",
|
"type": "UnboxedNode",
|
||||||
"start": 32,
|
"kind": {
|
||||||
"end": 43,
|
"type": "Identifier",
|
||||||
"argument": {
|
"name": "param"
|
||||||
"type": "Literal",
|
},
|
||||||
"type": "Literal",
|
"start": 12,
|
||||||
"start": 39,
|
"end": 17
|
||||||
"end": 43,
|
},
|
||||||
"value": true,
|
"optional": false
|
||||||
"raw": "true"
|
}
|
||||||
}
|
],
|
||||||
|
"body": {
|
||||||
|
"type": "UnboxedNode",
|
||||||
|
"kind": {
|
||||||
|
"body": [
|
||||||
|
{
|
||||||
|
"type": "ReturnStatement",
|
||||||
|
"type": "UnboxedNode",
|
||||||
|
"kind": {
|
||||||
|
"type": "ReturnStatement",
|
||||||
|
"argument": {
|
||||||
|
"type": "Literal",
|
||||||
|
"type": "UnboxedNode",
|
||||||
|
"kind": {
|
||||||
|
"type": "Literal",
|
||||||
|
"value": true,
|
||||||
|
"raw": "true"
|
||||||
|
},
|
||||||
|
"start": 39,
|
||||||
|
"end": 43
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"start": 32,
|
||||||
|
"end": 43
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"start": 22,
|
||||||
|
"end": 49
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"start": 11,
|
||||||
|
"end": 49
|
||||||
}
|
}
|
||||||
]
|
},
|
||||||
|
"start": 3,
|
||||||
|
"end": 49
|
||||||
}
|
}
|
||||||
}
|
],
|
||||||
}
|
"kind": "fn"
|
||||||
],
|
|
||||||
"kind": "fn"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "ExpressionStatement",
|
|
||||||
"type": "ExpressionStatement",
|
|
||||||
"start": 54,
|
|
||||||
"end": 66,
|
|
||||||
"expression": {
|
|
||||||
"type": "CallExpression",
|
|
||||||
"type": "CallExpression",
|
|
||||||
"start": 54,
|
|
||||||
"end": 66,
|
|
||||||
"callee": {
|
|
||||||
"type": "Identifier",
|
|
||||||
"start": 54,
|
|
||||||
"end": 59,
|
|
||||||
"name": "thing"
|
|
||||||
},
|
},
|
||||||
"arguments": [
|
"start": 0,
|
||||||
{
|
"end": 49
|
||||||
"type": "Literal",
|
},
|
||||||
"type": "Literal",
|
{
|
||||||
"start": 60,
|
"type": "ExpressionStatement",
|
||||||
"end": 65,
|
"type": "UnboxedNode",
|
||||||
"value": false,
|
"kind": {
|
||||||
"raw": "false"
|
"type": "ExpressionStatement",
|
||||||
|
"expression": {
|
||||||
|
"type": "CallExpression",
|
||||||
|
"type": "UnboxedNode",
|
||||||
|
"kind": {
|
||||||
|
"type": "CallExpression",
|
||||||
|
"callee": {
|
||||||
|
"type": "UnboxedNode",
|
||||||
|
"kind": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"name": "thing"
|
||||||
|
},
|
||||||
|
"start": 54,
|
||||||
|
"end": 59
|
||||||
|
},
|
||||||
|
"arguments": [
|
||||||
|
{
|
||||||
|
"type": "Literal",
|
||||||
|
"type": "UnboxedNode",
|
||||||
|
"kind": {
|
||||||
|
"type": "Literal",
|
||||||
|
"value": false,
|
||||||
|
"raw": "false"
|
||||||
|
},
|
||||||
|
"start": 60,
|
||||||
|
"end": 65
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"optional": false
|
||||||
|
},
|
||||||
|
"start": 54,
|
||||||
|
"end": 66
|
||||||
}
|
}
|
||||||
],
|
},
|
||||||
"optional": false
|
"start": 54,
|
||||||
|
"end": 66
|
||||||
}
|
}
|
||||||
}
|
]
|
||||||
]
|
},
|
||||||
|
"start": 0,
|
||||||
|
"end": 66
|
||||||
}
|
}
|
||||||
|
@ -1,247 +1,347 @@
|
|||||||
---
|
---
|
||||||
source: kcl/src/parser/parser_impl.rs
|
source: kcl/src/parser/parser_impl.rs
|
||||||
|
assertion_line: 3694
|
||||||
expression: actual
|
expression: actual
|
||||||
---
|
---
|
||||||
{
|
{
|
||||||
"start": 0,
|
"type": "UnboxedNode",
|
||||||
"end": 165,
|
"kind": {
|
||||||
"body": [
|
"body": [
|
||||||
{
|
{
|
||||||
"type": "VariableDeclaration",
|
"type": "VariableDeclaration",
|
||||||
"type": "VariableDeclaration",
|
"type": "UnboxedNode",
|
||||||
"start": 0,
|
"kind": {
|
||||||
"end": 165,
|
"type": "VariableDeclaration",
|
||||||
"declarations": [
|
"declarations": [
|
||||||
{
|
{
|
||||||
"type": "VariableDeclarator",
|
"type": "UnboxedNode",
|
||||||
"start": 6,
|
"kind": {
|
||||||
"end": 165,
|
"type": "VariableDeclarator",
|
||||||
"id": {
|
"id": {
|
||||||
"type": "Identifier",
|
"type": "UnboxedNode",
|
||||||
"start": 6,
|
"kind": {
|
||||||
"end": 14,
|
"type": "Identifier",
|
||||||
"name": "mySketch"
|
"name": "mySketch"
|
||||||
},
|
},
|
||||||
"init": {
|
"start": 6,
|
||||||
"type": "PipeExpression",
|
"end": 14
|
||||||
"type": "PipeExpression",
|
},
|
||||||
"start": 17,
|
"init": {
|
||||||
"end": 165,
|
"type": "PipeExpression",
|
||||||
"body": [
|
"type": "UnboxedNode",
|
||||||
{
|
"kind": {
|
||||||
"type": "CallExpression",
|
"type": "PipeExpression",
|
||||||
"type": "CallExpression",
|
"body": [
|
||||||
"start": 17,
|
{
|
||||||
"end": 37,
|
"type": "CallExpression",
|
||||||
"callee": {
|
"type": "UnboxedNode",
|
||||||
"type": "Identifier",
|
"kind": {
|
||||||
|
"type": "CallExpression",
|
||||||
|
"callee": {
|
||||||
|
"type": "UnboxedNode",
|
||||||
|
"kind": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"name": "startSketchAt"
|
||||||
|
},
|
||||||
|
"start": 17,
|
||||||
|
"end": 30
|
||||||
|
},
|
||||||
|
"arguments": [
|
||||||
|
{
|
||||||
|
"type": "ArrayExpression",
|
||||||
|
"type": "UnboxedNode",
|
||||||
|
"kind": {
|
||||||
|
"type": "ArrayExpression",
|
||||||
|
"elements": [
|
||||||
|
{
|
||||||
|
"type": "Literal",
|
||||||
|
"type": "UnboxedNode",
|
||||||
|
"kind": {
|
||||||
|
"type": "Literal",
|
||||||
|
"value": 0,
|
||||||
|
"raw": "0"
|
||||||
|
},
|
||||||
|
"start": 32,
|
||||||
|
"end": 33
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "Literal",
|
||||||
|
"type": "UnboxedNode",
|
||||||
|
"kind": {
|
||||||
|
"type": "Literal",
|
||||||
|
"value": 0,
|
||||||
|
"raw": "0"
|
||||||
|
},
|
||||||
|
"start": 34,
|
||||||
|
"end": 35
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"start": 31,
|
||||||
|
"end": 36
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"optional": false
|
||||||
|
},
|
||||||
|
"start": 17,
|
||||||
|
"end": 37
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "CallExpression",
|
||||||
|
"type": "UnboxedNode",
|
||||||
|
"kind": {
|
||||||
|
"type": "CallExpression",
|
||||||
|
"callee": {
|
||||||
|
"type": "UnboxedNode",
|
||||||
|
"kind": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"name": "lineTo"
|
||||||
|
},
|
||||||
|
"start": 49,
|
||||||
|
"end": 55
|
||||||
|
},
|
||||||
|
"arguments": [
|
||||||
|
{
|
||||||
|
"type": "ArrayExpression",
|
||||||
|
"type": "UnboxedNode",
|
||||||
|
"kind": {
|
||||||
|
"type": "ArrayExpression",
|
||||||
|
"elements": [
|
||||||
|
{
|
||||||
|
"type": "Literal",
|
||||||
|
"type": "UnboxedNode",
|
||||||
|
"kind": {
|
||||||
|
"type": "Literal",
|
||||||
|
"value": 0,
|
||||||
|
"raw": "0"
|
||||||
|
},
|
||||||
|
"start": 57,
|
||||||
|
"end": 58
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "Literal",
|
||||||
|
"type": "UnboxedNode",
|
||||||
|
"kind": {
|
||||||
|
"type": "Literal",
|
||||||
|
"value": 1,
|
||||||
|
"raw": "1"
|
||||||
|
},
|
||||||
|
"start": 60,
|
||||||
|
"end": 61
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"start": 56,
|
||||||
|
"end": 62
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "PipeSubstitution",
|
||||||
|
"type": "UnboxedNode",
|
||||||
|
"kind": {
|
||||||
|
"type": "PipeSubstitution"
|
||||||
|
},
|
||||||
|
"start": 64,
|
||||||
|
"end": 65
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "TagDeclarator",
|
||||||
|
"type": "UnboxedNode",
|
||||||
|
"kind": {
|
||||||
|
"type": "TagDeclarator",
|
||||||
|
"value": "myPath"
|
||||||
|
},
|
||||||
|
"start": 67,
|
||||||
|
"end": 74
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"optional": false
|
||||||
|
},
|
||||||
|
"start": 49,
|
||||||
|
"end": 75
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "CallExpression",
|
||||||
|
"type": "UnboxedNode",
|
||||||
|
"kind": {
|
||||||
|
"type": "CallExpression",
|
||||||
|
"callee": {
|
||||||
|
"type": "UnboxedNode",
|
||||||
|
"kind": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"name": "lineTo"
|
||||||
|
},
|
||||||
|
"start": 87,
|
||||||
|
"end": 93
|
||||||
|
},
|
||||||
|
"arguments": [
|
||||||
|
{
|
||||||
|
"type": "ArrayExpression",
|
||||||
|
"type": "UnboxedNode",
|
||||||
|
"kind": {
|
||||||
|
"type": "ArrayExpression",
|
||||||
|
"elements": [
|
||||||
|
{
|
||||||
|
"type": "Literal",
|
||||||
|
"type": "UnboxedNode",
|
||||||
|
"kind": {
|
||||||
|
"type": "Literal",
|
||||||
|
"value": 1,
|
||||||
|
"raw": "1"
|
||||||
|
},
|
||||||
|
"start": 95,
|
||||||
|
"end": 96
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "Literal",
|
||||||
|
"type": "UnboxedNode",
|
||||||
|
"kind": {
|
||||||
|
"type": "Literal",
|
||||||
|
"value": 1,
|
||||||
|
"raw": "1"
|
||||||
|
},
|
||||||
|
"start": 98,
|
||||||
|
"end": 99
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"start": 94,
|
||||||
|
"end": 100
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "PipeSubstitution",
|
||||||
|
"type": "UnboxedNode",
|
||||||
|
"kind": {
|
||||||
|
"type": "PipeSubstitution"
|
||||||
|
},
|
||||||
|
"start": 102,
|
||||||
|
"end": 103
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"optional": false
|
||||||
|
},
|
||||||
|
"start": 87,
|
||||||
|
"end": 104
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "CallExpression",
|
||||||
|
"type": "UnboxedNode",
|
||||||
|
"kind": {
|
||||||
|
"type": "CallExpression",
|
||||||
|
"callee": {
|
||||||
|
"type": "UnboxedNode",
|
||||||
|
"kind": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"name": "lineTo"
|
||||||
|
},
|
||||||
|
"start": 116,
|
||||||
|
"end": 122
|
||||||
|
},
|
||||||
|
"arguments": [
|
||||||
|
{
|
||||||
|
"type": "ArrayExpression",
|
||||||
|
"type": "UnboxedNode",
|
||||||
|
"kind": {
|
||||||
|
"type": "ArrayExpression",
|
||||||
|
"elements": [
|
||||||
|
{
|
||||||
|
"type": "Literal",
|
||||||
|
"type": "UnboxedNode",
|
||||||
|
"kind": {
|
||||||
|
"type": "Literal",
|
||||||
|
"value": 1,
|
||||||
|
"raw": "1"
|
||||||
|
},
|
||||||
|
"start": 124,
|
||||||
|
"end": 125
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "Literal",
|
||||||
|
"type": "UnboxedNode",
|
||||||
|
"kind": {
|
||||||
|
"type": "Literal",
|
||||||
|
"value": 0,
|
||||||
|
"raw": "0"
|
||||||
|
},
|
||||||
|
"start": 127,
|
||||||
|
"end": 128
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"start": 123,
|
||||||
|
"end": 129
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "PipeSubstitution",
|
||||||
|
"type": "UnboxedNode",
|
||||||
|
"kind": {
|
||||||
|
"type": "PipeSubstitution"
|
||||||
|
},
|
||||||
|
"start": 131,
|
||||||
|
"end": 132
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "TagDeclarator",
|
||||||
|
"type": "UnboxedNode",
|
||||||
|
"kind": {
|
||||||
|
"type": "TagDeclarator",
|
||||||
|
"value": "rightPath"
|
||||||
|
},
|
||||||
|
"start": 134,
|
||||||
|
"end": 144
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"optional": false
|
||||||
|
},
|
||||||
|
"start": 116,
|
||||||
|
"end": 145
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "CallExpression",
|
||||||
|
"type": "UnboxedNode",
|
||||||
|
"kind": {
|
||||||
|
"type": "CallExpression",
|
||||||
|
"callee": {
|
||||||
|
"type": "UnboxedNode",
|
||||||
|
"kind": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"name": "close"
|
||||||
|
},
|
||||||
|
"start": 157,
|
||||||
|
"end": 162
|
||||||
|
},
|
||||||
|
"arguments": [
|
||||||
|
{
|
||||||
|
"type": "PipeSubstitution",
|
||||||
|
"type": "UnboxedNode",
|
||||||
|
"kind": {
|
||||||
|
"type": "PipeSubstitution"
|
||||||
|
},
|
||||||
|
"start": 163,
|
||||||
|
"end": 164
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"optional": false
|
||||||
|
},
|
||||||
|
"start": 157,
|
||||||
|
"end": 165
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
"start": 17,
|
"start": 17,
|
||||||
"end": 30,
|
"end": 165
|
||||||
"name": "startSketchAt"
|
}
|
||||||
},
|
|
||||||
"arguments": [
|
|
||||||
{
|
|
||||||
"type": "ArrayExpression",
|
|
||||||
"type": "ArrayExpression",
|
|
||||||
"start": 31,
|
|
||||||
"end": 36,
|
|
||||||
"elements": [
|
|
||||||
{
|
|
||||||
"type": "Literal",
|
|
||||||
"type": "Literal",
|
|
||||||
"start": 32,
|
|
||||||
"end": 33,
|
|
||||||
"value": 0,
|
|
||||||
"raw": "0"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "Literal",
|
|
||||||
"type": "Literal",
|
|
||||||
"start": 34,
|
|
||||||
"end": 35,
|
|
||||||
"value": 0,
|
|
||||||
"raw": "0"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"optional": false
|
|
||||||
},
|
},
|
||||||
{
|
"start": 6,
|
||||||
"type": "CallExpression",
|
"end": 165
|
||||||
"type": "CallExpression",
|
}
|
||||||
"start": 49,
|
],
|
||||||
"end": 75,
|
"kind": "const"
|
||||||
"callee": {
|
},
|
||||||
"type": "Identifier",
|
"start": 0,
|
||||||
"start": 49,
|
"end": 165
|
||||||
"end": 55,
|
}
|
||||||
"name": "lineTo"
|
]
|
||||||
},
|
},
|
||||||
"arguments": [
|
"start": 0,
|
||||||
{
|
"end": 165
|
||||||
"type": "ArrayExpression",
|
|
||||||
"type": "ArrayExpression",
|
|
||||||
"start": 56,
|
|
||||||
"end": 62,
|
|
||||||
"elements": [
|
|
||||||
{
|
|
||||||
"type": "Literal",
|
|
||||||
"type": "Literal",
|
|
||||||
"start": 57,
|
|
||||||
"end": 58,
|
|
||||||
"value": 0,
|
|
||||||
"raw": "0"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "Literal",
|
|
||||||
"type": "Literal",
|
|
||||||
"start": 60,
|
|
||||||
"end": 61,
|
|
||||||
"value": 1,
|
|
||||||
"raw": "1"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "PipeSubstitution",
|
|
||||||
"type": "PipeSubstitution",
|
|
||||||
"start": 64,
|
|
||||||
"end": 65
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "TagDeclarator",
|
|
||||||
"type": "TagDeclarator",
|
|
||||||
"start": 67,
|
|
||||||
"end": 74,
|
|
||||||
"value": "myPath"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"optional": false
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "CallExpression",
|
|
||||||
"type": "CallExpression",
|
|
||||||
"start": 87,
|
|
||||||
"end": 104,
|
|
||||||
"callee": {
|
|
||||||
"type": "Identifier",
|
|
||||||
"start": 87,
|
|
||||||
"end": 93,
|
|
||||||
"name": "lineTo"
|
|
||||||
},
|
|
||||||
"arguments": [
|
|
||||||
{
|
|
||||||
"type": "ArrayExpression",
|
|
||||||
"type": "ArrayExpression",
|
|
||||||
"start": 94,
|
|
||||||
"end": 100,
|
|
||||||
"elements": [
|
|
||||||
{
|
|
||||||
"type": "Literal",
|
|
||||||
"type": "Literal",
|
|
||||||
"start": 95,
|
|
||||||
"end": 96,
|
|
||||||
"value": 1,
|
|
||||||
"raw": "1"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "Literal",
|
|
||||||
"type": "Literal",
|
|
||||||
"start": 98,
|
|
||||||
"end": 99,
|
|
||||||
"value": 1,
|
|
||||||
"raw": "1"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "PipeSubstitution",
|
|
||||||
"type": "PipeSubstitution",
|
|
||||||
"start": 102,
|
|
||||||
"end": 103
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"optional": false
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "CallExpression",
|
|
||||||
"type": "CallExpression",
|
|
||||||
"start": 116,
|
|
||||||
"end": 145,
|
|
||||||
"callee": {
|
|
||||||
"type": "Identifier",
|
|
||||||
"start": 116,
|
|
||||||
"end": 122,
|
|
||||||
"name": "lineTo"
|
|
||||||
},
|
|
||||||
"arguments": [
|
|
||||||
{
|
|
||||||
"type": "ArrayExpression",
|
|
||||||
"type": "ArrayExpression",
|
|
||||||
"start": 123,
|
|
||||||
"end": 129,
|
|
||||||
"elements": [
|
|
||||||
{
|
|
||||||
"type": "Literal",
|
|
||||||
"type": "Literal",
|
|
||||||
"start": 124,
|
|
||||||
"end": 125,
|
|
||||||
"value": 1,
|
|
||||||
"raw": "1"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "Literal",
|
|
||||||
"type": "Literal",
|
|
||||||
"start": 127,
|
|
||||||
"end": 128,
|
|
||||||
"value": 0,
|
|
||||||
"raw": "0"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "PipeSubstitution",
|
|
||||||
"type": "PipeSubstitution",
|
|
||||||
"start": 131,
|
|
||||||
"end": 132
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "TagDeclarator",
|
|
||||||
"type": "TagDeclarator",
|
|
||||||
"start": 134,
|
|
||||||
"end": 144,
|
|
||||||
"value": "rightPath"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"optional": false
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "CallExpression",
|
|
||||||
"type": "CallExpression",
|
|
||||||
"start": 157,
|
|
||||||
"end": 165,
|
|
||||||
"callee": {
|
|
||||||
"type": "Identifier",
|
|
||||||
"start": 157,
|
|
||||||
"end": 162,
|
|
||||||
"name": "close"
|
|
||||||
},
|
|
||||||
"arguments": [
|
|
||||||
{
|
|
||||||
"type": "PipeSubstitution",
|
|
||||||
"type": "PipeSubstitution",
|
|
||||||
"start": 163,
|
|
||||||
"end": 164
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"optional": false
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"kind": "const"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
|
@ -1,143 +1,201 @@
|
|||||||
---
|
---
|
||||||
source: kcl/src/parser/parser_impl.rs
|
source: kcl/src/parser/parser_impl.rs
|
||||||
|
assertion_line: 3702
|
||||||
expression: actual
|
expression: actual
|
||||||
---
|
---
|
||||||
{
|
{
|
||||||
"start": 0,
|
"type": "UnboxedNode",
|
||||||
"end": 70,
|
"kind": {
|
||||||
"body": [
|
"body": [
|
||||||
{
|
{
|
||||||
"type": "VariableDeclaration",
|
"type": "VariableDeclaration",
|
||||||
"type": "VariableDeclaration",
|
"type": "UnboxedNode",
|
||||||
"start": 0,
|
"kind": {
|
||||||
"end": 70,
|
"type": "VariableDeclaration",
|
||||||
"declarations": [
|
"declarations": [
|
||||||
{
|
{
|
||||||
"type": "VariableDeclarator",
|
"type": "UnboxedNode",
|
||||||
"start": 6,
|
"kind": {
|
||||||
"end": 70,
|
"type": "VariableDeclarator",
|
||||||
"id": {
|
"id": {
|
||||||
"type": "Identifier",
|
"type": "UnboxedNode",
|
||||||
"start": 6,
|
"kind": {
|
||||||
"end": 14,
|
"type": "Identifier",
|
||||||
"name": "mySketch"
|
"name": "mySketch"
|
||||||
},
|
},
|
||||||
"init": {
|
"start": 6,
|
||||||
"type": "PipeExpression",
|
"end": 14
|
||||||
"type": "PipeExpression",
|
|
||||||
"start": 17,
|
|
||||||
"end": 70,
|
|
||||||
"body": [
|
|
||||||
{
|
|
||||||
"type": "CallExpression",
|
|
||||||
"type": "CallExpression",
|
|
||||||
"start": 17,
|
|
||||||
"end": 37,
|
|
||||||
"callee": {
|
|
||||||
"type": "Identifier",
|
|
||||||
"start": 17,
|
|
||||||
"end": 30,
|
|
||||||
"name": "startSketchAt"
|
|
||||||
},
|
},
|
||||||
"arguments": [
|
"init": {
|
||||||
{
|
"type": "PipeExpression",
|
||||||
"type": "ArrayExpression",
|
"type": "UnboxedNode",
|
||||||
"type": "ArrayExpression",
|
"kind": {
|
||||||
"start": 31,
|
"type": "PipeExpression",
|
||||||
"end": 36,
|
"body": [
|
||||||
"elements": [
|
|
||||||
{
|
{
|
||||||
"type": "Literal",
|
"type": "CallExpression",
|
||||||
"type": "Literal",
|
"type": "UnboxedNode",
|
||||||
"start": 32,
|
"kind": {
|
||||||
"end": 33,
|
"type": "CallExpression",
|
||||||
"value": 0,
|
"callee": {
|
||||||
"raw": "0"
|
"type": "UnboxedNode",
|
||||||
|
"kind": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"name": "startSketchAt"
|
||||||
|
},
|
||||||
|
"start": 17,
|
||||||
|
"end": 30
|
||||||
|
},
|
||||||
|
"arguments": [
|
||||||
|
{
|
||||||
|
"type": "ArrayExpression",
|
||||||
|
"type": "UnboxedNode",
|
||||||
|
"kind": {
|
||||||
|
"type": "ArrayExpression",
|
||||||
|
"elements": [
|
||||||
|
{
|
||||||
|
"type": "Literal",
|
||||||
|
"type": "UnboxedNode",
|
||||||
|
"kind": {
|
||||||
|
"type": "Literal",
|
||||||
|
"value": 0,
|
||||||
|
"raw": "0"
|
||||||
|
},
|
||||||
|
"start": 32,
|
||||||
|
"end": 33
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "Literal",
|
||||||
|
"type": "UnboxedNode",
|
||||||
|
"kind": {
|
||||||
|
"type": "Literal",
|
||||||
|
"value": 0,
|
||||||
|
"raw": "0"
|
||||||
|
},
|
||||||
|
"start": 34,
|
||||||
|
"end": 35
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"start": 31,
|
||||||
|
"end": 36
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"optional": false
|
||||||
|
},
|
||||||
|
"start": 17,
|
||||||
|
"end": 37
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "Literal",
|
"type": "CallExpression",
|
||||||
"type": "Literal",
|
"type": "UnboxedNode",
|
||||||
"start": 34,
|
"kind": {
|
||||||
"end": 35,
|
"type": "CallExpression",
|
||||||
"value": 0,
|
"callee": {
|
||||||
"raw": "0"
|
"type": "UnboxedNode",
|
||||||
}
|
"kind": {
|
||||||
]
|
"type": "Identifier",
|
||||||
}
|
"name": "lineTo"
|
||||||
],
|
},
|
||||||
"optional": false
|
"start": 41,
|
||||||
},
|
"end": 47
|
||||||
{
|
},
|
||||||
"type": "CallExpression",
|
"arguments": [
|
||||||
"type": "CallExpression",
|
{
|
||||||
"start": 41,
|
"type": "ArrayExpression",
|
||||||
"end": 58,
|
"type": "UnboxedNode",
|
||||||
"callee": {
|
"kind": {
|
||||||
"type": "Identifier",
|
"type": "ArrayExpression",
|
||||||
"start": 41,
|
"elements": [
|
||||||
"end": 47,
|
{
|
||||||
"name": "lineTo"
|
"type": "Literal",
|
||||||
},
|
"type": "UnboxedNode",
|
||||||
"arguments": [
|
"kind": {
|
||||||
{
|
"type": "Literal",
|
||||||
"type": "ArrayExpression",
|
"value": 1,
|
||||||
"type": "ArrayExpression",
|
"raw": "1"
|
||||||
"start": 48,
|
},
|
||||||
"end": 54,
|
"start": 49,
|
||||||
"elements": [
|
"end": 50
|
||||||
{
|
},
|
||||||
"type": "Literal",
|
{
|
||||||
"type": "Literal",
|
"type": "Literal",
|
||||||
"start": 49,
|
"type": "UnboxedNode",
|
||||||
"end": 50,
|
"kind": {
|
||||||
"value": 1,
|
"type": "Literal",
|
||||||
"raw": "1"
|
"value": 1,
|
||||||
|
"raw": "1"
|
||||||
|
},
|
||||||
|
"start": 52,
|
||||||
|
"end": 53
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"start": 48,
|
||||||
|
"end": 54
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "PipeSubstitution",
|
||||||
|
"type": "UnboxedNode",
|
||||||
|
"kind": {
|
||||||
|
"type": "PipeSubstitution"
|
||||||
|
},
|
||||||
|
"start": 56,
|
||||||
|
"end": 57
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"optional": false
|
||||||
|
},
|
||||||
|
"start": 41,
|
||||||
|
"end": 58
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "Literal",
|
"type": "CallExpression",
|
||||||
"type": "Literal",
|
"type": "UnboxedNode",
|
||||||
"start": 52,
|
"kind": {
|
||||||
"end": 53,
|
"type": "CallExpression",
|
||||||
"value": 1,
|
"callee": {
|
||||||
"raw": "1"
|
"type": "UnboxedNode",
|
||||||
|
"kind": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"name": "close"
|
||||||
|
},
|
||||||
|
"start": 62,
|
||||||
|
"end": 67
|
||||||
|
},
|
||||||
|
"arguments": [
|
||||||
|
{
|
||||||
|
"type": "PipeSubstitution",
|
||||||
|
"type": "UnboxedNode",
|
||||||
|
"kind": {
|
||||||
|
"type": "PipeSubstitution"
|
||||||
|
},
|
||||||
|
"start": 68,
|
||||||
|
"end": 69
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"optional": false
|
||||||
|
},
|
||||||
|
"start": 62,
|
||||||
|
"end": 70
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
"start": 17,
|
||||||
"type": "PipeSubstitution",
|
"end": 70
|
||||||
"type": "PipeSubstitution",
|
}
|
||||||
"start": 56,
|
|
||||||
"end": 57
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"optional": false
|
|
||||||
},
|
},
|
||||||
{
|
"start": 6,
|
||||||
"type": "CallExpression",
|
"end": 70
|
||||||
"type": "CallExpression",
|
}
|
||||||
"start": 62,
|
],
|
||||||
"end": 70,
|
"kind": "const"
|
||||||
"callee": {
|
},
|
||||||
"type": "Identifier",
|
"start": 0,
|
||||||
"start": 62,
|
"end": 70
|
||||||
"end": 67,
|
}
|
||||||
"name": "close"
|
]
|
||||||
},
|
},
|
||||||
"arguments": [
|
"start": 0,
|
||||||
{
|
"end": 70
|
||||||
"type": "PipeSubstitution",
|
|
||||||
"type": "PipeSubstitution",
|
|
||||||
"start": 68,
|
|
||||||
"end": 69
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"optional": false
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"kind": "const"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user