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