Files
modeling-app/rust/kcl-lib/tests/cube_with_error/ast.snap
Nick Cameron dddcd5ff46 Support paths to names rather than just raw idents (#5778)
* Support paths to names rather than just raw idents

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

* A snapshot a day keeps the bugs away! 📷🐛

* A snapshot a day keeps the bugs away! 📷🐛

* A snapshot a day keeps the bugs away! 📷🐛

* A snapshot a day keeps the bugs away! 📷🐛

---------

Signed-off-by: Nick Cameron <nrc@ncameron.org>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2025-03-24 20:58:55 +13:00

1229 lines
44 KiB
Plaintext

---
source: kcl-lib/src/simulation_tests.rs
description: Result of parsing cube_with_error.kcl
---
{
"Ok": {
"body": [
{
"commentStart": 0,
"declaration": {
"commentStart": 3,
"end": 0,
"id": {
"commentStart": 3,
"end": 0,
"name": "cube",
"start": 0,
"type": "Identifier"
},
"init": {
"body": {
"body": [
{
"commentStart": 28,
"declaration": {
"commentStart": 28,
"end": 0,
"id": {
"commentStart": 28,
"end": 0,
"name": "l",
"start": 0,
"type": "Identifier"
},
"init": {
"commentStart": 32,
"end": 0,
"left": {
"abs_path": false,
"commentStart": 32,
"end": 0,
"name": {
"commentStart": 32,
"end": 0,
"name": "length",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
},
"operator": "/",
"right": {
"commentStart": 41,
"end": 0,
"raw": "2",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 2.0,
"suffix": "None"
}
},
"start": 0,
"type": "BinaryExpression",
"type": "BinaryExpression"
},
"start": 0,
"type": "VariableDeclarator"
},
"end": 0,
"kind": "const",
"start": 0,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"commentStart": 45,
"declaration": {
"commentStart": 45,
"end": 0,
"id": {
"commentStart": 45,
"end": 0,
"name": "x",
"start": 0,
"type": "Identifier"
},
"init": {
"commentStart": 49,
"computed": false,
"end": 0,
"object": {
"commentStart": 49,
"end": 0,
"name": "center",
"start": 0,
"type": "Identifier",
"type": "Identifier"
},
"property": {
"commentStart": 56,
"end": 0,
"raw": "0",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.0,
"suffix": "None"
}
},
"start": 0,
"type": "MemberExpression",
"type": "MemberExpression"
},
"start": 0,
"type": "VariableDeclarator"
},
"end": 0,
"kind": "const",
"start": 0,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"commentStart": 61,
"declaration": {
"commentStart": 61,
"end": 0,
"id": {
"commentStart": 61,
"end": 0,
"name": "y",
"start": 0,
"type": "Identifier"
},
"init": {
"commentStart": 65,
"computed": false,
"end": 0,
"object": {
"commentStart": 65,
"end": 0,
"name": "center",
"start": 0,
"type": "Identifier",
"type": "Identifier"
},
"property": {
"commentStart": 72,
"end": 0,
"raw": "1",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 1.0,
"suffix": "None"
}
},
"start": 0,
"type": "MemberExpression",
"type": "MemberExpression"
},
"start": 0,
"type": "VariableDeclarator"
},
"end": 0,
"kind": "const",
"start": 0,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"commentStart": 77,
"declaration": {
"commentStart": 77,
"end": 0,
"id": {
"commentStart": 77,
"end": 0,
"name": "p0",
"start": 0,
"type": "Identifier"
},
"init": {
"commentStart": 82,
"elements": [
{
"commentStart": 83,
"end": 0,
"left": {
"argument": {
"abs_path": false,
"commentStart": 84,
"end": 0,
"name": {
"commentStart": 84,
"end": 0,
"name": "l",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
},
"commentStart": 83,
"end": 0,
"operator": "-",
"start": 0,
"type": "UnaryExpression",
"type": "UnaryExpression"
},
"operator": "+",
"right": {
"abs_path": false,
"commentStart": 88,
"end": 0,
"name": {
"commentStart": 88,
"end": 0,
"name": "x",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
},
"start": 0,
"type": "BinaryExpression",
"type": "BinaryExpression"
},
{
"commentStart": 91,
"end": 0,
"left": {
"argument": {
"abs_path": false,
"commentStart": 92,
"end": 0,
"name": {
"commentStart": 92,
"end": 0,
"name": "l",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
},
"commentStart": 91,
"end": 0,
"operator": "-",
"start": 0,
"type": "UnaryExpression",
"type": "UnaryExpression"
},
"operator": "+",
"right": {
"abs_path": false,
"commentStart": 96,
"end": 0,
"name": {
"commentStart": 96,
"end": 0,
"name": "y",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
},
"start": 0,
"type": "BinaryExpression",
"type": "BinaryExpression"
}
],
"end": 0,
"start": 0,
"type": "ArrayExpression",
"type": "ArrayExpression"
},
"start": 0,
"type": "VariableDeclarator"
},
"end": 0,
"kind": "const",
"start": 0,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"commentStart": 101,
"declaration": {
"commentStart": 101,
"end": 0,
"id": {
"commentStart": 101,
"end": 0,
"name": "p1",
"start": 0,
"type": "Identifier"
},
"init": {
"commentStart": 106,
"elements": [
{
"commentStart": 107,
"end": 0,
"left": {
"argument": {
"abs_path": false,
"commentStart": 108,
"end": 0,
"name": {
"commentStart": 108,
"end": 0,
"name": "l",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
},
"commentStart": 107,
"end": 0,
"operator": "-",
"start": 0,
"type": "UnaryExpression",
"type": "UnaryExpression"
},
"operator": "+",
"right": {
"abs_path": false,
"commentStart": 112,
"end": 0,
"name": {
"commentStart": 112,
"end": 0,
"name": "x",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
},
"start": 0,
"type": "BinaryExpression",
"type": "BinaryExpression"
},
{
"commentStart": 115,
"end": 0,
"left": {
"abs_path": false,
"commentStart": 115,
"end": 0,
"name": {
"commentStart": 115,
"end": 0,
"name": "l",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
},
"operator": "+",
"right": {
"abs_path": false,
"commentStart": 119,
"end": 0,
"name": {
"commentStart": 119,
"end": 0,
"name": "y",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
},
"start": 0,
"type": "BinaryExpression",
"type": "BinaryExpression"
}
],
"end": 0,
"start": 0,
"type": "ArrayExpression",
"type": "ArrayExpression"
},
"start": 0,
"type": "VariableDeclarator"
},
"end": 0,
"kind": "const",
"start": 0,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"commentStart": 124,
"declaration": {
"commentStart": 124,
"end": 0,
"id": {
"commentStart": 124,
"end": 0,
"name": "p2",
"start": 0,
"type": "Identifier"
},
"init": {
"commentStart": 129,
"elements": [
{
"commentStart": 130,
"end": 0,
"left": {
"abs_path": false,
"commentStart": 130,
"end": 0,
"name": {
"commentStart": 130,
"end": 0,
"name": "l",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
},
"operator": "+",
"right": {
"abs_path": false,
"commentStart": 134,
"end": 0,
"name": {
"commentStart": 134,
"end": 0,
"name": "x",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
},
"start": 0,
"type": "BinaryExpression",
"type": "BinaryExpression"
},
{
"commentStart": 137,
"end": 0,
"left": {
"abs_path": false,
"commentStart": 137,
"end": 0,
"name": {
"commentStart": 137,
"end": 0,
"name": "l",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
},
"operator": "+",
"right": {
"abs_path": false,
"commentStart": 141,
"end": 0,
"name": {
"commentStart": 141,
"end": 0,
"name": "y",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
},
"start": 0,
"type": "BinaryExpression",
"type": "BinaryExpression"
}
],
"end": 0,
"start": 0,
"type": "ArrayExpression",
"type": "ArrayExpression"
},
"start": 0,
"type": "VariableDeclarator"
},
"end": 0,
"kind": "const",
"start": 0,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"commentStart": 146,
"declaration": {
"commentStart": 146,
"end": 0,
"id": {
"commentStart": 146,
"end": 0,
"name": "p3",
"start": 0,
"type": "Identifier"
},
"init": {
"commentStart": 151,
"elements": [
{
"commentStart": 152,
"end": 0,
"left": {
"abs_path": false,
"commentStart": 152,
"end": 0,
"name": {
"commentStart": 152,
"end": 0,
"name": "l",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
},
"operator": "+",
"right": {
"abs_path": false,
"commentStart": 156,
"end": 0,
"name": {
"commentStart": 156,
"end": 0,
"name": "x",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
},
"start": 0,
"type": "BinaryExpression",
"type": "BinaryExpression"
},
{
"commentStart": 159,
"end": 0,
"left": {
"argument": {
"abs_path": false,
"commentStart": 160,
"end": 0,
"name": {
"commentStart": 160,
"end": 0,
"name": "l",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
},
"commentStart": 159,
"end": 0,
"operator": "-",
"start": 0,
"type": "UnaryExpression",
"type": "UnaryExpression"
},
"operator": "+",
"right": {
"abs_path": false,
"commentStart": 164,
"end": 0,
"name": {
"commentStart": 164,
"end": 0,
"name": "y",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
},
"start": 0,
"type": "BinaryExpression",
"type": "BinaryExpression"
}
],
"end": 0,
"start": 0,
"type": "ArrayExpression",
"type": "ArrayExpression"
},
"start": 0,
"type": "VariableDeclarator"
},
"end": 0,
"kind": "const",
"start": 0,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"argument": {
"body": [
{
"arguments": [
{
"abs_path": false,
"commentStart": 191,
"end": 0,
"name": {
"commentStart": 191,
"end": 0,
"name": "XY",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
}
],
"callee": {
"abs_path": false,
"commentStart": 177,
"end": 0,
"name": {
"commentStart": 177,
"end": 0,
"name": "startSketchOn",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name"
},
"commentStart": 177,
"end": 0,
"start": 0,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"abs_path": false,
"commentStart": 217,
"end": 0,
"name": {
"commentStart": 217,
"end": 0,
"name": "p0",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
},
{
"commentStart": 221,
"end": 0,
"start": 0,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"abs_path": false,
"commentStart": 202,
"end": 0,
"name": {
"commentStart": 202,
"end": 0,
"name": "startProfileAt",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name"
},
"commentStart": 202,
"end": 0,
"start": 0,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"type": "LabeledArg",
"label": {
"commentStart": 236,
"end": 0,
"name": "endAbsolute",
"start": 0,
"type": "Identifier"
},
"arg": {
"abs_path": false,
"commentStart": 250,
"end": 0,
"name": {
"commentStart": 250,
"end": 0,
"name": "p1",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
}
}
],
"callee": {
"abs_path": false,
"commentStart": 231,
"end": 0,
"name": {
"commentStart": 231,
"end": 0,
"name": "line",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name"
},
"commentStart": 231,
"end": 0,
"start": 0,
"type": "CallExpressionKw",
"type": "CallExpressionKw",
"unlabeled": null
},
{
"arguments": [
{
"type": "LabeledArg",
"label": {
"commentStart": 266,
"end": 0,
"name": "endAbsolute",
"start": 0,
"type": "Identifier"
},
"arg": {
"abs_path": false,
"commentStart": 280,
"end": 0,
"name": {
"commentStart": 280,
"end": 0,
"name": "p2",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
}
}
],
"callee": {
"abs_path": false,
"commentStart": 261,
"end": 0,
"name": {
"commentStart": 261,
"end": 0,
"name": "line",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name"
},
"commentStart": 261,
"end": 0,
"start": 0,
"type": "CallExpressionKw",
"type": "CallExpressionKw",
"unlabeled": null
},
{
"arguments": [
{
"type": "LabeledArg",
"label": {
"commentStart": 296,
"end": 0,
"name": "endAbsolute",
"start": 0,
"type": "Identifier"
},
"arg": {
"abs_path": false,
"commentStart": 310,
"end": 0,
"name": {
"commentStart": 310,
"end": 0,
"name": "p3",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
}
}
],
"callee": {
"abs_path": false,
"commentStart": 291,
"end": 0,
"name": {
"commentStart": 291,
"end": 0,
"name": "line",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name"
},
"commentStart": 291,
"end": 0,
"start": 0,
"type": "CallExpressionKw",
"type": "CallExpressionKw",
"unlabeled": null
},
{
"arguments": [
{
"type": "LabeledArg",
"label": {
"commentStart": 326,
"end": 0,
"name": "endAbsolute",
"start": 0,
"type": "Identifier"
},
"arg": {
"abs_path": false,
"commentStart": 340,
"end": 0,
"name": {
"commentStart": 340,
"end": 0,
"name": "p0",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
}
}
],
"callee": {
"abs_path": false,
"commentStart": 321,
"end": 0,
"name": {
"commentStart": 321,
"end": 0,
"name": "line",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name"
},
"commentStart": 321,
"end": 0,
"start": 0,
"type": "CallExpressionKw",
"type": "CallExpressionKw",
"unlabeled": null
},
{
"arguments": [],
"callee": {
"abs_path": false,
"commentStart": 351,
"end": 0,
"name": {
"commentStart": 351,
"end": 0,
"name": "close",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name"
},
"commentStart": 351,
"end": 0,
"start": 0,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"type": "LabeledArg",
"label": {
"commentStart": 374,
"end": 0,
"name": "length",
"start": 0,
"type": "Identifier"
},
"arg": {
"abs_path": false,
"commentStart": 383,
"end": 0,
"name": {
"commentStart": 383,
"end": 0,
"name": "length",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
}
}
],
"callee": {
"abs_path": false,
"commentStart": 366,
"end": 0,
"name": {
"commentStart": 366,
"end": 0,
"name": "extrude",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name"
},
"commentStart": 366,
"end": 0,
"start": 0,
"type": "CallExpressionKw",
"type": "CallExpressionKw",
"unlabeled": null
}
],
"commentStart": 177,
"end": 0,
"start": 0,
"type": "PipeExpression",
"type": "PipeExpression"
},
"commentStart": 166,
"end": 0,
"start": 0,
"type": "ReturnStatement",
"type": "ReturnStatement"
}
],
"commentStart": 24,
"end": 0,
"nonCodeMeta": {
"nonCodeNodes": {
"6": [
{
"commentStart": 166,
"end": 0,
"start": 0,
"type": "NonCodeNode",
"value": {
"type": "newLine"
}
}
]
},
"startNodes": []
},
"start": 0
},
"commentStart": 7,
"end": 0,
"params": [
{
"type": "Parameter",
"identifier": {
"commentStart": 8,
"end": 0,
"name": "length",
"start": 0,
"type": "Identifier"
}
},
{
"type": "Parameter",
"identifier": {
"commentStart": 16,
"end": 0,
"name": "center",
"start": 0,
"type": "Identifier"
}
}
],
"start": 0,
"type": "FunctionExpression",
"type": "FunctionExpression"
},
"start": 0,
"type": "VariableDeclarator"
},
"end": 0,
"kind": "fn",
"start": 0,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"commentStart": 392,
"declaration": {
"commentStart": 394,
"end": 0,
"id": {
"commentStart": 394,
"end": 0,
"name": "myCube",
"start": 0,
"type": "Identifier"
},
"init": {
"arguments": [
{
"commentStart": 408,
"end": 0,
"raw": "40",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 40.0,
"suffix": "None"
}
},
{
"commentStart": 412,
"elements": [
{
"commentStart": 413,
"end": 0,
"raw": "0",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.0,
"suffix": "None"
}
},
{
"commentStart": 416,
"end": 0,
"raw": "0",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.0,
"suffix": "None"
}
}
],
"end": 0,
"start": 0,
"type": "ArrayExpression",
"type": "ArrayExpression"
}
],
"callee": {
"abs_path": false,
"commentStart": 403,
"end": 0,
"name": {
"commentStart": 403,
"end": 0,
"name": "cube",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name"
},
"commentStart": 403,
"end": 0,
"start": 0,
"type": "CallExpression",
"type": "CallExpression"
},
"start": 0,
"type": "VariableDeclarator"
},
"end": 0,
"kind": "const",
"start": 0,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"commentStart": 419,
"end": 0,
"expression": {
"abs_path": false,
"commentStart": 465,
"end": 0,
"name": {
"commentStart": 465,
"end": 0,
"name": "foo",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
},
"preComments": [
"",
"",
"// Error, after creating meaningful output."
],
"start": 0,
"type": "ExpressionStatement",
"type": "ExpressionStatement"
}
],
"commentStart": 0,
"end": 0,
"nonCodeMeta": {
"nonCodeNodes": {
"0": [
{
"commentStart": 392,
"end": 0,
"start": 0,
"type": "NonCodeNode",
"value": {
"type": "newLine"
}
}
]
},
"startNodes": []
},
"start": 0
}
}