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

936 lines
25 KiB
Plaintext

---
source: kcl-lib/src/simulation_tests.rs
description: Result of parsing boolean_logical_or.kcl
---
{
"Ok": {
"body": [
{
"commentStart": 0,
"declaration": {
"commentStart": 0,
"end": 0,
"id": {
"commentStart": 0,
"end": 0,
"name": "aa",
"start": 0,
"type": "Identifier"
},
"init": {
"commentStart": 5,
"end": 0,
"left": {
"commentStart": 5,
"end": 0,
"raw": "true",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": true
},
"operator": "|",
"right": {
"commentStart": 12,
"end": 0,
"raw": "false",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": false
},
"start": 0,
"type": "BinaryExpression",
"type": "BinaryExpression"
},
"start": 0,
"type": "VariableDeclarator"
},
"end": 0,
"kind": "const",
"start": 0,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"commentStart": 18,
"declaration": {
"commentStart": 18,
"end": 0,
"id": {
"commentStart": 18,
"end": 0,
"name": "a",
"start": 0,
"type": "Identifier"
},
"init": {
"commentStart": 22,
"cond": {
"abs_path": false,
"commentStart": 25,
"end": 0,
"name": {
"commentStart": 25,
"end": 0,
"name": "aa",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
},
"digest": null,
"else_ifs": [],
"end": 0,
"final_else": {
"body": [
{
"commentStart": 45,
"end": 0,
"expression": {
"commentStart": 45,
"end": 0,
"raw": "2",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 2.0,
"suffix": "None"
}
},
"start": 0,
"type": "ExpressionStatement",
"type": "ExpressionStatement"
}
],
"commentStart": 45,
"end": 0,
"start": 0
},
"start": 0,
"then_val": {
"body": [
{
"commentStart": 32,
"end": 0,
"expression": {
"commentStart": 32,
"end": 0,
"raw": "1",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 1.0,
"suffix": "None"
}
},
"start": 0,
"type": "ExpressionStatement",
"type": "ExpressionStatement"
}
],
"commentStart": 32,
"end": 0,
"start": 0
},
"type": "IfExpression",
"type": "IfExpression"
},
"start": 0,
"type": "VariableDeclarator"
},
"end": 0,
"kind": "const",
"start": 0,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"commentStart": 49,
"end": 0,
"expression": {
"arguments": [
{
"commentStart": 56,
"end": 0,
"left": {
"abs_path": false,
"commentStart": 56,
"end": 0,
"name": {
"commentStart": 56,
"end": 0,
"name": "a",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
},
"operator": "==",
"right": {
"commentStart": 61,
"end": 0,
"raw": "1",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 1.0,
"suffix": "None"
}
},
"start": 0,
"type": "BinaryExpression",
"type": "BinaryExpression"
},
{
"commentStart": 64,
"end": 0,
"raw": "\"left branch of or is true makes the whole expression true\"",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": "left branch of or is true makes the whole expression true"
}
],
"callee": {
"abs_path": false,
"commentStart": 49,
"end": 0,
"name": {
"commentStart": 49,
"end": 0,
"name": "assert",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name"
},
"commentStart": 49,
"end": 0,
"start": 0,
"type": "CallExpression",
"type": "CallExpression"
},
"start": 0,
"type": "ExpressionStatement",
"type": "ExpressionStatement"
},
{
"commentStart": 124,
"declaration": {
"commentStart": 126,
"end": 0,
"id": {
"commentStart": 126,
"end": 0,
"name": "bb",
"start": 0,
"type": "Identifier"
},
"init": {
"commentStart": 131,
"end": 0,
"left": {
"commentStart": 131,
"end": 0,
"raw": "false",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": false
},
"operator": "|",
"right": {
"commentStart": 139,
"end": 0,
"raw": "true",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": true
},
"start": 0,
"type": "BinaryExpression",
"type": "BinaryExpression"
},
"start": 0,
"type": "VariableDeclarator"
},
"end": 0,
"kind": "const",
"start": 0,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"commentStart": 144,
"declaration": {
"commentStart": 144,
"end": 0,
"id": {
"commentStart": 144,
"end": 0,
"name": "b",
"start": 0,
"type": "Identifier"
},
"init": {
"commentStart": 148,
"cond": {
"abs_path": false,
"commentStart": 151,
"end": 0,
"name": {
"commentStart": 151,
"end": 0,
"name": "bb",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
},
"digest": null,
"else_ifs": [],
"end": 0,
"final_else": {
"body": [
{
"commentStart": 171,
"end": 0,
"expression": {
"commentStart": 171,
"end": 0,
"raw": "2",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 2.0,
"suffix": "None"
}
},
"start": 0,
"type": "ExpressionStatement",
"type": "ExpressionStatement"
}
],
"commentStart": 171,
"end": 0,
"start": 0
},
"start": 0,
"then_val": {
"body": [
{
"commentStart": 158,
"end": 0,
"expression": {
"commentStart": 158,
"end": 0,
"raw": "1",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 1.0,
"suffix": "None"
}
},
"start": 0,
"type": "ExpressionStatement",
"type": "ExpressionStatement"
}
],
"commentStart": 158,
"end": 0,
"start": 0
},
"type": "IfExpression",
"type": "IfExpression"
},
"start": 0,
"type": "VariableDeclarator"
},
"end": 0,
"kind": "const",
"start": 0,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"commentStart": 175,
"end": 0,
"expression": {
"arguments": [
{
"commentStart": 182,
"end": 0,
"left": {
"abs_path": false,
"commentStart": 182,
"end": 0,
"name": {
"commentStart": 182,
"end": 0,
"name": "b",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
},
"operator": "==",
"right": {
"commentStart": 187,
"end": 0,
"raw": "1",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 1.0,
"suffix": "None"
}
},
"start": 0,
"type": "BinaryExpression",
"type": "BinaryExpression"
},
{
"commentStart": 190,
"end": 0,
"raw": "\"right branch of or is true makes the whole expression true\"",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": "right branch of or is true makes the whole expression true"
}
],
"callee": {
"abs_path": false,
"commentStart": 175,
"end": 0,
"name": {
"commentStart": 175,
"end": 0,
"name": "assert",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name"
},
"commentStart": 175,
"end": 0,
"start": 0,
"type": "CallExpression",
"type": "CallExpression"
},
"start": 0,
"type": "ExpressionStatement",
"type": "ExpressionStatement"
},
{
"commentStart": 251,
"declaration": {
"commentStart": 253,
"end": 0,
"id": {
"commentStart": 253,
"end": 0,
"name": "cc",
"start": 0,
"type": "Identifier"
},
"init": {
"commentStart": 258,
"end": 0,
"left": {
"commentStart": 258,
"end": 0,
"raw": "true",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": true
},
"operator": "|",
"right": {
"commentStart": 265,
"end": 0,
"raw": "true",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": true
},
"start": 0,
"type": "BinaryExpression",
"type": "BinaryExpression"
},
"start": 0,
"type": "VariableDeclarator"
},
"end": 0,
"kind": "const",
"start": 0,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"commentStart": 270,
"declaration": {
"commentStart": 270,
"end": 0,
"id": {
"commentStart": 270,
"end": 0,
"name": "c",
"start": 0,
"type": "Identifier"
},
"init": {
"commentStart": 274,
"cond": {
"abs_path": false,
"commentStart": 277,
"end": 0,
"name": {
"commentStart": 277,
"end": 0,
"name": "cc",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
},
"digest": null,
"else_ifs": [],
"end": 0,
"final_else": {
"body": [
{
"commentStart": 297,
"end": 0,
"expression": {
"commentStart": 297,
"end": 0,
"raw": "2",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 2.0,
"suffix": "None"
}
},
"start": 0,
"type": "ExpressionStatement",
"type": "ExpressionStatement"
}
],
"commentStart": 297,
"end": 0,
"start": 0
},
"start": 0,
"then_val": {
"body": [
{
"commentStart": 284,
"end": 0,
"expression": {
"commentStart": 284,
"end": 0,
"raw": "1",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 1.0,
"suffix": "None"
}
},
"start": 0,
"type": "ExpressionStatement",
"type": "ExpressionStatement"
}
],
"commentStart": 284,
"end": 0,
"start": 0
},
"type": "IfExpression",
"type": "IfExpression"
},
"start": 0,
"type": "VariableDeclarator"
},
"end": 0,
"kind": "const",
"start": 0,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"commentStart": 301,
"end": 0,
"expression": {
"arguments": [
{
"commentStart": 308,
"end": 0,
"left": {
"abs_path": false,
"commentStart": 308,
"end": 0,
"name": {
"commentStart": 308,
"end": 0,
"name": "c",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
},
"operator": "==",
"right": {
"commentStart": 313,
"end": 0,
"raw": "1",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 1.0,
"suffix": "None"
}
},
"start": 0,
"type": "BinaryExpression",
"type": "BinaryExpression"
},
{
"commentStart": 316,
"end": 0,
"raw": "\"both branches of or are true makes the whole expression true\"",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": "both branches of or are true makes the whole expression true"
}
],
"callee": {
"abs_path": false,
"commentStart": 301,
"end": 0,
"name": {
"commentStart": 301,
"end": 0,
"name": "assert",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name"
},
"commentStart": 301,
"end": 0,
"start": 0,
"type": "CallExpression",
"type": "CallExpression"
},
"start": 0,
"type": "ExpressionStatement",
"type": "ExpressionStatement"
},
{
"commentStart": 379,
"declaration": {
"commentStart": 381,
"end": 0,
"id": {
"commentStart": 381,
"end": 0,
"name": "dd",
"start": 0,
"type": "Identifier"
},
"init": {
"commentStart": 386,
"end": 0,
"left": {
"commentStart": 386,
"end": 0,
"raw": "false",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": false
},
"operator": "|",
"right": {
"commentStart": 394,
"end": 0,
"raw": "false",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": false
},
"start": 0,
"type": "BinaryExpression",
"type": "BinaryExpression"
},
"start": 0,
"type": "VariableDeclarator"
},
"end": 0,
"kind": "const",
"start": 0,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"commentStart": 400,
"declaration": {
"commentStart": 400,
"end": 0,
"id": {
"commentStart": 400,
"end": 0,
"name": "d",
"start": 0,
"type": "Identifier"
},
"init": {
"commentStart": 404,
"cond": {
"abs_path": false,
"commentStart": 407,
"end": 0,
"name": {
"commentStart": 407,
"end": 0,
"name": "dd",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
},
"digest": null,
"else_ifs": [],
"end": 0,
"final_else": {
"body": [
{
"commentStart": 427,
"end": 0,
"expression": {
"commentStart": 427,
"end": 0,
"raw": "2",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 2.0,
"suffix": "None"
}
},
"start": 0,
"type": "ExpressionStatement",
"type": "ExpressionStatement"
}
],
"commentStart": 427,
"end": 0,
"start": 0
},
"start": 0,
"then_val": {
"body": [
{
"commentStart": 414,
"end": 0,
"expression": {
"commentStart": 414,
"end": 0,
"raw": "1",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 1.0,
"suffix": "None"
}
},
"start": 0,
"type": "ExpressionStatement",
"type": "ExpressionStatement"
}
],
"commentStart": 414,
"end": 0,
"start": 0
},
"type": "IfExpression",
"type": "IfExpression"
},
"start": 0,
"type": "VariableDeclarator"
},
"end": 0,
"kind": "const",
"start": 0,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"commentStart": 431,
"end": 0,
"expression": {
"arguments": [
{
"commentStart": 438,
"end": 0,
"left": {
"abs_path": false,
"commentStart": 438,
"end": 0,
"name": {
"commentStart": 438,
"end": 0,
"name": "d",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
},
"operator": "==",
"right": {
"commentStart": 443,
"end": 0,
"raw": "2",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 2.0,
"suffix": "None"
}
},
"start": 0,
"type": "BinaryExpression",
"type": "BinaryExpression"
},
{
"commentStart": 446,
"end": 0,
"raw": "\"both branches of or are false makes the whole expression false\"",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": "both branches of or are false makes the whole expression false"
}
],
"callee": {
"abs_path": false,
"commentStart": 431,
"end": 0,
"name": {
"commentStart": 431,
"end": 0,
"name": "assert",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name"
},
"commentStart": 431,
"end": 0,
"start": 0,
"type": "CallExpression",
"type": "CallExpression"
},
"start": 0,
"type": "ExpressionStatement",
"type": "ExpressionStatement"
}
],
"commentStart": 0,
"end": 0,
"nonCodeMeta": {
"nonCodeNodes": {
"2": [
{
"commentStart": 124,
"end": 0,
"start": 0,
"type": "NonCodeNode",
"value": {
"type": "newLine"
}
}
],
"5": [
{
"commentStart": 251,
"end": 0,
"start": 0,
"type": "NonCodeNode",
"value": {
"type": "newLine"
}
}
],
"8": [
{
"commentStart": 379,
"end": 0,
"start": 0,
"type": "NonCodeNode",
"value": {
"type": "newLine"
}
}
]
},
"startNodes": []
},
"start": 0
}
}