--- source: kcl-lib/src/simulation_tests.rs description: Result of parsing property_of_object.kcl --- { "Ok": { "body": [ { "commentStart": 0, "declaration": { "commentStart": 0, "end": 0, "id": { "commentStart": 0, "end": 0, "name": "obj", "start": 0, "type": "Identifier" }, "init": { "commentStart": 0, "end": 0, "properties": [ { "commentStart": 0, "end": 0, "key": { "commentStart": 0, "end": 0, "name": "foo", "start": 0, "type": "Identifier" }, "start": 0, "type": "ObjectProperty", "value": { "commentStart": 0, "end": 0, "raw": "1", "start": 0, "type": "Literal", "type": "Literal", "value": { "value": 1.0, "suffix": "None" } } }, { "commentStart": 0, "end": 0, "key": { "commentStart": 0, "end": 0, "name": "bar", "start": 0, "type": "Identifier" }, "start": 0, "type": "ObjectProperty", "value": { "commentStart": 0, "end": 0, "raw": "0", "start": 0, "type": "Literal", "type": "Literal", "value": { "value": 0.0, "suffix": "None" } } } ], "start": 0, "type": "ObjectExpression", "type": "ObjectExpression" }, "start": 0, "type": "VariableDeclarator" }, "end": 0, "kind": "const", "start": 0, "type": "VariableDeclaration", "type": "VariableDeclaration" }, { "commentStart": 0, "declaration": { "commentStart": 0, "end": 0, "id": { "commentStart": 0, "end": 0, "name": "one_a", "start": 0, "type": "Identifier" }, "init": { "commentStart": 0, "computed": false, "end": 0, "object": { "commentStart": 0, "end": 0, "name": "obj", "start": 0, "type": "Identifier", "type": "Identifier" }, "property": { "commentStart": 0, "end": 0, "raw": "\"foo\"", "start": 0, "type": "Literal", "type": "Literal", "value": "foo" }, "start": 0, "type": "MemberExpression", "type": "MemberExpression" }, "start": 0, "type": "VariableDeclarator" }, "end": 0, "kind": "const", "start": 0, "type": "VariableDeclaration", "type": "VariableDeclaration" }, { "commentStart": 0, "end": 0, "expression": { "arguments": [ { "abs_path": false, "commentStart": 0, "end": 0, "name": { "commentStart": 0, "end": 0, "name": "one_a", "start": 0, "type": "Identifier" }, "path": [], "start": 0, "type": "Name", "type": "Name" }, { "commentStart": 0, "end": 0, "raw": "1", "start": 0, "type": "Literal", "type": "Literal", "value": { "value": 1.0, "suffix": "None" } }, { "commentStart": 0, "end": 0, "raw": "\"Literal property lookup\"", "start": 0, "type": "Literal", "type": "Literal", "value": "Literal property lookup" } ], "callee": { "abs_path": false, "commentStart": 0, "end": 0, "name": { "commentStart": 0, "end": 0, "name": "assertLessThanOrEq", "start": 0, "type": "Identifier" }, "path": [], "start": 0, "type": "Name" }, "commentStart": 0, "end": 0, "start": 0, "type": "CallExpression", "type": "CallExpression" }, "start": 0, "type": "ExpressionStatement", "type": "ExpressionStatement" }, { "commentStart": 0, "end": 0, "expression": { "arguments": [ { "abs_path": false, "commentStart": 0, "end": 0, "name": { "commentStart": 0, "end": 0, "name": "one_a", "start": 0, "type": "Identifier" }, "path": [], "start": 0, "type": "Name", "type": "Name" }, { "commentStart": 0, "end": 0, "raw": "1", "start": 0, "type": "Literal", "type": "Literal", "value": { "value": 1.0, "suffix": "None" } }, { "commentStart": 0, "end": 0, "raw": "\"Literal property lookup\"", "start": 0, "type": "Literal", "type": "Literal", "value": "Literal property lookup" } ], "callee": { "abs_path": false, "commentStart": 0, "end": 0, "name": { "commentStart": 0, "end": 0, "name": "assertGreaterThanOrEq", "start": 0, "type": "Identifier" }, "path": [], "start": 0, "type": "Name" }, "commentStart": 0, "end": 0, "start": 0, "type": "CallExpression", "type": "CallExpression" }, "start": 0, "type": "ExpressionStatement", "type": "ExpressionStatement" }, { "commentStart": 0, "declaration": { "commentStart": 0, "end": 0, "id": { "commentStart": 0, "end": 0, "name": "p", "start": 0, "type": "Identifier" }, "init": { "commentStart": 0, "end": 0, "raw": "\"foo\"", "start": 0, "type": "Literal", "type": "Literal", "value": "foo" }, "start": 0, "type": "VariableDeclarator" }, "end": 0, "kind": "const", "start": 0, "type": "VariableDeclaration", "type": "VariableDeclaration" }, { "commentStart": 0, "declaration": { "commentStart": 0, "end": 0, "id": { "commentStart": 0, "end": 0, "name": "one_b", "start": 0, "type": "Identifier" }, "init": { "commentStart": 0, "computed": true, "end": 0, "object": { "commentStart": 0, "end": 0, "name": "obj", "start": 0, "type": "Identifier", "type": "Identifier" }, "property": { "commentStart": 0, "end": 0, "name": "p", "start": 0, "type": "Identifier", "type": "Identifier" }, "start": 0, "type": "MemberExpression", "type": "MemberExpression" }, "start": 0, "type": "VariableDeclarator" }, "end": 0, "kind": "const", "start": 0, "type": "VariableDeclaration", "type": "VariableDeclaration" }, { "commentStart": 0, "end": 0, "expression": { "arguments": [ { "abs_path": false, "commentStart": 0, "end": 0, "name": { "commentStart": 0, "end": 0, "name": "one_b", "start": 0, "type": "Identifier" }, "path": [], "start": 0, "type": "Name", "type": "Name" }, { "commentStart": 0, "end": 0, "raw": "1", "start": 0, "type": "Literal", "type": "Literal", "value": { "value": 1.0, "suffix": "None" } }, { "commentStart": 0, "end": 0, "raw": "\"Computed property lookup\"", "start": 0, "type": "Literal", "type": "Literal", "value": "Computed property lookup" } ], "callee": { "abs_path": false, "commentStart": 0, "end": 0, "name": { "commentStart": 0, "end": 0, "name": "assertLessThanOrEq", "start": 0, "type": "Identifier" }, "path": [], "start": 0, "type": "Name" }, "commentStart": 0, "end": 0, "start": 0, "type": "CallExpression", "type": "CallExpression" }, "start": 0, "type": "ExpressionStatement", "type": "ExpressionStatement" }, { "commentStart": 0, "end": 0, "expression": { "arguments": [ { "abs_path": false, "commentStart": 0, "end": 0, "name": { "commentStart": 0, "end": 0, "name": "one_b", "start": 0, "type": "Identifier" }, "path": [], "start": 0, "type": "Name", "type": "Name" }, { "commentStart": 0, "end": 0, "raw": "1", "start": 0, "type": "Literal", "type": "Literal", "value": { "value": 1.0, "suffix": "None" } }, { "commentStart": 0, "end": 0, "raw": "\"Computed property lookup\"", "start": 0, "type": "Literal", "type": "Literal", "value": "Computed property lookup" } ], "callee": { "abs_path": false, "commentStart": 0, "end": 0, "name": { "commentStart": 0, "end": 0, "name": "assertGreaterThanOrEq", "start": 0, "type": "Identifier" }, "path": [], "start": 0, "type": "Name" }, "commentStart": 0, "end": 0, "start": 0, "type": "CallExpression", "type": "CallExpression" }, "start": 0, "type": "ExpressionStatement", "type": "ExpressionStatement" }, { "commentStart": 0, "declaration": { "commentStart": 0, "end": 0, "id": { "commentStart": 0, "end": 0, "name": "obj2", "start": 0, "type": "Identifier" }, "init": { "commentStart": 0, "end": 0, "properties": [ { "commentStart": 0, "end": 0, "key": { "commentStart": 0, "end": 0, "name": "inner", "start": 0, "type": "Identifier" }, "start": 0, "type": "ObjectProperty", "value": { "abs_path": false, "commentStart": 0, "end": 0, "name": { "commentStart": 0, "end": 0, "name": "obj", "start": 0, "type": "Identifier" }, "path": [], "start": 0, "type": "Name", "type": "Name" } } ], "start": 0, "type": "ObjectExpression", "type": "ObjectExpression" }, "start": 0, "type": "VariableDeclarator" }, "end": 0, "kind": "const", "start": 0, "type": "VariableDeclaration", "type": "VariableDeclaration" }, { "commentStart": 0, "declaration": { "commentStart": 0, "end": 0, "id": { "commentStart": 0, "end": 0, "name": "one_c", "start": 0, "type": "Identifier" }, "init": { "commentStart": 0, "computed": false, "end": 0, "object": { "commentStart": 0, "computed": false, "end": 0, "object": { "commentStart": 0, "end": 0, "name": "obj2", "start": 0, "type": "Identifier", "type": "Identifier" }, "property": { "commentStart": 0, "end": 0, "name": "inner", "start": 0, "type": "Identifier", "type": "Identifier" }, "start": 0, "type": "MemberExpression", "type": "MemberExpression" }, "property": { "commentStart": 0, "end": 0, "raw": "\"foo\"", "start": 0, "type": "Literal", "type": "Literal", "value": "foo" }, "start": 0, "type": "MemberExpression", "type": "MemberExpression" }, "start": 0, "type": "VariableDeclarator" }, "end": 0, "kind": "const", "start": 0, "type": "VariableDeclaration", "type": "VariableDeclaration" }, { "commentStart": 0, "end": 0, "expression": { "arguments": [ { "abs_path": false, "commentStart": 0, "end": 0, "name": { "commentStart": 0, "end": 0, "name": "one_c", "start": 0, "type": "Identifier" }, "path": [], "start": 0, "type": "Name", "type": "Name" }, { "commentStart": 0, "end": 0, "raw": "1", "start": 0, "type": "Literal", "type": "Literal", "value": { "value": 1.0, "suffix": "None" } }, { "commentStart": 0, "end": 0, "raw": "\"Literal property lookup\"", "start": 0, "type": "Literal", "type": "Literal", "value": "Literal property lookup" } ], "callee": { "abs_path": false, "commentStart": 0, "end": 0, "name": { "commentStart": 0, "end": 0, "name": "assertLessThanOrEq", "start": 0, "type": "Identifier" }, "path": [], "start": 0, "type": "Name" }, "commentStart": 0, "end": 0, "start": 0, "type": "CallExpression", "type": "CallExpression" }, "start": 0, "type": "ExpressionStatement", "type": "ExpressionStatement" }, { "commentStart": 0, "end": 0, "expression": { "arguments": [ { "abs_path": false, "commentStart": 0, "end": 0, "name": { "commentStart": 0, "end": 0, "name": "one_c", "start": 0, "type": "Identifier" }, "path": [], "start": 0, "type": "Name", "type": "Name" }, { "commentStart": 0, "end": 0, "raw": "1", "start": 0, "type": "Literal", "type": "Literal", "value": { "value": 1.0, "suffix": "None" } }, { "commentStart": 0, "end": 0, "raw": "\"Literal property lookup\"", "start": 0, "type": "Literal", "type": "Literal", "value": "Literal property lookup" } ], "callee": { "abs_path": false, "commentStart": 0, "end": 0, "name": { "commentStart": 0, "end": 0, "name": "assertGreaterThanOrEq", "start": 0, "type": "Identifier" }, "path": [], "start": 0, "type": "Name" }, "commentStart": 0, "end": 0, "start": 0, "type": "CallExpression", "type": "CallExpression" }, "start": 0, "type": "ExpressionStatement", "type": "ExpressionStatement" }, { "commentStart": 0, "declaration": { "commentStart": 0, "end": 0, "id": { "commentStart": 0, "end": 0, "name": "one_d", "start": 0, "type": "Identifier" }, "init": { "commentStart": 0, "computed": true, "end": 0, "object": { "commentStart": 0, "computed": false, "end": 0, "object": { "commentStart": 0, "end": 0, "name": "obj2", "start": 0, "type": "Identifier", "type": "Identifier" }, "property": { "commentStart": 0, "end": 0, "name": "inner", "start": 0, "type": "Identifier", "type": "Identifier" }, "start": 0, "type": "MemberExpression", "type": "MemberExpression" }, "property": { "commentStart": 0, "end": 0, "name": "p", "start": 0, "type": "Identifier", "type": "Identifier" }, "start": 0, "type": "MemberExpression", "type": "MemberExpression" }, "start": 0, "type": "VariableDeclarator" }, "end": 0, "kind": "const", "start": 0, "type": "VariableDeclaration", "type": "VariableDeclaration" }, { "commentStart": 0, "end": 0, "expression": { "arguments": [ { "abs_path": false, "commentStart": 0, "end": 0, "name": { "commentStart": 0, "end": 0, "name": "one_d", "start": 0, "type": "Identifier" }, "path": [], "start": 0, "type": "Name", "type": "Name" }, { "commentStart": 0, "end": 0, "raw": "1", "start": 0, "type": "Literal", "type": "Literal", "value": { "value": 1.0, "suffix": "None" } }, { "commentStart": 0, "end": 0, "raw": "\"Computed property lookup\"", "start": 0, "type": "Literal", "type": "Literal", "value": "Computed property lookup" } ], "callee": { "abs_path": false, "commentStart": 0, "end": 0, "name": { "commentStart": 0, "end": 0, "name": "assertLessThanOrEq", "start": 0, "type": "Identifier" }, "path": [], "start": 0, "type": "Name" }, "commentStart": 0, "end": 0, "start": 0, "type": "CallExpression", "type": "CallExpression" }, "start": 0, "type": "ExpressionStatement", "type": "ExpressionStatement" }, { "commentStart": 0, "end": 0, "expression": { "arguments": [ { "abs_path": false, "commentStart": 0, "end": 0, "name": { "commentStart": 0, "end": 0, "name": "one_d", "start": 0, "type": "Identifier" }, "path": [], "start": 0, "type": "Name", "type": "Name" }, { "commentStart": 0, "end": 0, "raw": "1", "start": 0, "type": "Literal", "type": "Literal", "value": { "value": 1.0, "suffix": "None" } }, { "commentStart": 0, "end": 0, "raw": "\"Computed property lookup\"", "start": 0, "type": "Literal", "type": "Literal", "value": "Computed property lookup" } ], "callee": { "abs_path": false, "commentStart": 0, "end": 0, "name": { "commentStart": 0, "end": 0, "name": "assertGreaterThanOrEq", "start": 0, "type": "Identifier" }, "path": [], "start": 0, "type": "Name" }, "commentStart": 0, "end": 0, "start": 0, "type": "CallExpression", "type": "CallExpression" }, "start": 0, "type": "ExpressionStatement", "type": "ExpressionStatement" } ], "commentStart": 0, "end": 0, "nonCodeMeta": { "nonCodeNodes": { "0": [ { "commentStart": 0, "end": 0, "start": 0, "type": "NonCodeNode", "value": { "type": "newLineBlockComment", "value": "Test: the property is a literal.", "style": "line" } }, { "commentStart": 0, "end": 0, "start": 0, "type": "NonCodeNode", "value": { "type": "newLine" } } ], "1": [ { "commentStart": 0, "end": 0, "start": 0, "type": "NonCodeNode", "value": { "type": "newLine" } } ], "3": [ { "commentStart": 0, "end": 0, "start": 0, "type": "NonCodeNode", "value": { "type": "newLineBlockComment", "value": "Test: the property is a variable,", "style": "line" } }, { "commentStart": 0, "end": 0, "start": 0, "type": "NonCodeNode", "value": { "type": "blockComment", "value": "which must be evaluated before looking it up.", "style": "line" } }, { "commentStart": 0, "end": 0, "start": 0, "type": "NonCodeNode", "value": { "type": "newLine" } } ], "5": [ { "commentStart": 0, "end": 0, "start": 0, "type": "NonCodeNode", "value": { "type": "newLine" } } ], "7": [ { "commentStart": 0, "end": 0, "start": 0, "type": "NonCodeNode", "value": { "type": "newLineBlockComment", "value": "Test: multiple literal properties.", "style": "line" } }, { "commentStart": 0, "end": 0, "start": 0, "type": "NonCodeNode", "value": { "type": "newLine" } } ], "8": [ { "commentStart": 0, "end": 0, "start": 0, "type": "NonCodeNode", "value": { "type": "newLine" } } ], "9": [ { "commentStart": 0, "end": 0, "start": 0, "type": "NonCodeNode", "value": { "type": "newLine" } } ], "11": [ { "commentStart": 0, "end": 0, "start": 0, "type": "NonCodeNode", "value": { "type": "newLineBlockComment", "value": "Test: multiple properties, mix of literal and computed.", "style": "line" } }, { "commentStart": 0, "end": 0, "start": 0, "type": "NonCodeNode", "value": { "type": "newLine" } } ], "12": [ { "commentStart": 0, "end": 0, "start": 0, "type": "NonCodeNode", "value": { "type": "newLine" } } ] }, "startNodes": [ { "commentStart": 0, "end": 0, "start": 0, "type": "NonCodeNode", "value": { "type": "blockComment", "value": "This tests evaluating properties of objects.", "style": "line" } }, { "commentStart": 0, "end": 0, "start": 0, "type": "NonCodeNode", "value": { "type": "newLine" } } ] }, "start": 0 } }