Files
modeling-app/rust/kcl-lib/tests/index_of_array/ast.snap

483 lines
12 KiB
Plaintext
Raw Normal View History

---
source: kcl/src/simulation_tests.rs
description: Result of parsing index_of_array.kcl
---
{
"Ok": {
"body": [
{
"declaration": {
"end": 53,
"id": {
"end": 38,
"name": "arr",
"start": 35,
"type": "Identifier"
},
"init": {
"elements": [
{
"end": 44,
"raw": "90",
"start": 42,
"type": "Literal",
"type": "Literal",
"value": {
"value": 90.0,
"suffix": "None"
}
},
{
"end": 48,
"raw": "91",
"start": 46,
"type": "Literal",
"type": "Literal",
"value": {
"value": 91.0,
"suffix": "None"
}
},
{
"end": 52,
"raw": "92",
"start": 50,
"type": "Literal",
"type": "Literal",
"value": {
"value": 92.0,
"suffix": "None"
}
}
],
"end": 53,
"start": 41,
"type": "ArrayExpression",
"type": "ArrayExpression"
},
"start": 35,
"type": "VariableDeclarator"
},
"end": 53,
"kind": "const",
"start": 35,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"declaration": {
"end": 97,
"id": {
"end": 88,
"name": "result0",
"start": 81,
"type": "Identifier"
},
"init": {
"computed": false,
"end": 97,
"object": {
"end": 94,
"name": "arr",
"start": 91,
"type": "Identifier",
"type": "Identifier"
},
"property": {
"end": 96,
"raw": "1",
"start": 95,
"type": "Literal",
"type": "Literal",
"value": {
"value": 1.0,
"suffix": "None"
}
},
"start": 91,
"type": "MemberExpression",
"type": "MemberExpression"
},
"start": 81,
"type": "VariableDeclarator"
},
"end": 97,
"kind": "const",
"start": 81,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"end": 157,
"expression": {
"arguments": [
{
"end": 125,
"name": "result0",
"start": 118,
"type": "Identifier",
"type": "Identifier"
},
{
"end": 129,
"raw": "91",
"start": 127,
"type": "Literal",
"type": "Literal",
"value": {
"value": 91.0,
"suffix": "None"
}
},
{
"end": 156,
"raw": "\"Literal property lookup\"",
"start": 131,
"type": "Literal",
"type": "Literal",
"value": "Literal property lookup"
}
],
"callee": {
"end": 117,
"name": "assertLessThanOrEq",
"start": 99,
"type": "Identifier"
},
"end": 157,
"start": 99,
"type": "CallExpression",
"type": "CallExpression"
},
"start": 99,
"type": "ExpressionStatement",
"type": "ExpressionStatement"
},
{
"end": 219,
"expression": {
"arguments": [
{
"end": 187,
"name": "result0",
"start": 180,
"type": "Identifier",
"type": "Identifier"
},
{
"end": 191,
"raw": "91",
"start": 189,
"type": "Literal",
"type": "Literal",
"value": {
"value": 91.0,
"suffix": "None"
}
},
{
"end": 218,
"raw": "\"Literal property lookup\"",
"start": 193,
"type": "Literal",
"type": "Literal",
"value": "Literal property lookup"
}
],
"callee": {
"end": 179,
"name": "assertGreaterThanOrEq",
"start": 158,
"type": "Identifier"
},
"end": 219,
"start": 158,
"type": "CallExpression",
"type": "CallExpression"
},
"start": 158,
"type": "ExpressionStatement",
"type": "ExpressionStatement"
},
{
"declaration": {
"end": 262,
"id": {
"end": 249,
"name": "i",
"start": 248,
"type": "Identifier"
},
"init": {
"arguments": [
{
"end": 261,
"left": {
"end": 257,
"raw": "1",
"start": 256,
"type": "Literal",
"type": "Literal",
"value": {
"value": 1.0,
"suffix": "None"
}
},
"operator": "+",
"right": {
"end": 261,
"raw": "0",
"start": 260,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.0,
"suffix": "None"
}
},
"start": 256,
"type": "BinaryExpression",
"type": "BinaryExpression"
}
],
"callee": {
"end": 255,
"name": "int",
"start": 252,
"type": "Identifier"
},
"end": 262,
"start": 252,
"type": "CallExpression",
"type": "CallExpression"
},
"start": 248,
"type": "VariableDeclarator"
},
"end": 262,
"kind": "const",
"start": 248,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"declaration": {
"end": 279,
"id": {
"end": 270,
"name": "result1",
"start": 263,
"type": "Identifier"
},
"init": {
"computed": true,
"end": 279,
"object": {
"end": 276,
"name": "arr",
"start": 273,
"type": "Identifier",
"type": "Identifier"
},
"property": {
"end": 278,
"name": "i",
"start": 277,
"type": "Identifier",
"type": "Identifier"
},
"start": 273,
"type": "MemberExpression",
"type": "MemberExpression"
},
"start": 263,
"type": "VariableDeclarator"
},
"end": 279,
"kind": "const",
"start": 263,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"end": 340,
"expression": {
"arguments": [
{
"end": 307,
"name": "result1",
"start": 300,
"type": "Identifier",
"type": "Identifier"
},
{
"end": 311,
"raw": "91",
"start": 309,
"type": "Literal",
"type": "Literal",
"value": {
"value": 91.0,
"suffix": "None"
}
},
{
"end": 339,
"raw": "\"Computed property lookup\"",
"start": 313,
"type": "Literal",
"type": "Literal",
"value": "Computed property lookup"
}
],
"callee": {
"end": 299,
"name": "assertLessThanOrEq",
"start": 281,
"type": "Identifier"
},
"end": 340,
"start": 281,
"type": "CallExpression",
"type": "CallExpression"
},
"start": 281,
"type": "ExpressionStatement",
"type": "ExpressionStatement"
},
{
"end": 403,
"expression": {
"arguments": [
{
"end": 370,
"name": "result1",
"start": 363,
"type": "Identifier",
"type": "Identifier"
},
{
"end": 374,
"raw": "91",
"start": 372,
"type": "Literal",
"type": "Literal",
"value": {
"value": 91.0,
"suffix": "None"
}
},
{
"end": 402,
"raw": "\"Computed property lookup\"",
"start": 376,
"type": "Literal",
"type": "Literal",
"value": "Computed property lookup"
}
],
"callee": {
"end": 362,
"name": "assertGreaterThanOrEq",
"start": 341,
"type": "Identifier"
},
"end": 403,
"start": 341,
"type": "CallExpression",
"type": "CallExpression"
},
"start": 341,
"type": "ExpressionStatement",
"type": "ExpressionStatement"
}
],
"end": 404,
"nonCodeMeta": {
"nonCodeNodes": {
"0": [
{
"end": 78,
"start": 53,
"type": "NonCodeNode",
"value": {
"type": "newLineBlockComment",
"value": "Test: literal index.",
"style": "line"
}
},
{
"end": 81,
"start": 78,
"type": "NonCodeNode",
"value": {
"type": "newLine"
}
}
],
"1": [
{
"end": 99,
"start": 97,
"type": "NonCodeNode",
"value": {
"type": "newLine"
}
}
],
"3": [
{
"end": 245,
"start": 219,
"type": "NonCodeNode",
"value": {
"type": "newLineBlockComment",
"value": "Test: computed index.",
"style": "line"
}
},
{
"end": 248,
"start": 245,
"type": "NonCodeNode",
"value": {
"type": "newLine"
}
}
],
"5": [
{
"end": 281,
"start": 279,
"type": "NonCodeNode",
"value": {
"type": "newLine"
}
}
]
},
"startNodes": [
{
"end": 32,
"start": 0,
"type": "NonCodeNode",
"value": {
"type": "blockComment",
"value": "This tests indexing an array.",
"style": "line"
}
},
{
"end": 35,
"start": 32,
"type": "NonCodeNode",
"value": {
"type": "newLine"
}
}
]
},
"start": 0
}
}