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:
@ -1,7 +1,6 @@
|
||||
---
|
||||
source: kcl/src/simulation_tests.rs
|
||||
description: Program memory after executing function_sketch.kcl
|
||||
snapshot_kind: text
|
||||
---
|
||||
{
|
||||
"environments": [
|
||||
@ -33,276 +32,274 @@ snapshot_kind: text
|
||||
"body": {
|
||||
"body": [
|
||||
{
|
||||
"declarations": [
|
||||
{
|
||||
"end": 187,
|
||||
"id": {
|
||||
"end": 25,
|
||||
"name": "myBox",
|
||||
"start": 20,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"init": {
|
||||
"body": [
|
||||
{
|
||||
"arguments": [
|
||||
{
|
||||
"end": 46,
|
||||
"raw": "'XY'",
|
||||
"start": 42,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": "XY"
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"end": 41,
|
||||
"name": "startSketchOn",
|
||||
"start": 28,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"end": 47,
|
||||
"start": 28,
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression"
|
||||
},
|
||||
{
|
||||
"arguments": [
|
||||
{
|
||||
"elements": [
|
||||
{
|
||||
"end": 72,
|
||||
"raw": "0",
|
||||
"start": 71,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": 0.0
|
||||
},
|
||||
{
|
||||
"end": 75,
|
||||
"raw": "0",
|
||||
"start": 74,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": 0.0
|
||||
}
|
||||
],
|
||||
"end": 76,
|
||||
"start": 70,
|
||||
"type": "ArrayExpression",
|
||||
"type": "ArrayExpression"
|
||||
},
|
||||
{
|
||||
"end": 79,
|
||||
"start": 78,
|
||||
"type": "PipeSubstitution",
|
||||
"type": "PipeSubstitution"
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"end": 69,
|
||||
"name": "startProfileAt",
|
||||
"start": 55,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"end": 80,
|
||||
"start": 55,
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression"
|
||||
},
|
||||
{
|
||||
"arguments": [
|
||||
{
|
||||
"elements": [
|
||||
{
|
||||
"end": 95,
|
||||
"raw": "0",
|
||||
"start": 94,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": 0.0
|
||||
},
|
||||
{
|
||||
"end": 98,
|
||||
"name": "l",
|
||||
"start": 97,
|
||||
"type": "Identifier",
|
||||
"type": "Identifier"
|
||||
}
|
||||
],
|
||||
"end": 99,
|
||||
"start": 93,
|
||||
"type": "ArrayExpression",
|
||||
"type": "ArrayExpression"
|
||||
},
|
||||
{
|
||||
"end": 102,
|
||||
"start": 101,
|
||||
"type": "PipeSubstitution",
|
||||
"type": "PipeSubstitution"
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"end": 92,
|
||||
"name": "line",
|
||||
"start": 88,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"end": 103,
|
||||
"start": 88,
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression"
|
||||
},
|
||||
{
|
||||
"arguments": [
|
||||
{
|
||||
"elements": [
|
||||
{
|
||||
"end": 118,
|
||||
"name": "w",
|
||||
"start": 117,
|
||||
"type": "Identifier",
|
||||
"type": "Identifier"
|
||||
},
|
||||
{
|
||||
"end": 121,
|
||||
"raw": "0",
|
||||
"start": 120,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": 0.0
|
||||
}
|
||||
],
|
||||
"end": 122,
|
||||
"start": 116,
|
||||
"type": "ArrayExpression",
|
||||
"type": "ArrayExpression"
|
||||
},
|
||||
{
|
||||
"end": 125,
|
||||
"start": 124,
|
||||
"type": "PipeSubstitution",
|
||||
"type": "PipeSubstitution"
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"end": 115,
|
||||
"name": "line",
|
||||
"start": 111,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"end": 126,
|
||||
"start": 111,
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression"
|
||||
},
|
||||
{
|
||||
"arguments": [
|
||||
{
|
||||
"elements": [
|
||||
{
|
||||
"end": 141,
|
||||
"raw": "0",
|
||||
"start": 140,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": 0.0
|
||||
},
|
||||
{
|
||||
"argument": {
|
||||
"end": 145,
|
||||
"name": "l",
|
||||
"start": 144,
|
||||
"type": "Identifier",
|
||||
"type": "Identifier"
|
||||
},
|
||||
"end": 145,
|
||||
"operator": "-",
|
||||
"start": 143,
|
||||
"type": "UnaryExpression",
|
||||
"type": "UnaryExpression"
|
||||
}
|
||||
],
|
||||
"end": 146,
|
||||
"start": 139,
|
||||
"type": "ArrayExpression",
|
||||
"type": "ArrayExpression"
|
||||
},
|
||||
{
|
||||
"end": 149,
|
||||
"start": 148,
|
||||
"type": "PipeSubstitution",
|
||||
"type": "PipeSubstitution"
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"end": 138,
|
||||
"name": "line",
|
||||
"start": 134,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"end": 150,
|
||||
"start": 134,
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression"
|
||||
},
|
||||
{
|
||||
"arguments": [
|
||||
{
|
||||
"end": 165,
|
||||
"start": 164,
|
||||
"type": "PipeSubstitution",
|
||||
"type": "PipeSubstitution"
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"end": 163,
|
||||
"name": "close",
|
||||
"start": 158,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"end": 166,
|
||||
"start": 158,
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression"
|
||||
},
|
||||
{
|
||||
"arguments": [
|
||||
{
|
||||
"end": 183,
|
||||
"name": "h",
|
||||
"start": 182,
|
||||
"type": "Identifier",
|
||||
"type": "Identifier"
|
||||
},
|
||||
{
|
||||
"end": 186,
|
||||
"start": 185,
|
||||
"type": "PipeSubstitution",
|
||||
"type": "PipeSubstitution"
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"end": 181,
|
||||
"name": "extrude",
|
||||
"start": 174,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"end": 187,
|
||||
"start": 174,
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression"
|
||||
}
|
||||
],
|
||||
"end": 187,
|
||||
"start": 28,
|
||||
"type": "PipeExpression",
|
||||
"type": "PipeExpression"
|
||||
},
|
||||
"declaration": {
|
||||
"end": 187,
|
||||
"id": {
|
||||
"end": 25,
|
||||
"name": "myBox",
|
||||
"start": 20,
|
||||
"type": "VariableDeclarator"
|
||||
}
|
||||
],
|
||||
"type": "Identifier"
|
||||
},
|
||||
"init": {
|
||||
"body": [
|
||||
{
|
||||
"arguments": [
|
||||
{
|
||||
"end": 46,
|
||||
"raw": "'XY'",
|
||||
"start": 42,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": "XY"
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"end": 41,
|
||||
"name": "startSketchOn",
|
||||
"start": 28,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"end": 47,
|
||||
"start": 28,
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression"
|
||||
},
|
||||
{
|
||||
"arguments": [
|
||||
{
|
||||
"elements": [
|
||||
{
|
||||
"end": 72,
|
||||
"raw": "0",
|
||||
"start": 71,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": 0.0
|
||||
},
|
||||
{
|
||||
"end": 75,
|
||||
"raw": "0",
|
||||
"start": 74,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": 0.0
|
||||
}
|
||||
],
|
||||
"end": 76,
|
||||
"start": 70,
|
||||
"type": "ArrayExpression",
|
||||
"type": "ArrayExpression"
|
||||
},
|
||||
{
|
||||
"end": 79,
|
||||
"start": 78,
|
||||
"type": "PipeSubstitution",
|
||||
"type": "PipeSubstitution"
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"end": 69,
|
||||
"name": "startProfileAt",
|
||||
"start": 55,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"end": 80,
|
||||
"start": 55,
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression"
|
||||
},
|
||||
{
|
||||
"arguments": [
|
||||
{
|
||||
"elements": [
|
||||
{
|
||||
"end": 95,
|
||||
"raw": "0",
|
||||
"start": 94,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": 0.0
|
||||
},
|
||||
{
|
||||
"end": 98,
|
||||
"name": "l",
|
||||
"start": 97,
|
||||
"type": "Identifier",
|
||||
"type": "Identifier"
|
||||
}
|
||||
],
|
||||
"end": 99,
|
||||
"start": 93,
|
||||
"type": "ArrayExpression",
|
||||
"type": "ArrayExpression"
|
||||
},
|
||||
{
|
||||
"end": 102,
|
||||
"start": 101,
|
||||
"type": "PipeSubstitution",
|
||||
"type": "PipeSubstitution"
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"end": 92,
|
||||
"name": "line",
|
||||
"start": 88,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"end": 103,
|
||||
"start": 88,
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression"
|
||||
},
|
||||
{
|
||||
"arguments": [
|
||||
{
|
||||
"elements": [
|
||||
{
|
||||
"end": 118,
|
||||
"name": "w",
|
||||
"start": 117,
|
||||
"type": "Identifier",
|
||||
"type": "Identifier"
|
||||
},
|
||||
{
|
||||
"end": 121,
|
||||
"raw": "0",
|
||||
"start": 120,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": 0.0
|
||||
}
|
||||
],
|
||||
"end": 122,
|
||||
"start": 116,
|
||||
"type": "ArrayExpression",
|
||||
"type": "ArrayExpression"
|
||||
},
|
||||
{
|
||||
"end": 125,
|
||||
"start": 124,
|
||||
"type": "PipeSubstitution",
|
||||
"type": "PipeSubstitution"
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"end": 115,
|
||||
"name": "line",
|
||||
"start": 111,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"end": 126,
|
||||
"start": 111,
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression"
|
||||
},
|
||||
{
|
||||
"arguments": [
|
||||
{
|
||||
"elements": [
|
||||
{
|
||||
"end": 141,
|
||||
"raw": "0",
|
||||
"start": 140,
|
||||
"type": "Literal",
|
||||
"type": "Literal",
|
||||
"value": 0.0
|
||||
},
|
||||
{
|
||||
"argument": {
|
||||
"end": 145,
|
||||
"name": "l",
|
||||
"start": 144,
|
||||
"type": "Identifier",
|
||||
"type": "Identifier"
|
||||
},
|
||||
"end": 145,
|
||||
"operator": "-",
|
||||
"start": 143,
|
||||
"type": "UnaryExpression",
|
||||
"type": "UnaryExpression"
|
||||
}
|
||||
],
|
||||
"end": 146,
|
||||
"start": 139,
|
||||
"type": "ArrayExpression",
|
||||
"type": "ArrayExpression"
|
||||
},
|
||||
{
|
||||
"end": 149,
|
||||
"start": 148,
|
||||
"type": "PipeSubstitution",
|
||||
"type": "PipeSubstitution"
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"end": 138,
|
||||
"name": "line",
|
||||
"start": 134,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"end": 150,
|
||||
"start": 134,
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression"
|
||||
},
|
||||
{
|
||||
"arguments": [
|
||||
{
|
||||
"end": 165,
|
||||
"start": 164,
|
||||
"type": "PipeSubstitution",
|
||||
"type": "PipeSubstitution"
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"end": 163,
|
||||
"name": "close",
|
||||
"start": 158,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"end": 166,
|
||||
"start": 158,
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression"
|
||||
},
|
||||
{
|
||||
"arguments": [
|
||||
{
|
||||
"end": 183,
|
||||
"name": "h",
|
||||
"start": 182,
|
||||
"type": "Identifier",
|
||||
"type": "Identifier"
|
||||
},
|
||||
{
|
||||
"end": 186,
|
||||
"start": 185,
|
||||
"type": "PipeSubstitution",
|
||||
"type": "PipeSubstitution"
|
||||
}
|
||||
],
|
||||
"callee": {
|
||||
"end": 181,
|
||||
"name": "extrude",
|
||||
"start": 174,
|
||||
"type": "Identifier"
|
||||
},
|
||||
"end": 187,
|
||||
"start": 174,
|
||||
"type": "CallExpression",
|
||||
"type": "CallExpression"
|
||||
}
|
||||
],
|
||||
"end": 187,
|
||||
"start": 28,
|
||||
"type": "PipeExpression",
|
||||
"type": "PipeExpression"
|
||||
},
|
||||
"start": 20,
|
||||
"type": "VariableDeclarator"
|
||||
},
|
||||
"end": 187,
|
||||
"kind": "const",
|
||||
"start": 20,
|
||||
|
||||
Reference in New Issue
Block a user