Move the wasm lib, and cleanup rust directory and all references (#5585)
* git mv src/wasm-lib rust Signed-off-by: Jess Frazelle <github@jessfraz.com> * mv wasm-lib to workspace Signed-off-by: Jess Frazelle <github@jessfraz.com> * mv kcl-lib Signed-off-by: Jess Frazelle <github@jessfraz.com> * mv derive docs Signed-off-by: Jess Frazelle <github@jessfraz.com> * resolve file paths Signed-off-by: Jess Frazelle <github@jessfraz.com> * clippy Signed-off-by: Jess Frazelle <github@jessfraz.com> * move more shit Signed-off-by: Jess Frazelle <github@jessfraz.com> * fix more paths Signed-off-by: Jess Frazelle <github@jessfraz.com> * make yarn build:wasm work Signed-off-by: Jess Frazelle <github@jessfraz.com> * fix scripts Signed-off-by: Jess Frazelle <github@jessfraz.com> * fixups Signed-off-by: Jess Frazelle <github@jessfraz.com> * better references Signed-off-by: Jess Frazelle <github@jessfraz.com> * fix cargo ci Signed-off-by: Jess Frazelle <github@jessfraz.com> * fix reference Signed-off-by: Jess Frazelle <github@jessfraz.com> * fix more ci Signed-off-by: Jess Frazelle <github@jessfraz.com> * fix tests Signed-off-by: Jess Frazelle <github@jessfraz.com> * cargo sort Signed-off-by: Jess Frazelle <github@jessfraz.com> * fix script Signed-off-by: Jess Frazelle <github@jessfraz.com> * fix Signed-off-by: Jess Frazelle <github@jessfraz.com> * fmt Signed-off-by: Jess Frazelle <github@jessfraz.com> * fix a dep Signed-off-by: Jess Frazelle <github@jessfraz.com> * sort Signed-off-by: Jess Frazelle <github@jessfraz.com> * remove unused deps Signed-off-by: Jess Frazelle <github@jessfraz.com> * Revert "remove unused deps" This reverts commit fbabdb062e275fd5cbc1476f8480a1afee15d972. * updates Signed-off-by: Jess Frazelle <github@jessfraz.com> * deps; Signed-off-by: Jess Frazelle <github@jessfraz.com> * fixes Signed-off-by: Jess Frazelle <github@jessfraz.com> * updates Signed-off-by: Jess Frazelle <github@jessfraz.com> --------- Signed-off-by: Jess Frazelle <github@jessfraz.com>
This commit is contained in:
538
rust/kcl-lib/tests/cube_with_error/artifact_commands.snap
Normal file
538
rust/kcl-lib/tests/cube_with_error/artifact_commands.snap
Normal file
@ -0,0 +1,538 @@
|
||||
---
|
||||
source: kcl/src/simulation_tests.rs
|
||||
description: Artifact commands cube_with_error.kcl
|
||||
---
|
||||
[
|
||||
{
|
||||
"cmdId": "[uuid]",
|
||||
"range": [
|
||||
0,
|
||||
0,
|
||||
0
|
||||
],
|
||||
"command": {
|
||||
"type": "make_plane",
|
||||
"origin": {
|
||||
"x": 0.0,
|
||||
"y": 0.0,
|
||||
"z": 0.0
|
||||
},
|
||||
"x_axis": {
|
||||
"x": 1.0,
|
||||
"y": 0.0,
|
||||
"z": 0.0
|
||||
},
|
||||
"y_axis": {
|
||||
"x": 0.0,
|
||||
"y": 1.0,
|
||||
"z": 0.0
|
||||
},
|
||||
"size": 100.0,
|
||||
"clobber": false,
|
||||
"hide": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"cmdId": "[uuid]",
|
||||
"range": [
|
||||
0,
|
||||
0,
|
||||
0
|
||||
],
|
||||
"command": {
|
||||
"type": "plane_set_color",
|
||||
"plane_id": "[uuid]",
|
||||
"color": {
|
||||
"r": 0.7,
|
||||
"g": 0.28,
|
||||
"b": 0.28,
|
||||
"a": 0.4
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"cmdId": "[uuid]",
|
||||
"range": [
|
||||
0,
|
||||
0,
|
||||
0
|
||||
],
|
||||
"command": {
|
||||
"type": "make_plane",
|
||||
"origin": {
|
||||
"x": 0.0,
|
||||
"y": 0.0,
|
||||
"z": 0.0
|
||||
},
|
||||
"x_axis": {
|
||||
"x": 0.0,
|
||||
"y": 1.0,
|
||||
"z": 0.0
|
||||
},
|
||||
"y_axis": {
|
||||
"x": 0.0,
|
||||
"y": 0.0,
|
||||
"z": 1.0
|
||||
},
|
||||
"size": 100.0,
|
||||
"clobber": false,
|
||||
"hide": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"cmdId": "[uuid]",
|
||||
"range": [
|
||||
0,
|
||||
0,
|
||||
0
|
||||
],
|
||||
"command": {
|
||||
"type": "plane_set_color",
|
||||
"plane_id": "[uuid]",
|
||||
"color": {
|
||||
"r": 0.28,
|
||||
"g": 0.7,
|
||||
"b": 0.28,
|
||||
"a": 0.4
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"cmdId": "[uuid]",
|
||||
"range": [
|
||||
0,
|
||||
0,
|
||||
0
|
||||
],
|
||||
"command": {
|
||||
"type": "make_plane",
|
||||
"origin": {
|
||||
"x": 0.0,
|
||||
"y": 0.0,
|
||||
"z": 0.0
|
||||
},
|
||||
"x_axis": {
|
||||
"x": 1.0,
|
||||
"y": 0.0,
|
||||
"z": 0.0
|
||||
},
|
||||
"y_axis": {
|
||||
"x": 0.0,
|
||||
"y": 0.0,
|
||||
"z": 1.0
|
||||
},
|
||||
"size": 100.0,
|
||||
"clobber": false,
|
||||
"hide": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"cmdId": "[uuid]",
|
||||
"range": [
|
||||
0,
|
||||
0,
|
||||
0
|
||||
],
|
||||
"command": {
|
||||
"type": "plane_set_color",
|
||||
"plane_id": "[uuid]",
|
||||
"color": {
|
||||
"r": 0.28,
|
||||
"g": 0.28,
|
||||
"b": 0.7,
|
||||
"a": 0.4
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"cmdId": "[uuid]",
|
||||
"range": [
|
||||
0,
|
||||
0,
|
||||
0
|
||||
],
|
||||
"command": {
|
||||
"type": "make_plane",
|
||||
"origin": {
|
||||
"x": 0.0,
|
||||
"y": 0.0,
|
||||
"z": 0.0
|
||||
},
|
||||
"x_axis": {
|
||||
"x": -1.0,
|
||||
"y": 0.0,
|
||||
"z": 0.0
|
||||
},
|
||||
"y_axis": {
|
||||
"x": 0.0,
|
||||
"y": 1.0,
|
||||
"z": 0.0
|
||||
},
|
||||
"size": 100.0,
|
||||
"clobber": false,
|
||||
"hide": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"cmdId": "[uuid]",
|
||||
"range": [
|
||||
0,
|
||||
0,
|
||||
0
|
||||
],
|
||||
"command": {
|
||||
"type": "make_plane",
|
||||
"origin": {
|
||||
"x": 0.0,
|
||||
"y": 0.0,
|
||||
"z": 0.0
|
||||
},
|
||||
"x_axis": {
|
||||
"x": 0.0,
|
||||
"y": -1.0,
|
||||
"z": 0.0
|
||||
},
|
||||
"y_axis": {
|
||||
"x": 0.0,
|
||||
"y": 0.0,
|
||||
"z": 1.0
|
||||
},
|
||||
"size": 100.0,
|
||||
"clobber": false,
|
||||
"hide": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"cmdId": "[uuid]",
|
||||
"range": [
|
||||
0,
|
||||
0,
|
||||
0
|
||||
],
|
||||
"command": {
|
||||
"type": "make_plane",
|
||||
"origin": {
|
||||
"x": 0.0,
|
||||
"y": 0.0,
|
||||
"z": 0.0
|
||||
},
|
||||
"x_axis": {
|
||||
"x": -1.0,
|
||||
"y": 0.0,
|
||||
"z": 0.0
|
||||
},
|
||||
"y_axis": {
|
||||
"x": 0.0,
|
||||
"y": 0.0,
|
||||
"z": 1.0
|
||||
},
|
||||
"size": 100.0,
|
||||
"clobber": false,
|
||||
"hide": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"cmdId": "[uuid]",
|
||||
"range": [
|
||||
0,
|
||||
0,
|
||||
0
|
||||
],
|
||||
"command": {
|
||||
"type": "edge_lines_visible",
|
||||
"hidden": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"cmdId": "[uuid]",
|
||||
"range": [
|
||||
0,
|
||||
0,
|
||||
0
|
||||
],
|
||||
"command": {
|
||||
"type": "set_scene_units",
|
||||
"unit": "mm"
|
||||
}
|
||||
},
|
||||
{
|
||||
"cmdId": "[uuid]",
|
||||
"range": [
|
||||
0,
|
||||
0,
|
||||
0
|
||||
],
|
||||
"command": {
|
||||
"type": "object_visible",
|
||||
"object_id": "[uuid]",
|
||||
"hidden": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"cmdId": "[uuid]",
|
||||
"range": [
|
||||
0,
|
||||
0,
|
||||
0
|
||||
],
|
||||
"command": {
|
||||
"type": "object_visible",
|
||||
"object_id": "[uuid]",
|
||||
"hidden": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"cmdId": "[uuid]",
|
||||
"range": [
|
||||
177,
|
||||
194,
|
||||
0
|
||||
],
|
||||
"command": {
|
||||
"type": "make_plane",
|
||||
"origin": {
|
||||
"x": 0.0,
|
||||
"y": 0.0,
|
||||
"z": 0.0
|
||||
},
|
||||
"x_axis": {
|
||||
"x": 1.0,
|
||||
"y": 0.0,
|
||||
"z": 0.0
|
||||
},
|
||||
"y_axis": {
|
||||
"x": 0.0,
|
||||
"y": 1.0,
|
||||
"z": 0.0
|
||||
},
|
||||
"size": 60.0,
|
||||
"clobber": false,
|
||||
"hide": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"cmdId": "[uuid]",
|
||||
"range": [
|
||||
177,
|
||||
194,
|
||||
0
|
||||
],
|
||||
"command": {
|
||||
"type": "enable_sketch_mode",
|
||||
"entity_id": "[uuid]",
|
||||
"ortho": false,
|
||||
"animated": false,
|
||||
"adjust_camera": false,
|
||||
"planar_normal": {
|
||||
"x": 0.0,
|
||||
"y": 0.0,
|
||||
"z": 1.0
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"cmdId": "[uuid]",
|
||||
"range": [
|
||||
177,
|
||||
194,
|
||||
0
|
||||
],
|
||||
"command": {
|
||||
"type": "start_path"
|
||||
}
|
||||
},
|
||||
{
|
||||
"cmdId": "[uuid]",
|
||||
"range": [
|
||||
177,
|
||||
194,
|
||||
0
|
||||
],
|
||||
"command": {
|
||||
"type": "move_path_pen",
|
||||
"path": "[uuid]",
|
||||
"to": {
|
||||
"x": -20.0,
|
||||
"y": -20.0,
|
||||
"z": 0.0
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"cmdId": "[uuid]",
|
||||
"range": [
|
||||
202,
|
||||
224,
|
||||
0
|
||||
],
|
||||
"command": {
|
||||
"type": "extend_path",
|
||||
"path": "[uuid]",
|
||||
"segment": {
|
||||
"type": "line",
|
||||
"end": {
|
||||
"x": -20.0,
|
||||
"y": 20.0,
|
||||
"z": 0.0
|
||||
},
|
||||
"relative": false
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"cmdId": "[uuid]",
|
||||
"range": [
|
||||
232,
|
||||
254,
|
||||
0
|
||||
],
|
||||
"command": {
|
||||
"type": "extend_path",
|
||||
"path": "[uuid]",
|
||||
"segment": {
|
||||
"type": "line",
|
||||
"end": {
|
||||
"x": 20.0,
|
||||
"y": 20.0,
|
||||
"z": 0.0
|
||||
},
|
||||
"relative": false
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"cmdId": "[uuid]",
|
||||
"range": [
|
||||
262,
|
||||
284,
|
||||
0
|
||||
],
|
||||
"command": {
|
||||
"type": "extend_path",
|
||||
"path": "[uuid]",
|
||||
"segment": {
|
||||
"type": "line",
|
||||
"end": {
|
||||
"x": 20.0,
|
||||
"y": -20.0,
|
||||
"z": 0.0
|
||||
},
|
||||
"relative": false
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"cmdId": "[uuid]",
|
||||
"range": [
|
||||
292,
|
||||
314,
|
||||
0
|
||||
],
|
||||
"command": {
|
||||
"type": "extend_path",
|
||||
"path": "[uuid]",
|
||||
"segment": {
|
||||
"type": "line",
|
||||
"end": {
|
||||
"x": -20.0,
|
||||
"y": -20.0,
|
||||
"z": 0.0
|
||||
},
|
||||
"relative": false
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"cmdId": "[uuid]",
|
||||
"range": [
|
||||
322,
|
||||
329,
|
||||
0
|
||||
],
|
||||
"command": {
|
||||
"type": "close_path",
|
||||
"path_id": "[uuid]"
|
||||
}
|
||||
},
|
||||
{
|
||||
"cmdId": "[uuid]",
|
||||
"range": [
|
||||
322,
|
||||
329,
|
||||
0
|
||||
],
|
||||
"command": {
|
||||
"type": "sketch_mode_disable"
|
||||
}
|
||||
},
|
||||
{
|
||||
"cmdId": "[uuid]",
|
||||
"range": [
|
||||
337,
|
||||
361,
|
||||
0
|
||||
],
|
||||
"command": {
|
||||
"type": "enable_sketch_mode",
|
||||
"entity_id": "[uuid]",
|
||||
"ortho": false,
|
||||
"animated": false,
|
||||
"adjust_camera": false,
|
||||
"planar_normal": {
|
||||
"x": 0.0,
|
||||
"y": 0.0,
|
||||
"z": 1.0
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"cmdId": "[uuid]",
|
||||
"range": [
|
||||
337,
|
||||
361,
|
||||
0
|
||||
],
|
||||
"command": {
|
||||
"type": "extrude",
|
||||
"target": "[uuid]",
|
||||
"distance": 40.0,
|
||||
"faces": null
|
||||
}
|
||||
},
|
||||
{
|
||||
"cmdId": "[uuid]",
|
||||
"range": [
|
||||
337,
|
||||
361,
|
||||
0
|
||||
],
|
||||
"command": {
|
||||
"type": "sketch_mode_disable"
|
||||
}
|
||||
},
|
||||
{
|
||||
"cmdId": "[uuid]",
|
||||
"range": [
|
||||
337,
|
||||
361,
|
||||
0
|
||||
],
|
||||
"command": {
|
||||
"type": "object_bring_to_front",
|
||||
"object_id": "[uuid]"
|
||||
}
|
||||
},
|
||||
{
|
||||
"cmdId": "[uuid]",
|
||||
"range": [
|
||||
337,
|
||||
361,
|
||||
0
|
||||
],
|
||||
"command": {
|
||||
"type": "solid3d_get_extrusion_face_info",
|
||||
"object_id": "[uuid]",
|
||||
"edge_id": "[uuid]"
|
||||
}
|
||||
}
|
||||
]
|
@ -0,0 +1,6 @@
|
||||
---
|
||||
source: kcl/src/simulation_tests.rs
|
||||
description: Artifact graph flowchart cube_with_error.kcl
|
||||
extension: md
|
||||
snapshot_kind: binary
|
||||
---
|
@ -0,0 +1,38 @@
|
||||
```mermaid
|
||||
flowchart LR
|
||||
subgraph path2 [Path]
|
||||
2["Path<br>[177, 194, 0]"]
|
||||
3["Segment<br>[202, 224, 0]"]
|
||||
4["Segment<br>[232, 254, 0]"]
|
||||
5["Segment<br>[262, 284, 0]"]
|
||||
6["Segment<br>[292, 314, 0]"]
|
||||
7["Segment<br>[322, 329, 0]"]
|
||||
8[Solid2d]
|
||||
end
|
||||
1["Plane<br>[177, 194, 0]"]
|
||||
9["Sweep Extrusion<br>[337, 361, 0]"]
|
||||
10[Wall]
|
||||
11[Wall]
|
||||
12[Wall]
|
||||
13[Wall]
|
||||
14["Cap Start"]
|
||||
15["Cap End"]
|
||||
1 --- 2
|
||||
2 --- 3
|
||||
2 --- 4
|
||||
2 --- 5
|
||||
2 --- 6
|
||||
2 --- 7
|
||||
2 ---- 9
|
||||
2 --- 8
|
||||
3 --- 13
|
||||
4 --- 12
|
||||
5 --- 11
|
||||
6 --- 10
|
||||
9 --- 10
|
||||
9 --- 11
|
||||
9 --- 12
|
||||
9 --- 13
|
||||
9 --- 14
|
||||
9 --- 15
|
||||
```
|
812
rust/kcl-lib/tests/cube_with_error/ast.snap
Normal file
812
rust/kcl-lib/tests/cube_with_error/ast.snap
Normal file
@ -0,0 +1,812 @@
|
||||
---
|
||||
source: kcl/src/simulation_tests.rs
|
||||
description: Result of parsing cube_with_error.kcl
|
||||
---
|
||||
{
|
||||
"Ok": {
|
||||
"body": [
|
||||
{
|
||||
"declaration": {
|
||||
"end": 363,
|
||||
"id": {
|
||||
"end": 7,
|
||||
"name": "cube",
|
||||
"start": 3,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"init": {
|
||||
"body": {
|
||||
"body": [
|
||||
{
|
||||
"declaration": {
|
||||
"end": 42,
|
||||
"id": {
|
||||
"end": 29,
|
||||
"name": "l",
|
||||
"start": 28,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"init": {
|
||||
"end": 42,
|
||||
"left": {
|
||||
"end": 38,
|
||||
"name": "length",
|
||||
"start": 32,
|
||||
"type": "Identifier",
|
||||
"type": "Identifier"
|
||||
},
|
||||
"operator": "/",
|
||||
"right": {
|
||||
"end": 42,
|
||||
"raw": "2",
|
||||
"start": 41,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 2.0,
|
||||
"suffix": "None"
|
||||
}
|
||||
},
|
||||
"start": 32,
|
||||
"type": "BinaryExpression",
|
||||
"type": "BinaryExpression"
|
||||
},
|
||||
"start": 28,
|
||||
"type": "VariableDeclarator"
|
||||
},
|
||||
"end": 42,
|
||||
"kind": "const",
|
||||
"start": 28,
|
||||
"type": "VariableDeclaration",
|
||||
"type": "VariableDeclaration"
|
||||
},
|
||||
{
|
||||
"declaration": {
|
||||
"end": 58,
|
||||
"id": {
|
||||
"end": 46,
|
||||
"name": "x",
|
||||
"start": 45,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"init": {
|
||||
"computed": false,
|
||||
"end": 58,
|
||||
"object": {
|
||||
"end": 55,
|
||||
"name": "center",
|
||||
"start": 49,
|
||||
"type": "Identifier",
|
||||
"type": "Identifier"
|
||||
},
|
||||
"property": {
|
||||
"end": 57,
|
||||
"raw": "0",
|
||||
"start": 56,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 0.0,
|
||||
"suffix": "None"
|
||||
}
|
||||
},
|
||||
"start": 49,
|
||||
"type": "MemberExpression",
|
||||
"type": "MemberExpression"
|
||||
},
|
||||
"start": 45,
|
||||
"type": "VariableDeclarator"
|
||||
},
|
||||
"end": 58,
|
||||
"kind": "const",
|
||||
"start": 45,
|
||||
"type": "VariableDeclaration",
|
||||
"type": "VariableDeclaration"
|
||||
},
|
||||
{
|
||||
"declaration": {
|
||||
"end": 74,
|
||||
"id": {
|
||||
"end": 62,
|
||||
"name": "y",
|
||||
"start": 61,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"init": {
|
||||
"computed": false,
|
||||
"end": 74,
|
||||
"object": {
|
||||
"end": 71,
|
||||
"name": "center",
|
||||
"start": 65,
|
||||
"type": "Identifier",
|
||||
"type": "Identifier"
|
||||
},
|
||||
"property": {
|
||||
"end": 73,
|
||||
"raw": "1",
|
||||
"start": 72,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 1.0,
|
||||
"suffix": "None"
|
||||
}
|
||||
},
|
||||
"start": 65,
|
||||
"type": "MemberExpression",
|
||||
"type": "MemberExpression"
|
||||
},
|
||||
"start": 61,
|
||||
"type": "VariableDeclarator"
|
||||
},
|
||||
"end": 74,
|
||||
"kind": "const",
|
||||
"start": 61,
|
||||
"type": "VariableDeclaration",
|
||||
"type": "VariableDeclaration"
|
||||
},
|
||||
{
|
||||
"declaration": {
|
||||
"end": 98,
|
||||
"id": {
|
||||
"end": 79,
|
||||
"name": "p0",
|
||||
"start": 77,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"init": {
|
||||
"elements": [
|
||||
{
|
||||
"end": 89,
|
||||
"left": {
|
||||
"argument": {
|
||||
"end": 85,
|
||||
"name": "l",
|
||||
"start": 84,
|
||||
"type": "Identifier",
|
||||
"type": "Identifier"
|
||||
},
|
||||
"end": 85,
|
||||
"operator": "-",
|
||||
"start": 83,
|
||||
"type": "UnaryExpression",
|
||||
"type": "UnaryExpression"
|
||||
},
|
||||
"operator": "+",
|
||||
"right": {
|
||||
"end": 89,
|
||||
"name": "x",
|
||||
"start": 88,
|
||||
"type": "Identifier",
|
||||
"type": "Identifier"
|
||||
},
|
||||
"start": 83,
|
||||
"type": "BinaryExpression",
|
||||
"type": "BinaryExpression"
|
||||
},
|
||||
{
|
||||
"end": 97,
|
||||
"left": {
|
||||
"argument": {
|
||||
"end": 93,
|
||||
"name": "l",
|
||||
"start": 92,
|
||||
"type": "Identifier",
|
||||
"type": "Identifier"
|
||||
},
|
||||
"end": 93,
|
||||
"operator": "-",
|
||||
"start": 91,
|
||||
"type": "UnaryExpression",
|
||||
"type": "UnaryExpression"
|
||||
},
|
||||
"operator": "+",
|
||||
"right": {
|
||||
"end": 97,
|
||||
"name": "y",
|
||||
"start": 96,
|
||||
"type": "Identifier",
|
||||
"type": "Identifier"
|
||||
},
|
||||
"start": 91,
|
||||
"type": "BinaryExpression",
|
||||
"type": "BinaryExpression"
|
||||
}
|
||||
],
|
||||
"end": 98,
|
||||
"start": 82,
|
||||
"type": "ArrayExpression",
|
||||
"type": "ArrayExpression"
|
||||
},
|
||||
"start": 77,
|
||||
"type": "VariableDeclarator"
|
||||
},
|
||||
"end": 98,
|
||||
"kind": "const",
|
||||
"start": 77,
|
||||
"type": "VariableDeclaration",
|
||||
"type": "VariableDeclaration"
|
||||
},
|
||||
{
|
||||
"declaration": {
|
||||
"end": 121,
|
||||
"id": {
|
||||
"end": 103,
|
||||
"name": "p1",
|
||||
"start": 101,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"init": {
|
||||
"elements": [
|
||||
{
|
||||
"end": 113,
|
||||
"left": {
|
||||
"argument": {
|
||||
"end": 109,
|
||||
"name": "l",
|
||||
"start": 108,
|
||||
"type": "Identifier",
|
||||
"type": "Identifier"
|
||||
},
|
||||
"end": 109,
|
||||
"operator": "-",
|
||||
"start": 107,
|
||||
"type": "UnaryExpression",
|
||||
"type": "UnaryExpression"
|
||||
},
|
||||
"operator": "+",
|
||||
"right": {
|
||||
"end": 113,
|
||||
"name": "x",
|
||||
"start": 112,
|
||||
"type": "Identifier",
|
||||
"type": "Identifier"
|
||||
},
|
||||
"start": 107,
|
||||
"type": "BinaryExpression",
|
||||
"type": "BinaryExpression"
|
||||
},
|
||||
{
|
||||
"end": 120,
|
||||
"left": {
|
||||
"end": 116,
|
||||
"name": "l",
|
||||
"start": 115,
|
||||
"type": "Identifier",
|
||||
"type": "Identifier"
|
||||
},
|
||||
"operator": "+",
|
||||
"right": {
|
||||
"end": 120,
|
||||
"name": "y",
|
||||
"start": 119,
|
||||
"type": "Identifier",
|
||||
"type": "Identifier"
|
||||
},
|
||||
"start": 115,
|
||||
"type": "BinaryExpression",
|
||||
"type": "BinaryExpression"
|
||||
}
|
||||
],
|
||||
"end": 121,
|
||||
"start": 106,
|
||||
"type": "ArrayExpression",
|
||||
"type": "ArrayExpression"
|
||||
},
|
||||
"start": 101,
|
||||
"type": "VariableDeclarator"
|
||||
},
|
||||
"end": 121,
|
||||
"kind": "const",
|
||||
"start": 101,
|
||||
"type": "VariableDeclaration",
|
||||
"type": "VariableDeclaration"
|
||||
},
|
||||
{
|
||||
"declaration": {
|
||||
"end": 143,
|
||||
"id": {
|
||||
"end": 126,
|
||||
"name": "p2",
|
||||
"start": 124,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"init": {
|
||||
"elements": [
|
||||
{
|
||||
"end": 135,
|
||||
"left": {
|
||||
"end": 131,
|
||||
"name": "l",
|
||||
"start": 130,
|
||||
"type": "Identifier",
|
||||
"type": "Identifier"
|
||||
},
|
||||
"operator": "+",
|
||||
"right": {
|
||||
"end": 135,
|
||||
"name": "x",
|
||||
"start": 134,
|
||||
"type": "Identifier",
|
||||
"type": "Identifier"
|
||||
},
|
||||
"start": 130,
|
||||
"type": "BinaryExpression",
|
||||
"type": "BinaryExpression"
|
||||
},
|
||||
{
|
||||
"end": 142,
|
||||
"left": {
|
||||
"end": 138,
|
||||
"name": "l",
|
||||
"start": 137,
|
||||
"type": "Identifier",
|
||||
"type": "Identifier"
|
||||
},
|
||||
"operator": "+",
|
||||
"right": {
|
||||
"end": 142,
|
||||
"name": "y",
|
||||
"start": 141,
|
||||
"type": "Identifier",
|
||||
"type": "Identifier"
|
||||
},
|
||||
"start": 137,
|
||||
"type": "BinaryExpression",
|
||||
"type": "BinaryExpression"
|
||||
}
|
||||
],
|
||||
"end": 143,
|
||||
"start": 129,
|
||||
"type": "ArrayExpression",
|
||||
"type": "ArrayExpression"
|
||||
},
|
||||
"start": 124,
|
||||
"type": "VariableDeclarator"
|
||||
},
|
||||
"end": 143,
|
||||
"kind": "const",
|
||||
"start": 124,
|
||||
"type": "VariableDeclaration",
|
||||
"type": "VariableDeclaration"
|
||||
},
|
||||
{
|
||||
"declaration": {
|
||||
"end": 166,
|
||||
"id": {
|
||||
"end": 148,
|
||||
"name": "p3",
|
||||
"start": 146,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"init": {
|
||||
"elements": [
|
||||
{
|
||||
"end": 157,
|
||||
"left": {
|
||||
"end": 153,
|
||||
"name": "l",
|
||||
"start": 152,
|
||||
"type": "Identifier",
|
||||
"type": "Identifier"
|
||||
},
|
||||
"operator": "+",
|
||||
"right": {
|
||||
"end": 157,
|
||||
"name": "x",
|
||||
"start": 156,
|
||||
"type": "Identifier",
|
||||
"type": "Identifier"
|
||||
},
|
||||
"start": 152,
|
||||
"type": "BinaryExpression",
|
||||
"type": "BinaryExpression"
|
||||
},
|
||||
{
|
||||
"end": 165,
|
||||
"left": {
|
||||
"argument": {
|
||||
"end": 161,
|
||||
"name": "l",
|
||||
"start": 160,
|
||||
"type": "Identifier",
|
||||
"type": "Identifier"
|
||||
},
|
||||
"end": 161,
|
||||
"operator": "-",
|
||||
"start": 159,
|
||||
"type": "UnaryExpression",
|
||||
"type": "UnaryExpression"
|
||||
},
|
||||
"operator": "+",
|
||||
"right": {
|
||||
"end": 165,
|
||||
"name": "y",
|
||||
"start": 164,
|
||||
"type": "Identifier",
|
||||
"type": "Identifier"
|
||||
},
|
||||
"start": 159,
|
||||
"type": "BinaryExpression",
|
||||
"type": "BinaryExpression"
|
||||
}
|
||||
],
|
||||
"end": 166,
|
||||
"start": 151,
|
||||
"type": "ArrayExpression",
|
||||
"type": "ArrayExpression"
|
||||
},
|
||||
"start": 146,
|
||||
"type": "VariableDeclarator"
|
||||
},
|
||||
"end": 166,
|
||||
"kind": "const",
|
||||
"start": 146,
|
||||
"type": "VariableDeclaration",
|
||||
"type": "VariableDeclaration"
|
||||
},
|
||||
{
|
||||
"argument": {
|
||||
"body": [
|
||||
{
|
||||
"arguments": [
|
||||
{
|
||||
"end": 193,
|
||||
"name": "p0",
|
||||
"start": 191,
|
||||
"type": "Identifier",
|
||||
"type": "Identifier"
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"end": 190,
|
||||
"name": "startSketchAt",
|
||||
"start": 177,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"end": 194,
|
||||
"start": 177,
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression"
|
||||
},
|
||||
{
|
||||
"arguments": [
|
||||
{
|
||||
"type": "LabeledArg",
|
||||
"label": {
|
||||
"type": "Identifier",
|
||||
"name": "endAbsolute"
|
||||
},
|
||||
"arg": {
|
||||
"end": 223,
|
||||
"name": "p1",
|
||||
"start": 221,
|
||||
"type": "Identifier",
|
||||
"type": "Identifier"
|
||||
}
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"end": 206,
|
||||
"name": "line",
|
||||
"start": 202,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"end": 224,
|
||||
"start": 202,
|
||||
"type": "CallExpressionKw",
|
||||
"type": "CallExpressionKw",
|
||||
"unlabeled": null
|
||||
},
|
||||
{
|
||||
"arguments": [
|
||||
{
|
||||
"type": "LabeledArg",
|
||||
"label": {
|
||||
"type": "Identifier",
|
||||
"name": "endAbsolute"
|
||||
},
|
||||
"arg": {
|
||||
"end": 253,
|
||||
"name": "p2",
|
||||
"start": 251,
|
||||
"type": "Identifier",
|
||||
"type": "Identifier"
|
||||
}
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"end": 236,
|
||||
"name": "line",
|
||||
"start": 232,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"end": 254,
|
||||
"start": 232,
|
||||
"type": "CallExpressionKw",
|
||||
"type": "CallExpressionKw",
|
||||
"unlabeled": null
|
||||
},
|
||||
{
|
||||
"arguments": [
|
||||
{
|
||||
"type": "LabeledArg",
|
||||
"label": {
|
||||
"type": "Identifier",
|
||||
"name": "endAbsolute"
|
||||
},
|
||||
"arg": {
|
||||
"end": 283,
|
||||
"name": "p3",
|
||||
"start": 281,
|
||||
"type": "Identifier",
|
||||
"type": "Identifier"
|
||||
}
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"end": 266,
|
||||
"name": "line",
|
||||
"start": 262,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"end": 284,
|
||||
"start": 262,
|
||||
"type": "CallExpressionKw",
|
||||
"type": "CallExpressionKw",
|
||||
"unlabeled": null
|
||||
},
|
||||
{
|
||||
"arguments": [
|
||||
{
|
||||
"type": "LabeledArg",
|
||||
"label": {
|
||||
"type": "Identifier",
|
||||
"name": "endAbsolute"
|
||||
},
|
||||
"arg": {
|
||||
"end": 313,
|
||||
"name": "p0",
|
||||
"start": 311,
|
||||
"type": "Identifier",
|
||||
"type": "Identifier"
|
||||
}
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"end": 296,
|
||||
"name": "line",
|
||||
"start": 292,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"end": 314,
|
||||
"start": 292,
|
||||
"type": "CallExpressionKw",
|
||||
"type": "CallExpressionKw",
|
||||
"unlabeled": null
|
||||
},
|
||||
{
|
||||
"arguments": [],
|
||||
"callee": {
|
||||
"end": 327,
|
||||
"name": "close",
|
||||
"start": 322,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"end": 329,
|
||||
"start": 322,
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression"
|
||||
},
|
||||
{
|
||||
"arguments": [
|
||||
{
|
||||
"type": "LabeledArg",
|
||||
"label": {
|
||||
"type": "Identifier",
|
||||
"name": "length"
|
||||
},
|
||||
"arg": {
|
||||
"end": 360,
|
||||
"name": "length",
|
||||
"start": 354,
|
||||
"type": "Identifier",
|
||||
"type": "Identifier"
|
||||
}
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"end": 344,
|
||||
"name": "extrude",
|
||||
"start": 337,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"end": 361,
|
||||
"start": 337,
|
||||
"type": "CallExpressionKw",
|
||||
"type": "CallExpressionKw",
|
||||
"unlabeled": null
|
||||
}
|
||||
],
|
||||
"end": 361,
|
||||
"start": 177,
|
||||
"type": "PipeExpression",
|
||||
"type": "PipeExpression"
|
||||
},
|
||||
"end": 361,
|
||||
"start": 170,
|
||||
"type": "ReturnStatement",
|
||||
"type": "ReturnStatement"
|
||||
}
|
||||
],
|
||||
"end": 363,
|
||||
"nonCodeMeta": {
|
||||
"nonCodeNodes": {
|
||||
"6": [
|
||||
{
|
||||
"end": 170,
|
||||
"start": 166,
|
||||
"type": "NonCodeNode",
|
||||
"value": {
|
||||
"type": "newLine"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"startNodes": []
|
||||
},
|
||||
"start": 24
|
||||
},
|
||||
"end": 363,
|
||||
"params": [
|
||||
{
|
||||
"type": "Parameter",
|
||||
"identifier": {
|
||||
"end": 14,
|
||||
"name": "length",
|
||||
"start": 8,
|
||||
"type": "Identifier"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "Parameter",
|
||||
"identifier": {
|
||||
"end": 22,
|
||||
"name": "center",
|
||||
"start": 16,
|
||||
"type": "Identifier"
|
||||
}
|
||||
}
|
||||
],
|
||||
"start": 7,
|
||||
"type": "FunctionExpression",
|
||||
"type": "FunctionExpression"
|
||||
},
|
||||
"start": 3,
|
||||
"type": "VariableDeclarator"
|
||||
},
|
||||
"end": 363,
|
||||
"kind": "fn",
|
||||
"start": 0,
|
||||
"type": "VariableDeclaration",
|
||||
"type": "VariableDeclaration"
|
||||
},
|
||||
{
|
||||
"declaration": {
|
||||
"end": 390,
|
||||
"id": {
|
||||
"end": 371,
|
||||
"name": "myCube",
|
||||
"start": 365,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"init": {
|
||||
"arguments": [
|
||||
{
|
||||
"end": 381,
|
||||
"raw": "40",
|
||||
"start": 379,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 40.0,
|
||||
"suffix": "None"
|
||||
}
|
||||
},
|
||||
{
|
||||
"elements": [
|
||||
{
|
||||
"end": 385,
|
||||
"raw": "0",
|
||||
"start": 384,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 0.0,
|
||||
"suffix": "None"
|
||||
}
|
||||
},
|
||||
{
|
||||
"end": 388,
|
||||
"raw": "0",
|
||||
"start": 387,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": {
|
||||
"value": 0.0,
|
||||
"suffix": "None"
|
||||
}
|
||||
}
|
||||
],
|
||||
"end": 389,
|
||||
"start": 383,
|
||||
"type": "ArrayExpression",
|
||||
"type": "ArrayExpression"
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"end": 378,
|
||||
"name": "cube",
|
||||
"start": 374,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"end": 390,
|
||||
"start": 374,
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression"
|
||||
},
|
||||
"start": 365,
|
||||
"type": "VariableDeclarator"
|
||||
},
|
||||
"end": 390,
|
||||
"kind": "const",
|
||||
"start": 365,
|
||||
"type": "VariableDeclaration",
|
||||
"type": "VariableDeclaration"
|
||||
},
|
||||
{
|
||||
"end": 439,
|
||||
"expression": {
|
||||
"end": 439,
|
||||
"name": "foo",
|
||||
"start": 436,
|
||||
"type": "Identifier",
|
||||
"type": "Identifier"
|
||||
},
|
||||
"start": 436,
|
||||
"type": "ExpressionStatement",
|
||||
"type": "ExpressionStatement"
|
||||
}
|
||||
],
|
||||
"end": 440,
|
||||
"nonCodeMeta": {
|
||||
"nonCodeNodes": {
|
||||
"0": [
|
||||
{
|
||||
"end": 365,
|
||||
"start": 363,
|
||||
"type": "NonCodeNode",
|
||||
"value": {
|
||||
"type": "newLine"
|
||||
}
|
||||
}
|
||||
],
|
||||
"1": [
|
||||
{
|
||||
"end": 435,
|
||||
"start": 390,
|
||||
"type": "NonCodeNode",
|
||||
"value": {
|
||||
"type": "newLineBlockComment",
|
||||
"value": "Error, after creating meaningful output.",
|
||||
"style": "line"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"startNodes": []
|
||||
},
|
||||
"start": 0
|
||||
}
|
||||
}
|
13
rust/kcl-lib/tests/cube_with_error/execution_error.snap
Normal file
13
rust/kcl-lib/tests/cube_with_error/execution_error.snap
Normal file
@ -0,0 +1,13 @@
|
||||
---
|
||||
source: kcl/src/simulation_tests.rs
|
||||
description: Error from executing cube_with_error.kcl
|
||||
---
|
||||
KCL UndefinedValue error
|
||||
|
||||
× undefined value: memory item key `foo` is not defined
|
||||
╭─[22:1]
|
||||
21 │ // Error, after creating meaningful output.
|
||||
22 │ foo
|
||||
· ─┬─
|
||||
· ╰── tests/cube_with_error/input.kcl
|
||||
╰────
|
22
rust/kcl-lib/tests/cube_with_error/input.kcl
Normal file
22
rust/kcl-lib/tests/cube_with_error/input.kcl
Normal file
@ -0,0 +1,22 @@
|
||||
fn cube(length, center) {
|
||||
l = length / 2
|
||||
x = center[0]
|
||||
y = center[1]
|
||||
p0 = [-l + x, -l + y]
|
||||
p1 = [-l + x, l + y]
|
||||
p2 = [l + x, l + y]
|
||||
p3 = [l + x, -l + y]
|
||||
|
||||
return startSketchAt(p0)
|
||||
|> line(endAbsolute = p1)
|
||||
|> line(endAbsolute = p2)
|
||||
|> line(endAbsolute = p3)
|
||||
|> line(endAbsolute = p0)
|
||||
|> close()
|
||||
|> extrude(length = length)
|
||||
}
|
||||
|
||||
myCube = cube(40, [0, 0])
|
||||
|
||||
// Error, after creating meaningful output.
|
||||
foo
|
69
rust/kcl-lib/tests/cube_with_error/ops.snap
Normal file
69
rust/kcl-lib/tests/cube_with_error/ops.snap
Normal file
@ -0,0 +1,69 @@
|
||||
---
|
||||
source: kcl/src/simulation_tests.rs
|
||||
description: Operations executed cube_with_error.kcl
|
||||
---
|
||||
[
|
||||
{
|
||||
"type": "UserDefinedFunctionCall",
|
||||
"name": "cube",
|
||||
"functionSourceRange": [
|
||||
7,
|
||||
363,
|
||||
0
|
||||
],
|
||||
"unlabeledArg": null,
|
||||
"labeledArgs": {},
|
||||
"sourceRange": [
|
||||
374,
|
||||
390,
|
||||
0
|
||||
]
|
||||
},
|
||||
{
|
||||
"labeledArgs": {
|
||||
"length": {
|
||||
"value": {
|
||||
"type": "Number",
|
||||
"value": 40.0,
|
||||
"ty": {
|
||||
"type": "Default",
|
||||
"len": {
|
||||
"type": "Mm"
|
||||
},
|
||||
"angle": {
|
||||
"type": "Degrees"
|
||||
}
|
||||
}
|
||||
},
|
||||
"sourceRange": [
|
||||
354,
|
||||
360,
|
||||
0
|
||||
]
|
||||
}
|
||||
},
|
||||
"name": "extrude",
|
||||
"sourceRange": [
|
||||
337,
|
||||
361,
|
||||
0
|
||||
],
|
||||
"type": "StdLibCall",
|
||||
"unlabeledArg": {
|
||||
"value": {
|
||||
"type": "Sketch",
|
||||
"value": {
|
||||
"artifactId": "[uuid]"
|
||||
}
|
||||
},
|
||||
"sourceRange": [
|
||||
0,
|
||||
0,
|
||||
0
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "UserDefinedFunctionReturn"
|
||||
}
|
||||
]
|
Reference in New Issue
Block a user