Files
modeling-app/rust/kcl-lib/tests/array_range_expr/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

1167 lines
31 KiB
Plaintext

---
source: kcl-lib/src/simulation_tests.rs
description: Result of parsing array_range_expr.kcl
---
{
"Ok": {
"body": [
{
"commentStart": 0,
"declaration": {
"commentStart": 0,
"end": 0,
"id": {
"commentStart": 0,
"end": 0,
"name": "r1",
"start": 0,
"type": "Identifier"
},
"init": {
"commentStart": 5,
"end": 0,
"endElement": {
"commentStart": 9,
"end": 0,
"raw": "4",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 4.0,
"suffix": "None"
}
},
"endInclusive": true,
"start": 0,
"startElement": {
"commentStart": 6,
"end": 0,
"raw": "0",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.0,
"suffix": "None"
}
},
"type": "ArrayRangeExpression",
"type": "ArrayRangeExpression"
},
"start": 0,
"type": "VariableDeclarator"
},
"end": 0,
"kind": "const",
"start": 0,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"commentStart": 12,
"end": 0,
"expression": {
"arguments": [
{
"commentStart": 24,
"computed": false,
"end": 0,
"object": {
"commentStart": 24,
"end": 0,
"name": "r1",
"start": 0,
"type": "Identifier",
"type": "Identifier"
},
"property": {
"commentStart": 27,
"end": 0,
"raw": "4",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 4.0,
"suffix": "None"
}
},
"start": 0,
"type": "MemberExpression",
"type": "MemberExpression"
},
{
"commentStart": 31,
"end": 0,
"raw": "4",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 4.0,
"suffix": "None"
}
},
{
"commentStart": 34,
"end": 0,
"raw": "0.00001",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.00001,
"suffix": "None"
}
},
{
"commentStart": 43,
"end": 0,
"raw": "\"last element is included\"",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": "last element is included"
}
],
"callee": {
"abs_path": false,
"commentStart": 12,
"end": 0,
"name": {
"commentStart": 12,
"end": 0,
"name": "assertEqual",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name"
},
"commentStart": 12,
"end": 0,
"start": 0,
"type": "CallExpression",
"type": "CallExpression"
},
"start": 0,
"type": "ExpressionStatement",
"type": "ExpressionStatement"
},
{
"commentStart": 70,
"declaration": {
"commentStart": 72,
"end": 0,
"id": {
"commentStart": 72,
"end": 0,
"name": "four",
"start": 0,
"type": "Identifier"
},
"init": {
"commentStart": 79,
"end": 0,
"raw": "4",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 4.0,
"suffix": "None"
}
},
"start": 0,
"type": "VariableDeclarator"
},
"end": 0,
"kind": "const",
"start": 0,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"commentStart": 81,
"declaration": {
"commentStart": 81,
"end": 0,
"id": {
"commentStart": 81,
"end": 0,
"name": "zero",
"start": 0,
"type": "Identifier"
},
"init": {
"commentStart": 88,
"end": 0,
"raw": "0",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.0,
"suffix": "None"
}
},
"start": 0,
"type": "VariableDeclarator"
},
"end": 0,
"kind": "const",
"start": 0,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"commentStart": 90,
"declaration": {
"commentStart": 90,
"end": 0,
"id": {
"commentStart": 90,
"end": 0,
"name": "r2",
"start": 0,
"type": "Identifier"
},
"init": {
"commentStart": 95,
"end": 0,
"endElement": {
"abs_path": false,
"commentStart": 102,
"end": 0,
"name": {
"commentStart": 102,
"end": 0,
"name": "four",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
},
"endInclusive": true,
"start": 0,
"startElement": {
"abs_path": false,
"commentStart": 96,
"end": 0,
"name": {
"commentStart": 96,
"end": 0,
"name": "zero",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
},
"type": "ArrayRangeExpression",
"type": "ArrayRangeExpression"
},
"start": 0,
"type": "VariableDeclarator"
},
"end": 0,
"kind": "const",
"start": 0,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"commentStart": 108,
"end": 0,
"expression": {
"arguments": [
{
"commentStart": 120,
"computed": false,
"end": 0,
"object": {
"commentStart": 120,
"end": 0,
"name": "r2",
"start": 0,
"type": "Identifier",
"type": "Identifier"
},
"property": {
"commentStart": 123,
"end": 0,
"raw": "4",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 4.0,
"suffix": "None"
}
},
"start": 0,
"type": "MemberExpression",
"type": "MemberExpression"
},
{
"commentStart": 127,
"end": 0,
"raw": "4",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 4.0,
"suffix": "None"
}
},
{
"commentStart": 130,
"end": 0,
"raw": "0.00001",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.00001,
"suffix": "None"
}
},
{
"commentStart": 139,
"end": 0,
"raw": "\"last element is included\"",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": "last element is included"
}
],
"callee": {
"abs_path": false,
"commentStart": 108,
"end": 0,
"name": {
"commentStart": 108,
"end": 0,
"name": "assertEqual",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name"
},
"commentStart": 108,
"end": 0,
"start": 0,
"type": "CallExpression",
"type": "CallExpression"
},
"start": 0,
"type": "ExpressionStatement",
"type": "ExpressionStatement"
},
{
"commentStart": 166,
"declaration": {
"commentStart": 168,
"end": 0,
"id": {
"commentStart": 168,
"end": 0,
"name": "five",
"start": 0,
"type": "Identifier"
},
"init": {
"arguments": [
{
"commentStart": 179,
"end": 0,
"left": {
"abs_path": false,
"commentStart": 179,
"end": 0,
"name": {
"commentStart": 179,
"end": 0,
"name": "four",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
},
"operator": "+",
"right": {
"commentStart": 186,
"end": 0,
"raw": "1",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 1.0,
"suffix": "None"
}
},
"start": 0,
"type": "BinaryExpression",
"type": "BinaryExpression"
}
],
"callee": {
"abs_path": false,
"commentStart": 175,
"end": 0,
"name": {
"commentStart": 175,
"end": 0,
"name": "int",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name"
},
"commentStart": 175,
"end": 0,
"start": 0,
"type": "CallExpression",
"type": "CallExpression"
},
"start": 0,
"type": "VariableDeclarator"
},
"end": 0,
"kind": "const",
"start": 0,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"commentStart": 189,
"declaration": {
"commentStart": 189,
"end": 0,
"id": {
"commentStart": 189,
"end": 0,
"name": "r3",
"start": 0,
"type": "Identifier"
},
"init": {
"commentStart": 194,
"end": 0,
"endElement": {
"abs_path": false,
"commentStart": 201,
"end": 0,
"name": {
"commentStart": 201,
"end": 0,
"name": "five",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
},
"endInclusive": true,
"start": 0,
"startElement": {
"abs_path": false,
"commentStart": 195,
"end": 0,
"name": {
"commentStart": 195,
"end": 0,
"name": "zero",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
},
"type": "ArrayRangeExpression",
"type": "ArrayRangeExpression"
},
"start": 0,
"type": "VariableDeclarator"
},
"end": 0,
"kind": "const",
"start": 0,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"commentStart": 207,
"end": 0,
"expression": {
"arguments": [
{
"commentStart": 219,
"computed": false,
"end": 0,
"object": {
"commentStart": 219,
"end": 0,
"name": "r3",
"start": 0,
"type": "Identifier",
"type": "Identifier"
},
"property": {
"commentStart": 222,
"end": 0,
"raw": "4",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 4.0,
"suffix": "None"
}
},
"start": 0,
"type": "MemberExpression",
"type": "MemberExpression"
},
{
"commentStart": 226,
"end": 0,
"raw": "4",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 4.0,
"suffix": "None"
}
},
{
"commentStart": 229,
"end": 0,
"raw": "0.00001",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.00001,
"suffix": "None"
}
},
{
"commentStart": 238,
"end": 0,
"raw": "\"second-to-last element is included\"",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": "second-to-last element is included"
}
],
"callee": {
"abs_path": false,
"commentStart": 207,
"end": 0,
"name": {
"commentStart": 207,
"end": 0,
"name": "assertEqual",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name"
},
"commentStart": 207,
"end": 0,
"start": 0,
"type": "CallExpression",
"type": "CallExpression"
},
"start": 0,
"type": "ExpressionStatement",
"type": "ExpressionStatement"
},
{
"commentStart": 276,
"end": 0,
"expression": {
"arguments": [
{
"commentStart": 288,
"computed": false,
"end": 0,
"object": {
"commentStart": 288,
"end": 0,
"name": "r3",
"start": 0,
"type": "Identifier",
"type": "Identifier"
},
"property": {
"commentStart": 291,
"end": 0,
"raw": "5",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 5.0,
"suffix": "None"
}
},
"start": 0,
"type": "MemberExpression",
"type": "MemberExpression"
},
{
"commentStart": 295,
"end": 0,
"raw": "5",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 5.0,
"suffix": "None"
}
},
{
"commentStart": 298,
"end": 0,
"raw": "0.00001",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.00001,
"suffix": "None"
}
},
{
"commentStart": 307,
"end": 0,
"raw": "\"last element is included\"",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": "last element is included"
}
],
"callee": {
"abs_path": false,
"commentStart": 276,
"end": 0,
"name": {
"commentStart": 276,
"end": 0,
"name": "assertEqual",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name"
},
"commentStart": 276,
"end": 0,
"start": 0,
"type": "CallExpression",
"type": "CallExpression"
},
"start": 0,
"type": "ExpressionStatement",
"type": "ExpressionStatement"
},
{
"commentStart": 334,
"declaration": {
"commentStart": 336,
"end": 0,
"id": {
"commentStart": 336,
"end": 0,
"name": "r4",
"start": 0,
"type": "Identifier"
},
"init": {
"commentStart": 341,
"end": 0,
"endElement": {
"arguments": [
{
"commentStart": 363,
"end": 0,
"left": {
"abs_path": false,
"commentStart": 363,
"end": 0,
"name": {
"commentStart": 363,
"end": 0,
"name": "five",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
},
"operator": "-",
"right": {
"commentStart": 370,
"end": 0,
"raw": "1",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 1.0,
"suffix": "None"
}
},
"start": 0,
"type": "BinaryExpression",
"type": "BinaryExpression"
}
],
"callee": {
"abs_path": false,
"commentStart": 359,
"end": 0,
"name": {
"commentStart": 359,
"end": 0,
"name": "int",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name"
},
"commentStart": 359,
"end": 0,
"start": 0,
"type": "CallExpression",
"type": "CallExpression"
},
"endInclusive": true,
"start": 0,
"startElement": {
"arguments": [
{
"commentStart": 346,
"end": 0,
"left": {
"abs_path": false,
"commentStart": 346,
"end": 0,
"name": {
"commentStart": 346,
"end": 0,
"name": "zero",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
},
"operator": "+",
"right": {
"commentStart": 353,
"end": 0,
"raw": "1",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 1.0,
"suffix": "None"
}
},
"start": 0,
"type": "BinaryExpression",
"type": "BinaryExpression"
}
],
"callee": {
"abs_path": false,
"commentStart": 342,
"end": 0,
"name": {
"commentStart": 342,
"end": 0,
"name": "int",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name"
},
"commentStart": 342,
"end": 0,
"start": 0,
"type": "CallExpression",
"type": "CallExpression"
},
"type": "ArrayRangeExpression",
"type": "ArrayRangeExpression"
},
"start": 0,
"type": "VariableDeclarator"
},
"end": 0,
"kind": "const",
"start": 0,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"commentStart": 374,
"end": 0,
"expression": {
"arguments": [
{
"commentStart": 386,
"computed": false,
"end": 0,
"object": {
"commentStart": 386,
"end": 0,
"name": "r4",
"start": 0,
"type": "Identifier",
"type": "Identifier"
},
"property": {
"commentStart": 389,
"end": 0,
"raw": "0",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.0,
"suffix": "None"
}
},
"start": 0,
"type": "MemberExpression",
"type": "MemberExpression"
},
{
"commentStart": 393,
"end": 0,
"raw": "1",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 1.0,
"suffix": "None"
}
},
{
"commentStart": 396,
"end": 0,
"raw": "0.00001",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.00001,
"suffix": "None"
}
},
{
"commentStart": 405,
"end": 0,
"raw": "\"first element is 1\"",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": "first element is 1"
}
],
"callee": {
"abs_path": false,
"commentStart": 374,
"end": 0,
"name": {
"commentStart": 374,
"end": 0,
"name": "assertEqual",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name"
},
"commentStart": 374,
"end": 0,
"start": 0,
"type": "CallExpression",
"type": "CallExpression"
},
"start": 0,
"type": "ExpressionStatement",
"type": "ExpressionStatement"
},
{
"commentStart": 427,
"end": 0,
"expression": {
"arguments": [
{
"commentStart": 439,
"computed": false,
"end": 0,
"object": {
"commentStart": 439,
"end": 0,
"name": "r4",
"start": 0,
"type": "Identifier",
"type": "Identifier"
},
"property": {
"commentStart": 442,
"end": 0,
"raw": "2",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 2.0,
"suffix": "None"
}
},
"start": 0,
"type": "MemberExpression",
"type": "MemberExpression"
},
{
"commentStart": 446,
"end": 0,
"raw": "3",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 3.0,
"suffix": "None"
}
},
{
"commentStart": 449,
"end": 0,
"raw": "0.00001",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.00001,
"suffix": "None"
}
},
{
"commentStart": 458,
"end": 0,
"raw": "\"second-to-last element is 3\"",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": "second-to-last element is 3"
}
],
"callee": {
"abs_path": false,
"commentStart": 427,
"end": 0,
"name": {
"commentStart": 427,
"end": 0,
"name": "assertEqual",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name"
},
"commentStart": 427,
"end": 0,
"start": 0,
"type": "CallExpression",
"type": "CallExpression"
},
"start": 0,
"type": "ExpressionStatement",
"type": "ExpressionStatement"
},
{
"commentStart": 489,
"end": 0,
"expression": {
"arguments": [
{
"commentStart": 501,
"computed": false,
"end": 0,
"object": {
"commentStart": 501,
"end": 0,
"name": "r4",
"start": 0,
"type": "Identifier",
"type": "Identifier"
},
"property": {
"commentStart": 504,
"end": 0,
"raw": "3",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 3.0,
"suffix": "None"
}
},
"start": 0,
"type": "MemberExpression",
"type": "MemberExpression"
},
{
"commentStart": 508,
"end": 0,
"raw": "4",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 4.0,
"suffix": "None"
}
},
{
"commentStart": 511,
"end": 0,
"raw": "0.00001",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.00001,
"suffix": "None"
}
},
{
"commentStart": 520,
"end": 0,
"raw": "\"last element is 4\"",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": "last element is 4"
}
],
"callee": {
"abs_path": false,
"commentStart": 489,
"end": 0,
"name": {
"commentStart": 489,
"end": 0,
"name": "assertEqual",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name"
},
"commentStart": 489,
"end": 0,
"start": 0,
"type": "CallExpression",
"type": "CallExpression"
},
"start": 0,
"type": "ExpressionStatement",
"type": "ExpressionStatement"
}
],
"commentStart": 0,
"end": 0,
"nonCodeMeta": {
"nonCodeNodes": {
"1": [
{
"commentStart": 70,
"end": 0,
"start": 0,
"type": "NonCodeNode",
"value": {
"type": "newLine"
}
}
],
"5": [
{
"commentStart": 166,
"end": 0,
"start": 0,
"type": "NonCodeNode",
"value": {
"type": "newLine"
}
}
],
"9": [
{
"commentStart": 334,
"end": 0,
"start": 0,
"type": "NonCodeNode",
"value": {
"type": "newLine"
}
}
]
},
"startNodes": []
},
"start": 0
}
}