--- source: kcl-lib/src/simulation_tests.rs description: Result of parsing computed_var.kcl --- { "Ok": { "body": [ { "commentStart": 0, "declaration": { "commentStart": 0, "end": 0, "id": { "commentStart": 0, "end": 0, "moduleId": 0, "name": "arr", "start": 0, "type": "Identifier" }, "init": { "commentStart": 0, "elements": [ { "commentStart": 0, "end": 0, "moduleId": 0, "raw": "0", "start": 0, "type": "Literal", "type": "Literal", "value": { "value": 0.0, "suffix": "None" } }, { "commentStart": 0, "end": 0, "moduleId": 0, "raw": "0", "start": 0, "type": "Literal", "type": "Literal", "value": { "value": 0.0, "suffix": "None" } }, { "commentStart": 0, "end": 0, "moduleId": 0, "raw": "0", "start": 0, "type": "Literal", "type": "Literal", "value": { "value": 0.0, "suffix": "None" } }, { "commentStart": 0, "end": 0, "moduleId": 0, "raw": "10", "start": 0, "type": "Literal", "type": "Literal", "value": { "value": 10.0, "suffix": "None" } } ], "end": 0, "moduleId": 0, "start": 0, "type": "ArrayExpression", "type": "ArrayExpression" }, "moduleId": 0, "start": 0, "type": "VariableDeclarator" }, "end": 0, "kind": "const", "moduleId": 0, "start": 0, "type": "VariableDeclaration", "type": "VariableDeclaration" }, { "commentStart": 0, "declaration": { "commentStart": 0, "end": 0, "id": { "commentStart": 0, "end": 0, "moduleId": 0, "name": "i", "start": 0, "type": "Identifier" }, "init": { "commentStart": 0, "end": 0, "moduleId": 0, "raw": "3", "start": 0, "type": "Literal", "type": "Literal", "value": { "value": 3.0, "suffix": "None" } }, "moduleId": 0, "start": 0, "type": "VariableDeclarator" }, "end": 0, "kind": "const", "moduleId": 0, "start": 0, "type": "VariableDeclaration", "type": "VariableDeclaration" }, { "commentStart": 0, "declaration": { "commentStart": 0, "end": 0, "id": { "commentStart": 0, "end": 0, "moduleId": 0, "name": "ten", "start": 0, "type": "Identifier" }, "init": { "commentStart": 0, "computed": true, "end": 0, "moduleId": 0, "object": { "abs_path": false, "commentStart": 0, "end": 0, "moduleId": 0, "name": { "commentStart": 0, "end": 0, "moduleId": 0, "name": "arr", "start": 0, "type": "Identifier" }, "path": [], "start": 0, "type": "Name", "type": "Name" }, "property": { "commentStart": 0, "end": 0, "moduleId": 0, "name": "i", "start": 0, "type": "Identifier", "type": "Identifier" }, "start": 0, "type": "MemberExpression", "type": "MemberExpression" }, "moduleId": 0, "start": 0, "type": "VariableDeclarator" }, "end": 0, "kind": "const", "moduleId": 0, "start": 0, "type": "VariableDeclaration", "type": "VariableDeclaration" }, { "commentStart": 0, "end": 0, "expression": { "arguments": [ { "type": "LabeledArg", "label": { "commentStart": 0, "end": 0, "moduleId": 0, "name": "isEqualTo", "start": 0, "type": "Identifier" }, "arg": { "commentStart": 0, "end": 0, "moduleId": 0, "raw": "10", "start": 0, "type": "Literal", "type": "Literal", "value": { "value": 10.0, "suffix": "None" } } }, { "type": "LabeledArg", "label": { "commentStart": 0, "end": 0, "moduleId": 0, "name": "error", "start": 0, "type": "Identifier" }, "arg": { "commentStart": 0, "end": 0, "moduleId": 0, "raw": "\"oops\"", "start": 0, "type": "Literal", "type": "Literal", "value": "oops" } } ], "callee": { "abs_path": false, "commentStart": 0, "end": 0, "moduleId": 0, "name": { "commentStart": 0, "end": 0, "moduleId": 0, "name": "assert", "start": 0, "type": "Identifier" }, "path": [], "start": 0, "type": "Name" }, "commentStart": 0, "end": 0, "moduleId": 0, "start": 0, "type": "CallExpressionKw", "type": "CallExpressionKw", "unlabeled": { "abs_path": false, "commentStart": 0, "end": 0, "moduleId": 0, "name": { "commentStart": 0, "end": 0, "moduleId": 0, "name": "ten", "start": 0, "type": "Identifier" }, "path": [], "start": 0, "type": "Name", "type": "Name" } }, "moduleId": 0, "start": 0, "type": "ExpressionStatement", "type": "ExpressionStatement" }, { "commentStart": 0, "declaration": { "commentStart": 0, "end": 0, "id": { "commentStart": 0, "end": 0, "moduleId": 0, "name": "obj", "start": 0, "type": "Identifier" }, "init": { "commentStart": 0, "end": 0, "moduleId": 0, "properties": [ { "commentStart": 0, "end": 0, "key": { "commentStart": 0, "end": 0, "moduleId": 0, "name": "foo", "start": 0, "type": "Identifier" }, "moduleId": 0, "start": 0, "type": "ObjectProperty", "value": { "commentStart": 0, "end": 0, "moduleId": 0, "raw": "1", "start": 0, "type": "Literal", "type": "Literal", "value": { "value": 1.0, "suffix": "None" } } }, { "commentStart": 0, "end": 0, "key": { "commentStart": 0, "end": 0, "moduleId": 0, "name": "bar", "start": 0, "type": "Identifier" }, "moduleId": 0, "start": 0, "type": "ObjectProperty", "value": { "commentStart": 0, "end": 0, "moduleId": 0, "raw": "0", "start": 0, "type": "Literal", "type": "Literal", "value": { "value": 0.0, "suffix": "None" } } } ], "start": 0, "type": "ObjectExpression", "type": "ObjectExpression" }, "moduleId": 0, "start": 0, "type": "VariableDeclarator" }, "end": 0, "kind": "const", "moduleId": 0, "start": 0, "type": "VariableDeclaration", "type": "VariableDeclaration" }, { "commentStart": 0, "declaration": { "commentStart": 0, "end": 0, "id": { "commentStart": 0, "end": 0, "moduleId": 0, "name": "one", "start": 0, "type": "Identifier" }, "init": { "commentStart": 0, "computed": false, "end": 0, "moduleId": 0, "object": { "abs_path": false, "commentStart": 0, "end": 0, "moduleId": 0, "name": { "commentStart": 0, "end": 0, "moduleId": 0, "name": "obj", "start": 0, "type": "Identifier" }, "path": [], "start": 0, "type": "Name", "type": "Name" }, "property": { "commentStart": 0, "end": 0, "moduleId": 0, "name": "foo", "start": 0, "type": "Identifier", "type": "Identifier" }, "start": 0, "type": "MemberExpression", "type": "MemberExpression" }, "moduleId": 0, "start": 0, "type": "VariableDeclarator" }, "end": 0, "kind": "const", "moduleId": 0, "start": 0, "type": "VariableDeclaration", "type": "VariableDeclaration" }, { "commentStart": 0, "end": 0, "expression": { "arguments": [ { "type": "LabeledArg", "label": { "commentStart": 0, "end": 0, "moduleId": 0, "name": "isEqualTo", "start": 0, "type": "Identifier" }, "arg": { "commentStart": 0, "end": 0, "moduleId": 0, "raw": "1", "start": 0, "type": "Literal", "type": "Literal", "value": { "value": 1.0, "suffix": "None" } } }, { "type": "LabeledArg", "label": { "commentStart": 0, "end": 0, "moduleId": 0, "name": "error", "start": 0, "type": "Identifier" }, "arg": { "commentStart": 0, "end": 0, "moduleId": 0, "raw": "\"oops\"", "start": 0, "type": "Literal", "type": "Literal", "value": "oops" } } ], "callee": { "abs_path": false, "commentStart": 0, "end": 0, "moduleId": 0, "name": { "commentStart": 0, "end": 0, "moduleId": 0, "name": "assert", "start": 0, "type": "Identifier" }, "path": [], "start": 0, "type": "Name" }, "commentStart": 0, "end": 0, "moduleId": 0, "start": 0, "type": "CallExpressionKw", "type": "CallExpressionKw", "unlabeled": { "abs_path": false, "commentStart": 0, "end": 0, "moduleId": 0, "name": { "commentStart": 0, "end": 0, "moduleId": 0, "name": "one", "start": 0, "type": "Identifier" }, "path": [], "start": 0, "type": "Name", "type": "Name" } }, "moduleId": 0, "start": 0, "type": "ExpressionStatement", "type": "ExpressionStatement" }, { "commentStart": 0, "end": 0, "expression": { "arguments": [ { "type": "LabeledArg", "label": { "commentStart": 0, "end": 0, "moduleId": 0, "name": "isEqualTo", "start": 0, "type": "Identifier" }, "arg": { "commentStart": 0, "end": 0, "moduleId": 0, "raw": "3", "start": 0, "type": "Literal", "type": "Literal", "value": { "value": 3.0, "suffix": "None" } } }, { "type": "LabeledArg", "label": { "commentStart": 0, "end": 0, "moduleId": 0, "name": "tolerance", "start": 0, "type": "Identifier" }, "arg": { "commentStart": 0, "end": 0, "moduleId": 0, "raw": "0.2", "start": 0, "type": "Literal", "type": "Literal", "value": { "value": 0.2, "suffix": "None" } } }, { "type": "LabeledArg", "label": { "commentStart": 0, "end": 0, "moduleId": 0, "name": "error", "start": 0, "type": "Identifier" }, "arg": { "commentStart": 0, "end": 0, "moduleId": 0, "raw": "\"oops pi\"", "start": 0, "type": "Literal", "type": "Literal", "value": "oops pi" } } ], "callee": { "abs_path": false, "commentStart": 0, "end": 0, "moduleId": 0, "name": { "commentStart": 0, "end": 0, "moduleId": 0, "name": "assert", "start": 0, "type": "Identifier" }, "path": [], "start": 0, "type": "Name" }, "commentStart": 0, "end": 0, "moduleId": 0, "start": 0, "type": "CallExpressionKw", "type": "CallExpressionKw", "unlabeled": { "abs_path": false, "commentStart": 0, "end": 0, "moduleId": 0, "name": { "commentStart": 0, "end": 0, "moduleId": 0, "name": "PI", "start": 0, "type": "Identifier" }, "path": [], "start": 0, "type": "Name", "type": "Name" } }, "moduleId": 0, "start": 0, "type": "ExpressionStatement", "type": "ExpressionStatement" }, { "commentStart": 0, "declaration": { "commentStart": 0, "end": 0, "id": { "commentStart": 0, "end": 0, "moduleId": 0, "name": "x", "start": 0, "type": "Identifier" }, "init": { "arguments": [], "callee": { "abs_path": false, "commentStart": 0, "end": 0, "moduleId": 0, "name": { "commentStart": 0, "end": 0, "moduleId": 0, "name": "cos", "start": 0, "type": "Identifier" }, "path": [], "start": 0, "type": "Name" }, "commentStart": 0, "end": 0, "moduleId": 0, "start": 0, "type": "CallExpressionKw", "type": "CallExpressionKw", "unlabeled": { "commentStart": 0, "end": 0, "expr": { "commentStart": 0, "end": 0, "left": { "commentStart": 0, "end": 0, "moduleId": 0, "raw": "2", "start": 0, "type": "Literal", "type": "Literal", "value": { "value": 2.0, "suffix": "None" } }, "moduleId": 0, "operator": "*", "right": { "abs_path": false, "commentStart": 0, "end": 0, "moduleId": 0, "name": { "commentStart": 0, "end": 0, "moduleId": 0, "name": "PI", "start": 0, "type": "Identifier" }, "path": [], "start": 0, "type": "Name", "type": "Name" }, "start": 0, "type": "BinaryExpression", "type": "BinaryExpression" }, "moduleId": 0, "start": 0, "ty": { "Rad": null, "commentStart": 0, "end": 0, "moduleId": 0, "p_type": "Number", "start": 0, "type": "Primitive" }, "type": "AscribedExpression", "type": "AscribedExpression" } }, "moduleId": 0, "start": 0, "type": "VariableDeclarator" }, "end": 0, "kind": "const", "moduleId": 0, "start": 0, "type": "VariableDeclaration", "type": "VariableDeclaration" }, { "commentStart": 0, "end": 0, "expression": { "arguments": [ { "type": "LabeledArg", "label": { "commentStart": 0, "end": 0, "moduleId": 0, "name": "isEqualTo", "start": 0, "type": "Identifier" }, "arg": { "commentStart": 0, "end": 0, "moduleId": 0, "raw": "1", "start": 0, "type": "Literal", "type": "Literal", "value": { "value": 1.0, "suffix": "None" } } }, { "type": "LabeledArg", "label": { "commentStart": 0, "end": 0, "moduleId": 0, "name": "tolerance", "start": 0, "type": "Identifier" }, "arg": { "commentStart": 0, "end": 0, "moduleId": 0, "raw": "0.000001", "start": 0, "type": "Literal", "type": "Literal", "value": { "value": 0.000001, "suffix": "None" } } }, { "type": "LabeledArg", "label": { "commentStart": 0, "end": 0, "moduleId": 0, "name": "error", "start": 0, "type": "Identifier" }, "arg": { "commentStart": 0, "end": 0, "moduleId": 0, "raw": "\"oops cos\"", "start": 0, "type": "Literal", "type": "Literal", "value": "oops cos" } } ], "callee": { "abs_path": false, "commentStart": 0, "end": 0, "moduleId": 0, "name": { "commentStart": 0, "end": 0, "moduleId": 0, "name": "assert", "start": 0, "type": "Identifier" }, "path": [], "start": 0, "type": "Name" }, "commentStart": 0, "end": 0, "moduleId": 0, "start": 0, "type": "CallExpressionKw", "type": "CallExpressionKw", "unlabeled": { "abs_path": false, "commentStart": 0, "end": 0, "moduleId": 0, "name": { "commentStart": 0, "end": 0, "moduleId": 0, "name": "x", "start": 0, "type": "Identifier" }, "path": [], "start": 0, "type": "Name", "type": "Name" } }, "moduleId": 0, "start": 0, "type": "ExpressionStatement", "type": "ExpressionStatement" } ], "commentStart": 0, "end": 0, "moduleId": 0, "nonCodeMeta": { "nonCodeNodes": { "2": [ { "commentStart": 0, "end": 0, "moduleId": 0, "start": 0, "type": "NonCodeNode", "value": { "type": "newLine" } } ], "3": [ { "commentStart": 0, "end": 0, "moduleId": 0, "start": 0, "type": "NonCodeNode", "value": { "type": "newLine" } } ], "5": [ { "commentStart": 0, "end": 0, "moduleId": 0, "start": 0, "type": "NonCodeNode", "value": { "type": "newLine" } } ], "6": [ { "commentStart": 0, "end": 0, "moduleId": 0, "start": 0, "type": "NonCodeNode", "value": { "type": "newLine" } } ], "7": [ { "commentStart": 0, "end": 0, "moduleId": 0, "start": 0, "type": "NonCodeNode", "value": { "type": "newLine" } } ] }, "startNodes": [ { "commentStart": 0, "end": 0, "moduleId": 0, "start": 0, "type": "NonCodeNode", "value": { "type": "blockComment", "value": "This tests computed properties.", "style": "line" } }, { "commentStart": 0, "end": 0, "moduleId": 0, "start": 0, "type": "NonCodeNode", "value": { "type": "newLine" } } ] }, "start": 0 } }