2024-12-06 15:44:39 -06:00
|
|
|
---
|
2025-03-04 22:53:31 +13:00
|
|
|
source: kcl-lib/src/simulation_tests.rs
|
2024-12-06 15:44:39 -06:00
|
|
|
description: Result of parsing kw_fn.kcl
|
|
|
|
---
|
|
|
|
{
|
|
|
|
"Ok": {
|
|
|
|
"body": [
|
|
|
|
{
|
|
|
|
"declaration": {
|
|
|
|
"end": 35,
|
|
|
|
"id": {
|
|
|
|
"end": 12,
|
|
|
|
"name": "increment",
|
|
|
|
"start": 3,
|
|
|
|
"type": "Identifier"
|
|
|
|
},
|
|
|
|
"init": {
|
|
|
|
"body": {
|
|
|
|
"body": [
|
|
|
|
{
|
|
|
|
"argument": {
|
|
|
|
"end": 33,
|
|
|
|
"left": {
|
|
|
|
"end": 29,
|
|
|
|
"name": "x",
|
|
|
|
"start": 28,
|
|
|
|
"type": "Identifier",
|
|
|
|
"type": "Identifier"
|
|
|
|
},
|
|
|
|
"operator": "+",
|
|
|
|
"right": {
|
|
|
|
"end": 33,
|
|
|
|
"raw": "1",
|
|
|
|
"start": 32,
|
|
|
|
"type": "Literal",
|
|
|
|
"type": "Literal",
|
2025-01-22 08:29:30 +13:00
|
|
|
"value": {
|
|
|
|
"value": 1.0,
|
|
|
|
"suffix": "None"
|
|
|
|
}
|
2024-12-06 15:44:39 -06:00
|
|
|
},
|
|
|
|
"start": 28,
|
|
|
|
"type": "BinaryExpression",
|
|
|
|
"type": "BinaryExpression"
|
|
|
|
},
|
|
|
|
"end": 33,
|
|
|
|
"start": 21,
|
|
|
|
"type": "ReturnStatement",
|
|
|
|
"type": "ReturnStatement"
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"end": 35,
|
|
|
|
"start": 17
|
|
|
|
},
|
|
|
|
"end": 35,
|
|
|
|
"params": [
|
|
|
|
{
|
|
|
|
"type": "Parameter",
|
|
|
|
"identifier": {
|
|
|
|
"end": 15,
|
|
|
|
"name": "x",
|
|
|
|
"start": 14,
|
|
|
|
"type": "Identifier"
|
|
|
|
},
|
|
|
|
"labeled": false
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"start": 12,
|
|
|
|
"type": "FunctionExpression",
|
|
|
|
"type": "FunctionExpression"
|
|
|
|
},
|
|
|
|
"start": 3,
|
|
|
|
"type": "VariableDeclarator"
|
|
|
|
},
|
|
|
|
"end": 35,
|
|
|
|
"kind": "fn",
|
|
|
|
"start": 0,
|
|
|
|
"type": "VariableDeclaration",
|
|
|
|
"type": "VariableDeclaration"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"declaration": {
|
2024-12-09 22:11:16 -06:00
|
|
|
"end": 77,
|
2024-12-06 15:44:39 -06:00
|
|
|
"id": {
|
2024-12-09 22:11:16 -06:00
|
|
|
"end": 43,
|
|
|
|
"name": "add",
|
|
|
|
"start": 40,
|
|
|
|
"type": "Identifier"
|
|
|
|
},
|
|
|
|
"init": {
|
|
|
|
"body": {
|
|
|
|
"body": [
|
|
|
|
{
|
|
|
|
"argument": {
|
|
|
|
"end": 75,
|
|
|
|
"left": {
|
|
|
|
"end": 67,
|
|
|
|
"name": "x",
|
|
|
|
"start": 66,
|
|
|
|
"type": "Identifier",
|
|
|
|
"type": "Identifier"
|
|
|
|
},
|
|
|
|
"operator": "+",
|
|
|
|
"right": {
|
|
|
|
"end": 75,
|
|
|
|
"name": "delta",
|
|
|
|
"start": 70,
|
|
|
|
"type": "Identifier",
|
|
|
|
"type": "Identifier"
|
|
|
|
},
|
|
|
|
"start": 66,
|
|
|
|
"type": "BinaryExpression",
|
|
|
|
"type": "BinaryExpression"
|
|
|
|
},
|
|
|
|
"end": 75,
|
|
|
|
"start": 59,
|
|
|
|
"type": "ReturnStatement",
|
|
|
|
"type": "ReturnStatement"
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"end": 77,
|
|
|
|
"start": 55
|
|
|
|
},
|
|
|
|
"end": 77,
|
|
|
|
"params": [
|
|
|
|
{
|
|
|
|
"type": "Parameter",
|
|
|
|
"identifier": {
|
|
|
|
"end": 46,
|
|
|
|
"name": "x",
|
|
|
|
"start": 45,
|
|
|
|
"type": "Identifier"
|
|
|
|
},
|
|
|
|
"labeled": false
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"type": "Parameter",
|
|
|
|
"identifier": {
|
|
|
|
"end": 53,
|
|
|
|
"name": "delta",
|
|
|
|
"start": 48,
|
|
|
|
"type": "Identifier"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"start": 43,
|
|
|
|
"type": "FunctionExpression",
|
|
|
|
"type": "FunctionExpression"
|
|
|
|
},
|
|
|
|
"start": 40,
|
|
|
|
"type": "VariableDeclarator"
|
|
|
|
},
|
|
|
|
"end": 77,
|
|
|
|
"kind": "fn",
|
|
|
|
"start": 37,
|
|
|
|
"type": "VariableDeclaration",
|
|
|
|
"type": "VariableDeclaration"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"declaration": {
|
|
|
|
"end": 97,
|
|
|
|
"id": {
|
|
|
|
"end": 82,
|
2024-12-06 15:44:39 -06:00
|
|
|
"name": "two",
|
2024-12-09 22:11:16 -06:00
|
|
|
"start": 79,
|
2024-12-06 15:44:39 -06:00
|
|
|
"type": "Identifier"
|
|
|
|
},
|
|
|
|
"init": {
|
|
|
|
"arguments": [
|
|
|
|
{
|
2024-12-09 22:11:16 -06:00
|
|
|
"end": 96,
|
2024-12-06 15:44:39 -06:00
|
|
|
"raw": "1",
|
2024-12-09 22:11:16 -06:00
|
|
|
"start": 95,
|
2024-12-06 15:44:39 -06:00
|
|
|
"type": "Literal",
|
|
|
|
"type": "Literal",
|
2025-01-22 08:29:30 +13:00
|
|
|
"value": {
|
|
|
|
"value": 1.0,
|
|
|
|
"suffix": "None"
|
|
|
|
}
|
2024-12-06 15:44:39 -06:00
|
|
|
}
|
|
|
|
],
|
|
|
|
"callee": {
|
2024-12-09 22:11:16 -06:00
|
|
|
"end": 94,
|
2024-12-06 15:44:39 -06:00
|
|
|
"name": "increment",
|
2024-12-09 22:11:16 -06:00
|
|
|
"start": 85,
|
2024-12-06 15:44:39 -06:00
|
|
|
"type": "Identifier"
|
|
|
|
},
|
2024-12-09 22:11:16 -06:00
|
|
|
"end": 97,
|
|
|
|
"start": 85,
|
2024-12-06 15:44:39 -06:00
|
|
|
"type": "CallExpression",
|
|
|
|
"type": "CallExpression"
|
|
|
|
},
|
2024-12-09 22:11:16 -06:00
|
|
|
"start": 79,
|
2024-12-06 15:44:39 -06:00
|
|
|
"type": "VariableDeclarator"
|
|
|
|
},
|
2024-12-09 22:11:16 -06:00
|
|
|
"end": 97,
|
2024-12-06 15:44:39 -06:00
|
|
|
"kind": "const",
|
2024-12-09 22:11:16 -06:00
|
|
|
"start": 79,
|
|
|
|
"type": "VariableDeclaration",
|
|
|
|
"type": "VariableDeclaration"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"declaration": {
|
2024-12-12 11:53:35 -06:00
|
|
|
"end": 123,
|
2024-12-09 22:11:16 -06:00
|
|
|
"id": {
|
|
|
|
"end": 103,
|
|
|
|
"name": "three",
|
|
|
|
"start": 98,
|
|
|
|
"type": "Identifier"
|
|
|
|
},
|
|
|
|
"init": {
|
|
|
|
"arguments": [
|
|
|
|
{
|
|
|
|
"type": "LabeledArg",
|
|
|
|
"label": {
|
2025-03-04 22:53:31 +13:00
|
|
|
"end": 118,
|
|
|
|
"name": "delta",
|
|
|
|
"start": 113,
|
|
|
|
"type": "Identifier"
|
2024-12-09 22:11:16 -06:00
|
|
|
},
|
|
|
|
"arg": {
|
2024-12-12 11:53:35 -06:00
|
|
|
"end": 122,
|
2024-12-09 22:11:16 -06:00
|
|
|
"raw": "2",
|
2024-12-12 11:53:35 -06:00
|
|
|
"start": 121,
|
2024-12-09 22:11:16 -06:00
|
|
|
"type": "Literal",
|
|
|
|
"type": "Literal",
|
2025-01-22 08:29:30 +13:00
|
|
|
"value": {
|
|
|
|
"value": 2.0,
|
|
|
|
"suffix": "None"
|
|
|
|
}
|
2024-12-09 22:11:16 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"callee": {
|
|
|
|
"end": 109,
|
|
|
|
"name": "add",
|
|
|
|
"start": 106,
|
|
|
|
"type": "Identifier"
|
|
|
|
},
|
2024-12-12 11:53:35 -06:00
|
|
|
"end": 123,
|
2024-12-09 22:11:16 -06:00
|
|
|
"start": 106,
|
|
|
|
"type": "CallExpressionKw",
|
|
|
|
"type": "CallExpressionKw",
|
|
|
|
"unlabeled": {
|
|
|
|
"end": 111,
|
|
|
|
"raw": "1",
|
|
|
|
"start": 110,
|
|
|
|
"type": "Literal",
|
|
|
|
"type": "Literal",
|
2025-01-22 08:29:30 +13:00
|
|
|
"value": {
|
|
|
|
"value": 1.0,
|
|
|
|
"suffix": "None"
|
|
|
|
}
|
2024-12-09 22:11:16 -06:00
|
|
|
}
|
|
|
|
},
|
|
|
|
"start": 98,
|
|
|
|
"type": "VariableDeclarator"
|
|
|
|
},
|
2024-12-12 11:53:35 -06:00
|
|
|
"end": 123,
|
2024-12-09 22:11:16 -06:00
|
|
|
"kind": "const",
|
|
|
|
"start": 98,
|
2024-12-06 15:44:39 -06:00
|
|
|
"type": "VariableDeclaration",
|
|
|
|
"type": "VariableDeclaration"
|
|
|
|
}
|
|
|
|
],
|
2024-12-12 11:53:35 -06:00
|
|
|
"end": 124,
|
2024-12-06 15:44:39 -06:00
|
|
|
"nonCodeMeta": {
|
|
|
|
"nonCodeNodes": {
|
|
|
|
"0": [
|
|
|
|
{
|
|
|
|
"end": 37,
|
|
|
|
"start": 35,
|
|
|
|
"type": "NonCodeNode",
|
|
|
|
"value": {
|
|
|
|
"type": "newLine"
|
|
|
|
}
|
|
|
|
}
|
2024-12-09 22:11:16 -06:00
|
|
|
],
|
|
|
|
"1": [
|
|
|
|
{
|
|
|
|
"end": 79,
|
|
|
|
"start": 77,
|
|
|
|
"type": "NonCodeNode",
|
|
|
|
"value": {
|
|
|
|
"type": "newLine"
|
|
|
|
}
|
|
|
|
}
|
2024-12-06 15:44:39 -06:00
|
|
|
]
|
|
|
|
},
|
|
|
|
"startNodes": []
|
|
|
|
},
|
|
|
|
"start": 0
|
|
|
|
}
|
|
|
|
}
|