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:
		
							
								
								
									
										651
									
								
								rust/kcl-lib/tests/cube/artifact_commands.snap
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										651
									
								
								rust/kcl-lib/tests/cube/artifact_commands.snap
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,651 @@ | ||||
| --- | ||||
| source: kcl/src/simulation_tests.rs | ||||
| description: Artifact commands cube.kcl | ||||
| snapshot_kind: text | ||||
| --- | ||||
| [ | ||||
|   { | ||||
|     "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": [ | ||||
|       185, | ||||
|       202, | ||||
|       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": [ | ||||
|       185, | ||||
|       202, | ||||
|       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": [ | ||||
|       185, | ||||
|       202, | ||||
|       0 | ||||
|     ], | ||||
|     "command": { | ||||
|       "type": "start_path" | ||||
|     } | ||||
|   }, | ||||
|   { | ||||
|     "cmdId": "[uuid]", | ||||
|     "range": [ | ||||
|       185, | ||||
|       202, | ||||
|       0 | ||||
|     ], | ||||
|     "command": { | ||||
|       "type": "move_path_pen", | ||||
|       "path": "[uuid]", | ||||
|       "to": { | ||||
|         "x": -20.0, | ||||
|         "y": -20.0, | ||||
|         "z": 0.0 | ||||
|       } | ||||
|     } | ||||
|   }, | ||||
|   { | ||||
|     "cmdId": "[uuid]", | ||||
|     "range": [ | ||||
|       210, | ||||
|       232, | ||||
|       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": [ | ||||
|       240, | ||||
|       262, | ||||
|       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": [ | ||||
|       270, | ||||
|       292, | ||||
|       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": [ | ||||
|       300, | ||||
|       322, | ||||
|       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": [ | ||||
|       330, | ||||
|       337, | ||||
|       0 | ||||
|     ], | ||||
|     "command": { | ||||
|       "type": "close_path", | ||||
|       "path_id": "[uuid]" | ||||
|     } | ||||
|   }, | ||||
|   { | ||||
|     "cmdId": "[uuid]", | ||||
|     "range": [ | ||||
|       330, | ||||
|       337, | ||||
|       0 | ||||
|     ], | ||||
|     "command": { | ||||
|       "type": "sketch_mode_disable" | ||||
|     } | ||||
|   }, | ||||
|   { | ||||
|     "cmdId": "[uuid]", | ||||
|     "range": [ | ||||
|       345, | ||||
|       373, | ||||
|       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": [ | ||||
|       345, | ||||
|       373, | ||||
|       0 | ||||
|     ], | ||||
|     "command": { | ||||
|       "type": "extrude", | ||||
|       "target": "[uuid]", | ||||
|       "distance": 40.0, | ||||
|       "faces": null | ||||
|     } | ||||
|   }, | ||||
|   { | ||||
|     "cmdId": "[uuid]", | ||||
|     "range": [ | ||||
|       345, | ||||
|       373, | ||||
|       0 | ||||
|     ], | ||||
|     "command": { | ||||
|       "type": "sketch_mode_disable" | ||||
|     } | ||||
|   }, | ||||
|   { | ||||
|     "cmdId": "[uuid]", | ||||
|     "range": [ | ||||
|       345, | ||||
|       373, | ||||
|       0 | ||||
|     ], | ||||
|     "command": { | ||||
|       "type": "object_bring_to_front", | ||||
|       "object_id": "[uuid]" | ||||
|     } | ||||
|   }, | ||||
|   { | ||||
|     "cmdId": "[uuid]", | ||||
|     "range": [ | ||||
|       345, | ||||
|       373, | ||||
|       0 | ||||
|     ], | ||||
|     "command": { | ||||
|       "type": "solid3d_get_extrusion_face_info", | ||||
|       "object_id": "[uuid]", | ||||
|       "edge_id": "[uuid]" | ||||
|     } | ||||
|   }, | ||||
|   { | ||||
|     "cmdId": "[uuid]", | ||||
|     "range": [ | ||||
|       345, | ||||
|       373, | ||||
|       0 | ||||
|     ], | ||||
|     "command": { | ||||
|       "type": "solid3d_get_opposite_edge", | ||||
|       "object_id": "[uuid]", | ||||
|       "edge_id": "[uuid]", | ||||
|       "face_id": "[uuid]" | ||||
|     } | ||||
|   }, | ||||
|   { | ||||
|     "cmdId": "[uuid]", | ||||
|     "range": [ | ||||
|       345, | ||||
|       373, | ||||
|       0 | ||||
|     ], | ||||
|     "command": { | ||||
|       "type": "solid3d_get_next_adjacent_edge", | ||||
|       "object_id": "[uuid]", | ||||
|       "edge_id": "[uuid]", | ||||
|       "face_id": "[uuid]" | ||||
|     } | ||||
|   }, | ||||
|   { | ||||
|     "cmdId": "[uuid]", | ||||
|     "range": [ | ||||
|       345, | ||||
|       373, | ||||
|       0 | ||||
|     ], | ||||
|     "command": { | ||||
|       "type": "solid3d_get_opposite_edge", | ||||
|       "object_id": "[uuid]", | ||||
|       "edge_id": "[uuid]", | ||||
|       "face_id": "[uuid]" | ||||
|     } | ||||
|   }, | ||||
|   { | ||||
|     "cmdId": "[uuid]", | ||||
|     "range": [ | ||||
|       345, | ||||
|       373, | ||||
|       0 | ||||
|     ], | ||||
|     "command": { | ||||
|       "type": "solid3d_get_next_adjacent_edge", | ||||
|       "object_id": "[uuid]", | ||||
|       "edge_id": "[uuid]", | ||||
|       "face_id": "[uuid]" | ||||
|     } | ||||
|   }, | ||||
|   { | ||||
|     "cmdId": "[uuid]", | ||||
|     "range": [ | ||||
|       345, | ||||
|       373, | ||||
|       0 | ||||
|     ], | ||||
|     "command": { | ||||
|       "type": "solid3d_get_opposite_edge", | ||||
|       "object_id": "[uuid]", | ||||
|       "edge_id": "[uuid]", | ||||
|       "face_id": "[uuid]" | ||||
|     } | ||||
|   }, | ||||
|   { | ||||
|     "cmdId": "[uuid]", | ||||
|     "range": [ | ||||
|       345, | ||||
|       373, | ||||
|       0 | ||||
|     ], | ||||
|     "command": { | ||||
|       "type": "solid3d_get_next_adjacent_edge", | ||||
|       "object_id": "[uuid]", | ||||
|       "edge_id": "[uuid]", | ||||
|       "face_id": "[uuid]" | ||||
|     } | ||||
|   }, | ||||
|   { | ||||
|     "cmdId": "[uuid]", | ||||
|     "range": [ | ||||
|       345, | ||||
|       373, | ||||
|       0 | ||||
|     ], | ||||
|     "command": { | ||||
|       "type": "solid3d_get_opposite_edge", | ||||
|       "object_id": "[uuid]", | ||||
|       "edge_id": "[uuid]", | ||||
|       "face_id": "[uuid]" | ||||
|     } | ||||
|   }, | ||||
|   { | ||||
|     "cmdId": "[uuid]", | ||||
|     "range": [ | ||||
|       345, | ||||
|       373, | ||||
|       0 | ||||
|     ], | ||||
|     "command": { | ||||
|       "type": "solid3d_get_next_adjacent_edge", | ||||
|       "object_id": "[uuid]", | ||||
|       "edge_id": "[uuid]", | ||||
|       "face_id": "[uuid]" | ||||
|     } | ||||
|   } | ||||
| ] | ||||
							
								
								
									
										6
									
								
								rust/kcl-lib/tests/cube/artifact_graph_flowchart.snap
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								rust/kcl-lib/tests/cube/artifact_graph_flowchart.snap
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,6 @@ | ||||
| --- | ||||
| source: kcl/src/simulation_tests.rs | ||||
| description: Artifact graph flowchart cube.kcl | ||||
| extension: md | ||||
| snapshot_kind: binary | ||||
| --- | ||||
							
								
								
									
										62
									
								
								rust/kcl-lib/tests/cube/artifact_graph_flowchart.snap.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										62
									
								
								rust/kcl-lib/tests/cube/artifact_graph_flowchart.snap.md
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,62 @@ | ||||
| ```mermaid | ||||
| flowchart LR | ||||
|   subgraph path2 [Path] | ||||
|     2["Path<br>[185, 202, 0]"] | ||||
|     3["Segment<br>[210, 232, 0]"] | ||||
|     4["Segment<br>[240, 262, 0]"] | ||||
|     5["Segment<br>[270, 292, 0]"] | ||||
|     6["Segment<br>[300, 322, 0]"] | ||||
|     7["Segment<br>[330, 337, 0]"] | ||||
|     8[Solid2d] | ||||
|   end | ||||
|   1["Plane<br>[185, 202, 0]"] | ||||
|   9["Sweep Extrusion<br>[345, 373, 0]"] | ||||
|   10[Wall] | ||||
|   11[Wall] | ||||
|   12[Wall] | ||||
|   13[Wall] | ||||
|   14["Cap Start"] | ||||
|   15["Cap End"] | ||||
|   16["SweepEdge Opposite"] | ||||
|   17["SweepEdge Adjacent"] | ||||
|   18["SweepEdge Opposite"] | ||||
|   19["SweepEdge Adjacent"] | ||||
|   20["SweepEdge Opposite"] | ||||
|   21["SweepEdge Adjacent"] | ||||
|   22["SweepEdge Opposite"] | ||||
|   23["SweepEdge Adjacent"] | ||||
|   1 --- 2 | ||||
|   2 --- 3 | ||||
|   2 --- 4 | ||||
|   2 --- 5 | ||||
|   2 --- 6 | ||||
|   2 --- 7 | ||||
|   2 ---- 9 | ||||
|   2 --- 8 | ||||
|   3 --- 13 | ||||
|   3 --- 22 | ||||
|   3 --- 23 | ||||
|   4 --- 12 | ||||
|   4 --- 20 | ||||
|   4 --- 21 | ||||
|   5 --- 11 | ||||
|   5 --- 18 | ||||
|   5 --- 19 | ||||
|   6 --- 10 | ||||
|   6 --- 16 | ||||
|   6 --- 17 | ||||
|   9 --- 10 | ||||
|   9 --- 11 | ||||
|   9 --- 12 | ||||
|   9 --- 13 | ||||
|   9 --- 14 | ||||
|   9 --- 15 | ||||
|   9 --- 16 | ||||
|   9 --- 17 | ||||
|   9 --- 18 | ||||
|   9 --- 19 | ||||
|   9 --- 20 | ||||
|   9 --- 21 | ||||
|   9 --- 22 | ||||
|   9 --- 23 | ||||
| ``` | ||||
							
								
								
									
										802
									
								
								rust/kcl-lib/tests/cube/ast.snap
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										802
									
								
								rust/kcl-lib/tests/cube/ast.snap
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,802 @@ | ||||
| --- | ||||
| source: kcl/src/simulation_tests.rs | ||||
| description: Result of parsing cube.kcl | ||||
| --- | ||||
| { | ||||
|   "Ok": { | ||||
|     "body": [ | ||||
|       { | ||||
|         "declaration": { | ||||
|           "end": 375, | ||||
|           "id": { | ||||
|             "end": 7, | ||||
|             "name": "cube", | ||||
|             "start": 3, | ||||
|             "type": "Identifier" | ||||
|           }, | ||||
|           "init": { | ||||
|             "body": { | ||||
|               "body": [ | ||||
|                 { | ||||
|                   "declaration": { | ||||
|                     "end": 50, | ||||
|                     "id": { | ||||
|                       "end": 33, | ||||
|                       "name": "l", | ||||
|                       "start": 32, | ||||
|                       "type": "Identifier" | ||||
|                     }, | ||||
|                     "init": { | ||||
|                       "end": 50, | ||||
|                       "left": { | ||||
|                         "end": 46, | ||||
|                         "name": "sideLength", | ||||
|                         "start": 36, | ||||
|                         "type": "Identifier", | ||||
|                         "type": "Identifier" | ||||
|                       }, | ||||
|                       "operator": "/", | ||||
|                       "right": { | ||||
|                         "end": 50, | ||||
|                         "raw": "2", | ||||
|                         "start": 49, | ||||
|                         "type": "Literal", | ||||
|                         "type": "Literal", | ||||
|                         "value": { | ||||
|                           "value": 2.0, | ||||
|                           "suffix": "None" | ||||
|                         } | ||||
|                       }, | ||||
|                       "start": 36, | ||||
|                       "type": "BinaryExpression", | ||||
|                       "type": "BinaryExpression" | ||||
|                     }, | ||||
|                     "start": 32, | ||||
|                     "type": "VariableDeclarator" | ||||
|                   }, | ||||
|                   "end": 50, | ||||
|                   "kind": "const", | ||||
|                   "start": 32, | ||||
|                   "type": "VariableDeclaration", | ||||
|                   "type": "VariableDeclaration" | ||||
|                 }, | ||||
|                 { | ||||
|                   "declaration": { | ||||
|                     "end": 66, | ||||
|                     "id": { | ||||
|                       "end": 54, | ||||
|                       "name": "x", | ||||
|                       "start": 53, | ||||
|                       "type": "Identifier" | ||||
|                     }, | ||||
|                     "init": { | ||||
|                       "computed": false, | ||||
|                       "end": 66, | ||||
|                       "object": { | ||||
|                         "end": 63, | ||||
|                         "name": "center", | ||||
|                         "start": 57, | ||||
|                         "type": "Identifier", | ||||
|                         "type": "Identifier" | ||||
|                       }, | ||||
|                       "property": { | ||||
|                         "end": 65, | ||||
|                         "raw": "0", | ||||
|                         "start": 64, | ||||
|                         "type": "Literal", | ||||
|                         "type": "Literal", | ||||
|                         "value": { | ||||
|                           "value": 0.0, | ||||
|                           "suffix": "None" | ||||
|                         } | ||||
|                       }, | ||||
|                       "start": 57, | ||||
|                       "type": "MemberExpression", | ||||
|                       "type": "MemberExpression" | ||||
|                     }, | ||||
|                     "start": 53, | ||||
|                     "type": "VariableDeclarator" | ||||
|                   }, | ||||
|                   "end": 66, | ||||
|                   "kind": "const", | ||||
|                   "start": 53, | ||||
|                   "type": "VariableDeclaration", | ||||
|                   "type": "VariableDeclaration" | ||||
|                 }, | ||||
|                 { | ||||
|                   "declaration": { | ||||
|                     "end": 82, | ||||
|                     "id": { | ||||
|                       "end": 70, | ||||
|                       "name": "y", | ||||
|                       "start": 69, | ||||
|                       "type": "Identifier" | ||||
|                     }, | ||||
|                     "init": { | ||||
|                       "computed": false, | ||||
|                       "end": 82, | ||||
|                       "object": { | ||||
|                         "end": 79, | ||||
|                         "name": "center", | ||||
|                         "start": 73, | ||||
|                         "type": "Identifier", | ||||
|                         "type": "Identifier" | ||||
|                       }, | ||||
|                       "property": { | ||||
|                         "end": 81, | ||||
|                         "raw": "1", | ||||
|                         "start": 80, | ||||
|                         "type": "Literal", | ||||
|                         "type": "Literal", | ||||
|                         "value": { | ||||
|                           "value": 1.0, | ||||
|                           "suffix": "None" | ||||
|                         } | ||||
|                       }, | ||||
|                       "start": 73, | ||||
|                       "type": "MemberExpression", | ||||
|                       "type": "MemberExpression" | ||||
|                     }, | ||||
|                     "start": 69, | ||||
|                     "type": "VariableDeclarator" | ||||
|                   }, | ||||
|                   "end": 82, | ||||
|                   "kind": "const", | ||||
|                   "start": 69, | ||||
|                   "type": "VariableDeclaration", | ||||
|                   "type": "VariableDeclaration" | ||||
|                 }, | ||||
|                 { | ||||
|                   "declaration": { | ||||
|                     "end": 106, | ||||
|                     "id": { | ||||
|                       "end": 87, | ||||
|                       "name": "p0", | ||||
|                       "start": 85, | ||||
|                       "type": "Identifier" | ||||
|                     }, | ||||
|                     "init": { | ||||
|                       "elements": [ | ||||
|                         { | ||||
|                           "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": "x", | ||||
|                             "start": 96, | ||||
|                             "type": "Identifier", | ||||
|                             "type": "Identifier" | ||||
|                           }, | ||||
|                           "start": 91, | ||||
|                           "type": "BinaryExpression", | ||||
|                           "type": "BinaryExpression" | ||||
|                         }, | ||||
|                         { | ||||
|                           "end": 105, | ||||
|                           "left": { | ||||
|                             "argument": { | ||||
|                               "end": 101, | ||||
|                               "name": "l", | ||||
|                               "start": 100, | ||||
|                               "type": "Identifier", | ||||
|                               "type": "Identifier" | ||||
|                             }, | ||||
|                             "end": 101, | ||||
|                             "operator": "-", | ||||
|                             "start": 99, | ||||
|                             "type": "UnaryExpression", | ||||
|                             "type": "UnaryExpression" | ||||
|                           }, | ||||
|                           "operator": "+", | ||||
|                           "right": { | ||||
|                             "end": 105, | ||||
|                             "name": "y", | ||||
|                             "start": 104, | ||||
|                             "type": "Identifier", | ||||
|                             "type": "Identifier" | ||||
|                           }, | ||||
|                           "start": 99, | ||||
|                           "type": "BinaryExpression", | ||||
|                           "type": "BinaryExpression" | ||||
|                         } | ||||
|                       ], | ||||
|                       "end": 106, | ||||
|                       "start": 90, | ||||
|                       "type": "ArrayExpression", | ||||
|                       "type": "ArrayExpression" | ||||
|                     }, | ||||
|                     "start": 85, | ||||
|                     "type": "VariableDeclarator" | ||||
|                   }, | ||||
|                   "end": 106, | ||||
|                   "kind": "const", | ||||
|                   "start": 85, | ||||
|                   "type": "VariableDeclaration", | ||||
|                   "type": "VariableDeclaration" | ||||
|                 }, | ||||
|                 { | ||||
|                   "declaration": { | ||||
|                     "end": 129, | ||||
|                     "id": { | ||||
|                       "end": 111, | ||||
|                       "name": "p1", | ||||
|                       "start": 109, | ||||
|                       "type": "Identifier" | ||||
|                     }, | ||||
|                     "init": { | ||||
|                       "elements": [ | ||||
|                         { | ||||
|                           "end": 121, | ||||
|                           "left": { | ||||
|                             "argument": { | ||||
|                               "end": 117, | ||||
|                               "name": "l", | ||||
|                               "start": 116, | ||||
|                               "type": "Identifier", | ||||
|                               "type": "Identifier" | ||||
|                             }, | ||||
|                             "end": 117, | ||||
|                             "operator": "-", | ||||
|                             "start": 115, | ||||
|                             "type": "UnaryExpression", | ||||
|                             "type": "UnaryExpression" | ||||
|                           }, | ||||
|                           "operator": "+", | ||||
|                           "right": { | ||||
|                             "end": 121, | ||||
|                             "name": "x", | ||||
|                             "start": 120, | ||||
|                             "type": "Identifier", | ||||
|                             "type": "Identifier" | ||||
|                           }, | ||||
|                           "start": 115, | ||||
|                           "type": "BinaryExpression", | ||||
|                           "type": "BinaryExpression" | ||||
|                         }, | ||||
|                         { | ||||
|                           "end": 128, | ||||
|                           "left": { | ||||
|                             "end": 124, | ||||
|                             "name": "l", | ||||
|                             "start": 123, | ||||
|                             "type": "Identifier", | ||||
|                             "type": "Identifier" | ||||
|                           }, | ||||
|                           "operator": "+", | ||||
|                           "right": { | ||||
|                             "end": 128, | ||||
|                             "name": "y", | ||||
|                             "start": 127, | ||||
|                             "type": "Identifier", | ||||
|                             "type": "Identifier" | ||||
|                           }, | ||||
|                           "start": 123, | ||||
|                           "type": "BinaryExpression", | ||||
|                           "type": "BinaryExpression" | ||||
|                         } | ||||
|                       ], | ||||
|                       "end": 129, | ||||
|                       "start": 114, | ||||
|                       "type": "ArrayExpression", | ||||
|                       "type": "ArrayExpression" | ||||
|                     }, | ||||
|                     "start": 109, | ||||
|                     "type": "VariableDeclarator" | ||||
|                   }, | ||||
|                   "end": 129, | ||||
|                   "kind": "const", | ||||
|                   "start": 109, | ||||
|                   "type": "VariableDeclaration", | ||||
|                   "type": "VariableDeclaration" | ||||
|                 }, | ||||
|                 { | ||||
|                   "declaration": { | ||||
|                     "end": 151, | ||||
|                     "id": { | ||||
|                       "end": 134, | ||||
|                       "name": "p2", | ||||
|                       "start": 132, | ||||
|                       "type": "Identifier" | ||||
|                     }, | ||||
|                     "init": { | ||||
|                       "elements": [ | ||||
|                         { | ||||
|                           "end": 143, | ||||
|                           "left": { | ||||
|                             "end": 139, | ||||
|                             "name": "l", | ||||
|                             "start": 138, | ||||
|                             "type": "Identifier", | ||||
|                             "type": "Identifier" | ||||
|                           }, | ||||
|                           "operator": "+", | ||||
|                           "right": { | ||||
|                             "end": 143, | ||||
|                             "name": "x", | ||||
|                             "start": 142, | ||||
|                             "type": "Identifier", | ||||
|                             "type": "Identifier" | ||||
|                           }, | ||||
|                           "start": 138, | ||||
|                           "type": "BinaryExpression", | ||||
|                           "type": "BinaryExpression" | ||||
|                         }, | ||||
|                         { | ||||
|                           "end": 150, | ||||
|                           "left": { | ||||
|                             "end": 146, | ||||
|                             "name": "l", | ||||
|                             "start": 145, | ||||
|                             "type": "Identifier", | ||||
|                             "type": "Identifier" | ||||
|                           }, | ||||
|                           "operator": "+", | ||||
|                           "right": { | ||||
|                             "end": 150, | ||||
|                             "name": "y", | ||||
|                             "start": 149, | ||||
|                             "type": "Identifier", | ||||
|                             "type": "Identifier" | ||||
|                           }, | ||||
|                           "start": 145, | ||||
|                           "type": "BinaryExpression", | ||||
|                           "type": "BinaryExpression" | ||||
|                         } | ||||
|                       ], | ||||
|                       "end": 151, | ||||
|                       "start": 137, | ||||
|                       "type": "ArrayExpression", | ||||
|                       "type": "ArrayExpression" | ||||
|                     }, | ||||
|                     "start": 132, | ||||
|                     "type": "VariableDeclarator" | ||||
|                   }, | ||||
|                   "end": 151, | ||||
|                   "kind": "const", | ||||
|                   "start": 132, | ||||
|                   "type": "VariableDeclaration", | ||||
|                   "type": "VariableDeclaration" | ||||
|                 }, | ||||
|                 { | ||||
|                   "declaration": { | ||||
|                     "end": 174, | ||||
|                     "id": { | ||||
|                       "end": 156, | ||||
|                       "name": "p3", | ||||
|                       "start": 154, | ||||
|                       "type": "Identifier" | ||||
|                     }, | ||||
|                     "init": { | ||||
|                       "elements": [ | ||||
|                         { | ||||
|                           "end": 165, | ||||
|                           "left": { | ||||
|                             "end": 161, | ||||
|                             "name": "l", | ||||
|                             "start": 160, | ||||
|                             "type": "Identifier", | ||||
|                             "type": "Identifier" | ||||
|                           }, | ||||
|                           "operator": "+", | ||||
|                           "right": { | ||||
|                             "end": 165, | ||||
|                             "name": "x", | ||||
|                             "start": 164, | ||||
|                             "type": "Identifier", | ||||
|                             "type": "Identifier" | ||||
|                           }, | ||||
|                           "start": 160, | ||||
|                           "type": "BinaryExpression", | ||||
|                           "type": "BinaryExpression" | ||||
|                         }, | ||||
|                         { | ||||
|                           "end": 173, | ||||
|                           "left": { | ||||
|                             "argument": { | ||||
|                               "end": 169, | ||||
|                               "name": "l", | ||||
|                               "start": 168, | ||||
|                               "type": "Identifier", | ||||
|                               "type": "Identifier" | ||||
|                             }, | ||||
|                             "end": 169, | ||||
|                             "operator": "-", | ||||
|                             "start": 167, | ||||
|                             "type": "UnaryExpression", | ||||
|                             "type": "UnaryExpression" | ||||
|                           }, | ||||
|                           "operator": "+", | ||||
|                           "right": { | ||||
|                             "end": 173, | ||||
|                             "name": "y", | ||||
|                             "start": 172, | ||||
|                             "type": "Identifier", | ||||
|                             "type": "Identifier" | ||||
|                           }, | ||||
|                           "start": 167, | ||||
|                           "type": "BinaryExpression", | ||||
|                           "type": "BinaryExpression" | ||||
|                         } | ||||
|                       ], | ||||
|                       "end": 174, | ||||
|                       "start": 159, | ||||
|                       "type": "ArrayExpression", | ||||
|                       "type": "ArrayExpression" | ||||
|                     }, | ||||
|                     "start": 154, | ||||
|                     "type": "VariableDeclarator" | ||||
|                   }, | ||||
|                   "end": 174, | ||||
|                   "kind": "const", | ||||
|                   "start": 154, | ||||
|                   "type": "VariableDeclaration", | ||||
|                   "type": "VariableDeclaration" | ||||
|                 }, | ||||
|                 { | ||||
|                   "argument": { | ||||
|                     "body": [ | ||||
|                       { | ||||
|                         "arguments": [ | ||||
|                           { | ||||
|                             "end": 201, | ||||
|                             "name": "p0", | ||||
|                             "start": 199, | ||||
|                             "type": "Identifier", | ||||
|                             "type": "Identifier" | ||||
|                           } | ||||
|                         ], | ||||
|                         "callee": { | ||||
|                           "end": 198, | ||||
|                           "name": "startSketchAt", | ||||
|                           "start": 185, | ||||
|                           "type": "Identifier" | ||||
|                         }, | ||||
|                         "end": 202, | ||||
|                         "start": 185, | ||||
|                         "type": "CallExpression", | ||||
|                         "type": "CallExpression" | ||||
|                       }, | ||||
|                       { | ||||
|                         "arguments": [ | ||||
|                           { | ||||
|                             "type": "LabeledArg", | ||||
|                             "label": { | ||||
|                               "type": "Identifier", | ||||
|                               "name": "endAbsolute" | ||||
|                             }, | ||||
|                             "arg": { | ||||
|                               "end": 231, | ||||
|                               "name": "p1", | ||||
|                               "start": 229, | ||||
|                               "type": "Identifier", | ||||
|                               "type": "Identifier" | ||||
|                             } | ||||
|                           } | ||||
|                         ], | ||||
|                         "callee": { | ||||
|                           "end": 214, | ||||
|                           "name": "line", | ||||
|                           "start": 210, | ||||
|                           "type": "Identifier" | ||||
|                         }, | ||||
|                         "end": 232, | ||||
|                         "start": 210, | ||||
|                         "type": "CallExpressionKw", | ||||
|                         "type": "CallExpressionKw", | ||||
|                         "unlabeled": null | ||||
|                       }, | ||||
|                       { | ||||
|                         "arguments": [ | ||||
|                           { | ||||
|                             "type": "LabeledArg", | ||||
|                             "label": { | ||||
|                               "type": "Identifier", | ||||
|                               "name": "endAbsolute" | ||||
|                             }, | ||||
|                             "arg": { | ||||
|                               "end": 261, | ||||
|                               "name": "p2", | ||||
|                               "start": 259, | ||||
|                               "type": "Identifier", | ||||
|                               "type": "Identifier" | ||||
|                             } | ||||
|                           } | ||||
|                         ], | ||||
|                         "callee": { | ||||
|                           "end": 244, | ||||
|                           "name": "line", | ||||
|                           "start": 240, | ||||
|                           "type": "Identifier" | ||||
|                         }, | ||||
|                         "end": 262, | ||||
|                         "start": 240, | ||||
|                         "type": "CallExpressionKw", | ||||
|                         "type": "CallExpressionKw", | ||||
|                         "unlabeled": null | ||||
|                       }, | ||||
|                       { | ||||
|                         "arguments": [ | ||||
|                           { | ||||
|                             "type": "LabeledArg", | ||||
|                             "label": { | ||||
|                               "type": "Identifier", | ||||
|                               "name": "endAbsolute" | ||||
|                             }, | ||||
|                             "arg": { | ||||
|                               "end": 291, | ||||
|                               "name": "p3", | ||||
|                               "start": 289, | ||||
|                               "type": "Identifier", | ||||
|                               "type": "Identifier" | ||||
|                             } | ||||
|                           } | ||||
|                         ], | ||||
|                         "callee": { | ||||
|                           "end": 274, | ||||
|                           "name": "line", | ||||
|                           "start": 270, | ||||
|                           "type": "Identifier" | ||||
|                         }, | ||||
|                         "end": 292, | ||||
|                         "start": 270, | ||||
|                         "type": "CallExpressionKw", | ||||
|                         "type": "CallExpressionKw", | ||||
|                         "unlabeled": null | ||||
|                       }, | ||||
|                       { | ||||
|                         "arguments": [ | ||||
|                           { | ||||
|                             "type": "LabeledArg", | ||||
|                             "label": { | ||||
|                               "type": "Identifier", | ||||
|                               "name": "endAbsolute" | ||||
|                             }, | ||||
|                             "arg": { | ||||
|                               "end": 321, | ||||
|                               "name": "p0", | ||||
|                               "start": 319, | ||||
|                               "type": "Identifier", | ||||
|                               "type": "Identifier" | ||||
|                             } | ||||
|                           } | ||||
|                         ], | ||||
|                         "callee": { | ||||
|                           "end": 304, | ||||
|                           "name": "line", | ||||
|                           "start": 300, | ||||
|                           "type": "Identifier" | ||||
|                         }, | ||||
|                         "end": 322, | ||||
|                         "start": 300, | ||||
|                         "type": "CallExpressionKw", | ||||
|                         "type": "CallExpressionKw", | ||||
|                         "unlabeled": null | ||||
|                       }, | ||||
|                       { | ||||
|                         "arguments": [], | ||||
|                         "callee": { | ||||
|                           "end": 335, | ||||
|                           "name": "close", | ||||
|                           "start": 330, | ||||
|                           "type": "Identifier" | ||||
|                         }, | ||||
|                         "end": 337, | ||||
|                         "start": 330, | ||||
|                         "type": "CallExpression", | ||||
|                         "type": "CallExpression" | ||||
|                       }, | ||||
|                       { | ||||
|                         "arguments": [ | ||||
|                           { | ||||
|                             "type": "LabeledArg", | ||||
|                             "label": { | ||||
|                               "type": "Identifier", | ||||
|                               "name": "length" | ||||
|                             }, | ||||
|                             "arg": { | ||||
|                               "end": 372, | ||||
|                               "name": "sideLength", | ||||
|                               "start": 362, | ||||
|                               "type": "Identifier", | ||||
|                               "type": "Identifier" | ||||
|                             } | ||||
|                           } | ||||
|                         ], | ||||
|                         "callee": { | ||||
|                           "end": 352, | ||||
|                           "name": "extrude", | ||||
|                           "start": 345, | ||||
|                           "type": "Identifier" | ||||
|                         }, | ||||
|                         "end": 373, | ||||
|                         "start": 345, | ||||
|                         "type": "CallExpressionKw", | ||||
|                         "type": "CallExpressionKw", | ||||
|                         "unlabeled": null | ||||
|                       } | ||||
|                     ], | ||||
|                     "end": 373, | ||||
|                     "start": 185, | ||||
|                     "type": "PipeExpression", | ||||
|                     "type": "PipeExpression" | ||||
|                   }, | ||||
|                   "end": 373, | ||||
|                   "start": 178, | ||||
|                   "type": "ReturnStatement", | ||||
|                   "type": "ReturnStatement" | ||||
|                 } | ||||
|               ], | ||||
|               "end": 375, | ||||
|               "nonCodeMeta": { | ||||
|                 "nonCodeNodes": { | ||||
|                   "6": [ | ||||
|                     { | ||||
|                       "end": 178, | ||||
|                       "start": 174, | ||||
|                       "type": "NonCodeNode", | ||||
|                       "value": { | ||||
|                         "type": "newLine" | ||||
|                       } | ||||
|                     } | ||||
|                   ] | ||||
|                 }, | ||||
|                 "startNodes": [] | ||||
|               }, | ||||
|               "start": 28 | ||||
|             }, | ||||
|             "end": 375, | ||||
|             "params": [ | ||||
|               { | ||||
|                 "type": "Parameter", | ||||
|                 "identifier": { | ||||
|                   "end": 18, | ||||
|                   "name": "sideLength", | ||||
|                   "start": 8, | ||||
|                   "type": "Identifier" | ||||
|                 } | ||||
|               }, | ||||
|               { | ||||
|                 "type": "Parameter", | ||||
|                 "identifier": { | ||||
|                   "end": 26, | ||||
|                   "name": "center", | ||||
|                   "start": 20, | ||||
|                   "type": "Identifier" | ||||
|                 } | ||||
|               } | ||||
|             ], | ||||
|             "start": 7, | ||||
|             "type": "FunctionExpression", | ||||
|             "type": "FunctionExpression" | ||||
|           }, | ||||
|           "start": 3, | ||||
|           "type": "VariableDeclarator" | ||||
|         }, | ||||
|         "end": 375, | ||||
|         "kind": "fn", | ||||
|         "start": 0, | ||||
|         "type": "VariableDeclaration", | ||||
|         "type": "VariableDeclaration" | ||||
|       }, | ||||
|       { | ||||
|         "declaration": { | ||||
|           "end": 424, | ||||
|           "id": { | ||||
|             "end": 383, | ||||
|             "name": "myCube", | ||||
|             "start": 377, | ||||
|             "type": "Identifier" | ||||
|           }, | ||||
|           "init": { | ||||
|             "arguments": [ | ||||
|               { | ||||
|                 "type": "LabeledArg", | ||||
|                 "label": { | ||||
|                   "type": "Identifier", | ||||
|                   "name": "sideLength" | ||||
|                 }, | ||||
|                 "arg": { | ||||
|                   "end": 406, | ||||
|                   "raw": "40", | ||||
|                   "start": 404, | ||||
|                   "type": "Literal", | ||||
|                   "type": "Literal", | ||||
|                   "value": { | ||||
|                     "value": 40.0, | ||||
|                     "suffix": "None" | ||||
|                   } | ||||
|                 } | ||||
|               }, | ||||
|               { | ||||
|                 "type": "LabeledArg", | ||||
|                 "label": { | ||||
|                   "type": "Identifier", | ||||
|                   "name": "center" | ||||
|                 }, | ||||
|                 "arg": { | ||||
|                   "elements": [ | ||||
|                     { | ||||
|                       "end": 419, | ||||
|                       "raw": "0", | ||||
|                       "start": 418, | ||||
|                       "type": "Literal", | ||||
|                       "type": "Literal", | ||||
|                       "value": { | ||||
|                         "value": 0.0, | ||||
|                         "suffix": "None" | ||||
|                       } | ||||
|                     }, | ||||
|                     { | ||||
|                       "end": 422, | ||||
|                       "raw": "0", | ||||
|                       "start": 421, | ||||
|                       "type": "Literal", | ||||
|                       "type": "Literal", | ||||
|                       "value": { | ||||
|                         "value": 0.0, | ||||
|                         "suffix": "None" | ||||
|                       } | ||||
|                     } | ||||
|                   ], | ||||
|                   "end": 423, | ||||
|                   "start": 417, | ||||
|                   "type": "ArrayExpression", | ||||
|                   "type": "ArrayExpression" | ||||
|                 } | ||||
|               } | ||||
|             ], | ||||
|             "callee": { | ||||
|               "end": 390, | ||||
|               "name": "cube", | ||||
|               "start": 386, | ||||
|               "type": "Identifier" | ||||
|             }, | ||||
|             "end": 424, | ||||
|             "start": 386, | ||||
|             "type": "CallExpressionKw", | ||||
|             "type": "CallExpressionKw", | ||||
|             "unlabeled": null | ||||
|           }, | ||||
|           "start": 377, | ||||
|           "type": "VariableDeclarator" | ||||
|         }, | ||||
|         "end": 424, | ||||
|         "kind": "const", | ||||
|         "start": 377, | ||||
|         "type": "VariableDeclaration", | ||||
|         "type": "VariableDeclaration" | ||||
|       } | ||||
|     ], | ||||
|     "end": 425, | ||||
|     "nonCodeMeta": { | ||||
|       "nonCodeNodes": { | ||||
|         "0": [ | ||||
|           { | ||||
|             "end": 377, | ||||
|             "start": 375, | ||||
|             "type": "NonCodeNode", | ||||
|             "value": { | ||||
|               "type": "newLine" | ||||
|             } | ||||
|           } | ||||
|         ] | ||||
|       }, | ||||
|       "startNodes": [] | ||||
|     }, | ||||
|     "start": 0 | ||||
|   } | ||||
| } | ||||
							
								
								
									
										19
									
								
								rust/kcl-lib/tests/cube/input.kcl
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										19
									
								
								rust/kcl-lib/tests/cube/input.kcl
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,19 @@ | ||||
| fn cube(sideLength, center) { | ||||
|   l = sideLength / 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 = sideLength) | ||||
| } | ||||
|  | ||||
| myCube = cube(sideLength = 40, center = [0, 0]) | ||||
							
								
								
									
										128
									
								
								rust/kcl-lib/tests/cube/ops.snap
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										128
									
								
								rust/kcl-lib/tests/cube/ops.snap
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,128 @@ | ||||
| --- | ||||
| source: kcl/src/simulation_tests.rs | ||||
| description: Operations executed cube.kcl | ||||
| --- | ||||
| [ | ||||
|   { | ||||
|     "type": "UserDefinedFunctionCall", | ||||
|     "name": "cube", | ||||
|     "functionSourceRange": [ | ||||
|       7, | ||||
|       375, | ||||
|       0 | ||||
|     ], | ||||
|     "unlabeledArg": null, | ||||
|     "labeledArgs": { | ||||
|       "center": { | ||||
|         "value": { | ||||
|           "type": "Array", | ||||
|           "value": [ | ||||
|             { | ||||
|               "type": "Number", | ||||
|               "value": 0.0, | ||||
|               "ty": { | ||||
|                 "type": "Default", | ||||
|                 "len": { | ||||
|                   "type": "Mm" | ||||
|                 }, | ||||
|                 "angle": { | ||||
|                   "type": "Degrees" | ||||
|                 } | ||||
|               } | ||||
|             }, | ||||
|             { | ||||
|               "type": "Number", | ||||
|               "value": 0.0, | ||||
|               "ty": { | ||||
|                 "type": "Default", | ||||
|                 "len": { | ||||
|                   "type": "Mm" | ||||
|                 }, | ||||
|                 "angle": { | ||||
|                   "type": "Degrees" | ||||
|                 } | ||||
|               } | ||||
|             } | ||||
|           ] | ||||
|         }, | ||||
|         "sourceRange": [ | ||||
|           417, | ||||
|           423, | ||||
|           0 | ||||
|         ] | ||||
|       }, | ||||
|       "sideLength": { | ||||
|         "value": { | ||||
|           "type": "Number", | ||||
|           "value": 40.0, | ||||
|           "ty": { | ||||
|             "type": "Default", | ||||
|             "len": { | ||||
|               "type": "Mm" | ||||
|             }, | ||||
|             "angle": { | ||||
|               "type": "Degrees" | ||||
|             } | ||||
|           } | ||||
|         }, | ||||
|         "sourceRange": [ | ||||
|           404, | ||||
|           406, | ||||
|           0 | ||||
|         ] | ||||
|       } | ||||
|     }, | ||||
|     "sourceRange": [ | ||||
|       386, | ||||
|       424, | ||||
|       0 | ||||
|     ] | ||||
|   }, | ||||
|   { | ||||
|     "labeledArgs": { | ||||
|       "length": { | ||||
|         "value": { | ||||
|           "type": "Number", | ||||
|           "value": 40.0, | ||||
|           "ty": { | ||||
|             "type": "Default", | ||||
|             "len": { | ||||
|               "type": "Mm" | ||||
|             }, | ||||
|             "angle": { | ||||
|               "type": "Degrees" | ||||
|             } | ||||
|           } | ||||
|         }, | ||||
|         "sourceRange": [ | ||||
|           362, | ||||
|           372, | ||||
|           0 | ||||
|         ] | ||||
|       } | ||||
|     }, | ||||
|     "name": "extrude", | ||||
|     "sourceRange": [ | ||||
|       345, | ||||
|       373, | ||||
|       0 | ||||
|     ], | ||||
|     "type": "StdLibCall", | ||||
|     "unlabeledArg": { | ||||
|       "value": { | ||||
|         "type": "Sketch", | ||||
|         "value": { | ||||
|           "artifactId": "[uuid]" | ||||
|         } | ||||
|       }, | ||||
|       "sourceRange": [ | ||||
|         0, | ||||
|         0, | ||||
|         0 | ||||
|       ] | ||||
|     } | ||||
|   }, | ||||
|   { | ||||
|     "type": "UserDefinedFunctionReturn" | ||||
|   } | ||||
| ] | ||||
							
								
								
									
										274
									
								
								rust/kcl-lib/tests/cube/program_memory.snap
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										274
									
								
								rust/kcl-lib/tests/cube/program_memory.snap
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,274 @@ | ||||
| --- | ||||
| source: kcl/src/simulation_tests.rs | ||||
| description: Variables in memory after executing cube.kcl | ||||
| --- | ||||
| { | ||||
|   "cube": { | ||||
|     "type": "Function", | ||||
|     "__meta": [ | ||||
|       { | ||||
|         "sourceRange": [ | ||||
|           7, | ||||
|           375, | ||||
|           0 | ||||
|         ] | ||||
|       } | ||||
|     ] | ||||
|   }, | ||||
|   "myCube": { | ||||
|     "type": "Solid", | ||||
|     "value": { | ||||
|       "type": "Solid", | ||||
|       "id": "[uuid]", | ||||
|       "artifactId": "[uuid]", | ||||
|       "value": [ | ||||
|         { | ||||
|           "faceId": "[uuid]", | ||||
|           "id": "[uuid]", | ||||
|           "sourceRange": [ | ||||
|             210, | ||||
|             232, | ||||
|             0 | ||||
|           ], | ||||
|           "tag": null, | ||||
|           "type": "extrudePlane" | ||||
|         }, | ||||
|         { | ||||
|           "faceId": "[uuid]", | ||||
|           "id": "[uuid]", | ||||
|           "sourceRange": [ | ||||
|             240, | ||||
|             262, | ||||
|             0 | ||||
|           ], | ||||
|           "tag": null, | ||||
|           "type": "extrudePlane" | ||||
|         }, | ||||
|         { | ||||
|           "faceId": "[uuid]", | ||||
|           "id": "[uuid]", | ||||
|           "sourceRange": [ | ||||
|             270, | ||||
|             292, | ||||
|             0 | ||||
|           ], | ||||
|           "tag": null, | ||||
|           "type": "extrudePlane" | ||||
|         }, | ||||
|         { | ||||
|           "faceId": "[uuid]", | ||||
|           "id": "[uuid]", | ||||
|           "sourceRange": [ | ||||
|             300, | ||||
|             322, | ||||
|             0 | ||||
|           ], | ||||
|           "tag": null, | ||||
|           "type": "extrudePlane" | ||||
|         } | ||||
|       ], | ||||
|       "sketch": { | ||||
|         "type": "Sketch", | ||||
|         "id": "[uuid]", | ||||
|         "paths": [ | ||||
|           { | ||||
|             "__geoMeta": { | ||||
|               "id": "[uuid]", | ||||
|               "sourceRange": [ | ||||
|                 210, | ||||
|                 232, | ||||
|                 0 | ||||
|               ] | ||||
|             }, | ||||
|             "from": [ | ||||
|               -20.0, | ||||
|               -20.0 | ||||
|             ], | ||||
|             "tag": null, | ||||
|             "to": [ | ||||
|               -20.0, | ||||
|               20.0 | ||||
|             ], | ||||
|             "type": "ToPoint", | ||||
|             "units": { | ||||
|               "type": "Mm" | ||||
|             } | ||||
|           }, | ||||
|           { | ||||
|             "__geoMeta": { | ||||
|               "id": "[uuid]", | ||||
|               "sourceRange": [ | ||||
|                 240, | ||||
|                 262, | ||||
|                 0 | ||||
|               ] | ||||
|             }, | ||||
|             "from": [ | ||||
|               -20.0, | ||||
|               20.0 | ||||
|             ], | ||||
|             "tag": null, | ||||
|             "to": [ | ||||
|               20.0, | ||||
|               20.0 | ||||
|             ], | ||||
|             "type": "ToPoint", | ||||
|             "units": { | ||||
|               "type": "Mm" | ||||
|             } | ||||
|           }, | ||||
|           { | ||||
|             "__geoMeta": { | ||||
|               "id": "[uuid]", | ||||
|               "sourceRange": [ | ||||
|                 270, | ||||
|                 292, | ||||
|                 0 | ||||
|               ] | ||||
|             }, | ||||
|             "from": [ | ||||
|               20.0, | ||||
|               20.0 | ||||
|             ], | ||||
|             "tag": null, | ||||
|             "to": [ | ||||
|               20.0, | ||||
|               -20.0 | ||||
|             ], | ||||
|             "type": "ToPoint", | ||||
|             "units": { | ||||
|               "type": "Mm" | ||||
|             } | ||||
|           }, | ||||
|           { | ||||
|             "__geoMeta": { | ||||
|               "id": "[uuid]", | ||||
|               "sourceRange": [ | ||||
|                 300, | ||||
|                 322, | ||||
|                 0 | ||||
|               ] | ||||
|             }, | ||||
|             "from": [ | ||||
|               20.0, | ||||
|               -20.0 | ||||
|             ], | ||||
|             "tag": null, | ||||
|             "to": [ | ||||
|               -20.0, | ||||
|               -20.0 | ||||
|             ], | ||||
|             "type": "ToPoint", | ||||
|             "units": { | ||||
|               "type": "Mm" | ||||
|             } | ||||
|           }, | ||||
|           { | ||||
|             "__geoMeta": { | ||||
|               "id": "[uuid]", | ||||
|               "sourceRange": [ | ||||
|                 330, | ||||
|                 337, | ||||
|                 0 | ||||
|               ] | ||||
|             }, | ||||
|             "from": [ | ||||
|               -20.0, | ||||
|               -20.0 | ||||
|             ], | ||||
|             "tag": null, | ||||
|             "to": [ | ||||
|               -20.0, | ||||
|               -20.0 | ||||
|             ], | ||||
|             "type": "ToPoint", | ||||
|             "units": { | ||||
|               "type": "Mm" | ||||
|             } | ||||
|           } | ||||
|         ], | ||||
|         "on": { | ||||
|           "type": "plane", | ||||
|           "id": "[uuid]", | ||||
|           "artifactId": "[uuid]", | ||||
|           "value": "XY", | ||||
|           "origin": { | ||||
|             "x": 0.0, | ||||
|             "y": 0.0, | ||||
|             "z": 0.0 | ||||
|           }, | ||||
|           "xAxis": { | ||||
|             "x": 1.0, | ||||
|             "y": 0.0, | ||||
|             "z": 0.0 | ||||
|           }, | ||||
|           "yAxis": { | ||||
|             "x": 0.0, | ||||
|             "y": 1.0, | ||||
|             "z": 0.0 | ||||
|           }, | ||||
|           "zAxis": { | ||||
|             "x": 0.0, | ||||
|             "y": 0.0, | ||||
|             "z": 1.0 | ||||
|           }, | ||||
|           "units": { | ||||
|             "type": "Mm" | ||||
|           }, | ||||
|           "__meta": [] | ||||
|         }, | ||||
|         "start": { | ||||
|           "from": [ | ||||
|             -20.0, | ||||
|             -20.0 | ||||
|           ], | ||||
|           "to": [ | ||||
|             -20.0, | ||||
|             -20.0 | ||||
|           ], | ||||
|           "units": { | ||||
|             "type": "Mm" | ||||
|           }, | ||||
|           "tag": null, | ||||
|           "__geoMeta": { | ||||
|             "id": "[uuid]", | ||||
|             "sourceRange": [ | ||||
|               185, | ||||
|               202, | ||||
|               0 | ||||
|             ] | ||||
|           } | ||||
|         }, | ||||
|         "artifactId": "[uuid]", | ||||
|         "originalId": "[uuid]", | ||||
|         "units": { | ||||
|           "type": "Mm" | ||||
|         }, | ||||
|         "__meta": [ | ||||
|           { | ||||
|             "sourceRange": [ | ||||
|               185, | ||||
|               202, | ||||
|               0 | ||||
|             ] | ||||
|           } | ||||
|         ] | ||||
|       }, | ||||
|       "height": 40.0, | ||||
|       "startCapId": "[uuid]", | ||||
|       "endCapId": "[uuid]", | ||||
|       "units": { | ||||
|         "type": "Mm" | ||||
|       }, | ||||
|       "__meta": [ | ||||
|         { | ||||
|           "sourceRange": [ | ||||
|             185, | ||||
|             202, | ||||
|             0 | ||||
|           ] | ||||
|         } | ||||
|       ] | ||||
|     } | ||||
|   } | ||||
| } | ||||
							
								
								
									
										
											BIN
										
									
								
								rust/kcl-lib/tests/cube/rendered_model.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								rust/kcl-lib/tests/cube/rendered_model.png
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| After Width: | Height: | Size: 91 KiB | 
		Reference in New Issue
	
	Block a user