Module/import upgrades (#4677)

* Parse more import syntax

Signed-off-by: Nick Cameron <nrc@ncameron.org>

* Remove unnecessary Vec from VariableDeclaration

Signed-off-by: Nick Cameron <nrc@ncameron.org>

* Parse export import

Signed-off-by: Nick Cameron <nrc@ncameron.org>

* Factor out an execution module

Signed-off-by: Nick Cameron <nrc@ncameron.org>

* imports: constants, globs, export import

Signed-off-by: Nick Cameron <nrc@ncameron.org>

* test fixups

Signed-off-by: Nick Cameron <nrc@ncameron.org>

---------

Signed-off-by: Nick Cameron <nrc@ncameron.org>
This commit is contained in:
Nick Cameron
2024-12-07 07:16:04 +13:00
committed by GitHub
parent 7af62399ac
commit 30d365aeb3
236 changed files with 103332 additions and 103576 deletions

View File

@ -1,7 +1,6 @@
---
source: kcl/src/simulation_tests.rs
description: Program memory after executing fillet-and-shell.kcl
snapshot_kind: text
---
{
"environments": [
@ -910,300 +909,298 @@ snapshot_kind: text
"body": {
"body": [
{
"declarations": [
{
"end": 1425,
"id": {
"end": 1230,
"name": "screw",
"start": 1225,
"type": "Identifier"
},
"init": {
"body": [
{
"arguments": [
{
"end": 1251,
"raw": "\"XY\"",
"start": 1247,
"type": "Literal",
"type": "Literal",
"value": "XY"
}
],
"callee": {
"end": 1246,
"name": "startSketchOn",
"start": 1233,
"type": "Identifier"
},
"end": 1252,
"declaration": {
"end": 1425,
"id": {
"end": 1230,
"name": "screw",
"start": 1225,
"type": "Identifier"
},
"init": {
"body": [
{
"arguments": [
{
"end": 1251,
"raw": "\"XY\"",
"start": 1247,
"type": "Literal",
"type": "Literal",
"value": "XY"
}
],
"callee": {
"end": 1246,
"name": "startSketchOn",
"start": 1233,
"type": "CallExpression",
"type": "CallExpression"
"type": "Identifier"
},
{
"arguments": [
{
"elements": [
{
"end": 1277,
"raw": "0",
"start": 1276,
"type": "Literal",
"type": "Literal",
"value": 0.0
},
{
"end": 1280,
"raw": "0",
"start": 1279,
"type": "Literal",
"type": "Literal",
"value": 0.0
}
],
"end": 1281,
"start": 1275,
"type": "ArrayExpression",
"type": "ArrayExpression"
},
{
"end": 1284,
"start": 1283,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"end": 1274,
"name": "startProfileAt",
"start": 1260,
"type": "Identifier"
"end": 1252,
"start": 1233,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"elements": [
{
"end": 1277,
"raw": "0",
"start": 1276,
"type": "Literal",
"type": "Literal",
"value": 0.0
},
{
"end": 1280,
"raw": "0",
"start": 1279,
"type": "Literal",
"type": "Literal",
"value": 0.0
}
],
"end": 1281,
"start": 1275,
"type": "ArrayExpression",
"type": "ArrayExpression"
},
"end": 1285,
{
"end": 1284,
"start": 1283,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"end": 1274,
"name": "startProfileAt",
"start": 1260,
"type": "CallExpression",
"type": "CallExpression"
"type": "Identifier"
},
{
"arguments": [
{
"end": 1333,
"properties": [
{
"end": 1317,
"key": {
"end": 1308,
"name": "center",
"start": 1302,
"type": "Identifier"
},
"end": 1285,
"start": 1260,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"end": 1333,
"properties": [
{
"end": 1317,
"key": {
"end": 1308,
"name": "center",
"start": 1302,
"type": "ObjectProperty",
"value": {
"elements": [
{
"end": 1313,
"name": "x",
"start": 1312,
"type": "Identifier",
"type": "Identifier"
},
{
"end": 1316,
"name": "y",
"start": 1315,
"type": "Identifier",
"type": "Identifier"
}
],
"end": 1317,
"start": 1311,
"type": "ArrayExpression",
"type": "ArrayExpression"
}
"type": "Identifier"
},
{
"end": 1331,
"key": {
"end": 1325,
"name": "radius",
"start": 1319,
"type": "Identifier"
},
"start": 1319,
"type": "ObjectProperty",
"value": {
"end": 1331,
"raw": "2.5",
"start": 1328,
"type": "Literal",
"type": "Literal",
"value": 2.5
}
}
],
"start": 1300,
"type": "ObjectExpression",
"type": "ObjectExpression"
},
{
"end": 1336,
"start": 1335,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"end": 1299,
"name": "circle",
"start": 1293,
"type": "Identifier"
},
"end": 1337,
"start": 1293,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"arguments": [
{
"end": 1391,
"properties": [
"start": 1302,
"type": "ObjectProperty",
"value": {
"elements": [
{
"end": 1374,
"key": {
"end": 1365,
"name": "center",
"start": 1359,
"type": "Identifier"
},
"start": 1359,
"type": "ObjectProperty",
"value": {
"elements": [
{
"end": 1370,
"name": "x",
"start": 1369,
"type": "Identifier",
"type": "Identifier"
},
{
"end": 1373,
"name": "y",
"start": 1372,
"type": "Identifier",
"type": "Identifier"
}
],
"end": 1374,
"start": 1368,
"type": "ArrayExpression",
"type": "ArrayExpression"
}
"end": 1313,
"name": "x",
"start": 1312,
"type": "Identifier",
"type": "Identifier"
},
{
"end": 1389,
"key": {
"end": 1382,
"name": "radius",
"start": 1376,
"type": "Identifier"
},
"start": 1376,
"type": "ObjectProperty",
"value": {
"end": 1389,
"raw": "1.25",
"start": 1385,
"type": "Literal",
"type": "Literal",
"value": 1.25
}
"end": 1316,
"name": "y",
"start": 1315,
"type": "Identifier",
"type": "Identifier"
}
],
"start": 1357,
"type": "ObjectExpression",
"type": "ObjectExpression"
},
{
"end": 1394,
"start": 1393,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
"end": 1317,
"start": 1311,
"type": "ArrayExpression",
"type": "ArrayExpression"
}
],
"callee": {
"end": 1356,
"name": "circle",
"start": 1350,
"type": "Identifier"
},
"end": 1395,
"start": 1350,
"type": "CallExpression",
"type": "CallExpression"
},
{
"end": 1398,
"start": 1397,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"end": 1349,
"name": "hole",
"start": 1345,
"type": "Identifier"
{
"end": 1331,
"key": {
"end": 1325,
"name": "radius",
"start": 1319,
"type": "Identifier"
},
"start": 1319,
"type": "ObjectProperty",
"value": {
"end": 1331,
"raw": "2.5",
"start": 1328,
"type": "Literal",
"type": "Literal",
"value": 2.5
}
}
],
"start": 1300,
"type": "ObjectExpression",
"type": "ObjectExpression"
},
"end": 1399,
"start": 1345,
"type": "CallExpression",
"type": "CallExpression"
{
"end": 1336,
"start": 1335,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"end": 1299,
"name": "circle",
"start": 1293,
"type": "Identifier"
},
{
"arguments": [
{
"end": 1421,
"name": "height",
"start": 1415,
"type": "Identifier",
"end": 1337,
"start": 1293,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"arguments": [
{
"end": 1391,
"properties": [
{
"end": 1374,
"key": {
"end": 1365,
"name": "center",
"start": 1359,
"type": "Identifier"
},
"start": 1359,
"type": "ObjectProperty",
"value": {
"elements": [
{
"end": 1370,
"name": "x",
"start": 1369,
"type": "Identifier",
"type": "Identifier"
},
{
"end": 1373,
"name": "y",
"start": 1372,
"type": "Identifier",
"type": "Identifier"
}
],
"end": 1374,
"start": 1368,
"type": "ArrayExpression",
"type": "ArrayExpression"
}
},
{
"end": 1389,
"key": {
"end": 1382,
"name": "radius",
"start": 1376,
"type": "Identifier"
},
"start": 1376,
"type": "ObjectProperty",
"value": {
"end": 1389,
"raw": "1.25",
"start": 1385,
"type": "Literal",
"type": "Literal",
"value": 1.25
}
}
],
"start": 1357,
"type": "ObjectExpression",
"type": "ObjectExpression"
},
{
"end": 1394,
"start": 1393,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"end": 1356,
"name": "circle",
"start": 1350,
"type": "Identifier"
},
{
"end": 1424,
"start": 1423,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"end": 1414,
"name": "extrude",
"start": 1407,
"end": 1395,
"start": 1350,
"type": "CallExpression",
"type": "CallExpression"
},
{
"end": 1398,
"start": 1397,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"end": 1349,
"name": "hole",
"start": 1345,
"type": "Identifier"
},
"end": 1399,
"start": 1345,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"end": 1421,
"name": "height",
"start": 1415,
"type": "Identifier",
"type": "Identifier"
},
"end": 1425,
{
"end": 1424,
"start": 1423,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"end": 1414,
"name": "extrude",
"start": 1407,
"type": "CallExpression",
"type": "CallExpression"
}
],
"end": 1425,
"start": 1233,
"type": "PipeExpression",
"type": "PipeExpression"
},
"start": 1225,
"type": "VariableDeclarator"
}
],
"type": "Identifier"
},
"end": 1425,
"start": 1407,
"type": "CallExpression",
"type": "CallExpression"
}
],
"end": 1425,
"start": 1233,
"type": "PipeExpression",
"type": "PipeExpression"
},
"start": 1225,
"type": "VariableDeclarator"
},
"end": 1425,
"kind": "const",
"start": 1225,