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

333 lines
8.7 KiB
Plaintext
Raw Normal View History

---
source: kcl-lib/src/simulation_tests.rs
description: Result of parsing kw_fn.kcl
---
{
"Ok": {
"body": [
{
"commentStart": 0,
"declaration": {
"commentStart": 3,
"end": 0,
"id": {
"commentStart": 3,
"end": 0,
"name": "increment",
"start": 0,
"type": "Identifier"
},
"init": {
"body": {
"body": [
{
"argument": {
"commentStart": 28,
"end": 0,
"left": {
"commentStart": 28,
"end": 0,
"name": "x",
"start": 0,
"type": "Identifier",
"type": "Identifier"
},
"operator": "+",
"right": {
"commentStart": 32,
"end": 0,
"raw": "1",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 1.0,
"suffix": "None"
}
},
"start": 0,
"type": "BinaryExpression",
"type": "BinaryExpression"
},
"commentStart": 21,
"end": 0,
"start": 0,
"type": "ReturnStatement",
"type": "ReturnStatement"
}
],
"commentStart": 17,
"end": 0,
"start": 0
},
"commentStart": 12,
"end": 0,
"params": [
{
"type": "Parameter",
"identifier": {
"commentStart": 14,
"end": 0,
"name": "x",
"start": 0,
"type": "Identifier"
},
"labeled": false
}
],
"start": 0,
"type": "FunctionExpression",
"type": "FunctionExpression"
},
"start": 0,
"type": "VariableDeclarator"
},
"end": 0,
"kind": "fn",
"start": 0,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"commentStart": 35,
"declaration": {
"commentStart": 40,
"end": 0,
"id": {
"commentStart": 40,
"end": 0,
"name": "add",
"start": 0,
"type": "Identifier"
},
"init": {
"body": {
"body": [
{
"argument": {
"commentStart": 66,
"end": 0,
"left": {
"commentStart": 66,
"end": 0,
"name": "x",
"start": 0,
"type": "Identifier",
"type": "Identifier"
},
"operator": "+",
"right": {
"commentStart": 70,
"end": 0,
"name": "delta",
"start": 0,
"type": "Identifier",
"type": "Identifier"
},
"start": 0,
"type": "BinaryExpression",
"type": "BinaryExpression"
},
"commentStart": 59,
"end": 0,
"start": 0,
"type": "ReturnStatement",
"type": "ReturnStatement"
}
],
"commentStart": 55,
"end": 0,
"start": 0
},
"commentStart": 43,
"end": 0,
"params": [
{
"type": "Parameter",
"identifier": {
"commentStart": 45,
"end": 0,
"name": "x",
"start": 0,
"type": "Identifier"
},
"labeled": false
},
{
"type": "Parameter",
"identifier": {
"commentStart": 48,
"end": 0,
"name": "delta",
"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": 77,
"declaration": {
"commentStart": 79,
"end": 0,
"id": {
"commentStart": 79,
"end": 0,
"name": "two",
"start": 0,
"type": "Identifier"
},
"init": {
"arguments": [
{
"commentStart": 95,
"end": 0,
"raw": "1",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 1.0,
"suffix": "None"
}
}
],
"callee": {
"commentStart": 85,
"end": 0,
"name": "increment",
"start": 0,
"type": "Identifier"
},
"commentStart": 85,
"end": 0,
"start": 0,
"type": "CallExpression",
"type": "CallExpression"
},
"start": 0,
"type": "VariableDeclarator"
},
"end": 0,
"kind": "const",
"start": 0,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"commentStart": 98,
"declaration": {
"commentStart": 98,
"end": 0,
"id": {
"commentStart": 98,
"end": 0,
"name": "three",
"start": 0,
"type": "Identifier"
},
"init": {
"arguments": [
{
"type": "LabeledArg",
"label": {
"commentStart": 113,
"end": 0,
"name": "delta",
"start": 0,
"type": "Identifier"
},
"arg": {
"commentStart": 121,
"end": 0,
"raw": "2",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 2.0,
"suffix": "None"
}
}
}
],
"callee": {
"commentStart": 106,
"end": 0,
"name": "add",
"start": 0,
"type": "Identifier"
},
"commentStart": 106,
"end": 0,
"start": 0,
"type": "CallExpressionKw",
"type": "CallExpressionKw",
"unlabeled": {
"commentStart": 110,
"end": 0,
"raw": "1",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 1.0,
"suffix": "None"
}
}
},
"start": 0,
"type": "VariableDeclarator"
},
"end": 0,
"kind": "const",
"start": 0,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
}
],
"commentStart": 0,
"end": 0,
"nonCodeMeta": {
"nonCodeNodes": {
"0": [
{
"commentStart": 35,
"end": 0,
"start": 0,
"type": "NonCodeNode",
"value": {
"type": "newLine"
}
}
],
"1": [
{
"commentStart": 77,
"end": 0,
"start": 0,
"type": "NonCodeNode",
"value": {
"type": "newLine"
}
}
]
},
"startNodes": []
},
"start": 0
}
}