671 lines
		
	
	
		
			17 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			671 lines
		
	
	
		
			17 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
| ---
 | |
| source: kcl-lib/src/simulation_tests.rs
 | |
| description: Result of parsing index_of_array.kcl
 | |
| ---
 | |
| {
 | |
|   "Ok": {
 | |
|     "body": [
 | |
|       {
 | |
|         "commentStart": 0,
 | |
|         "declaration": {
 | |
|           "commentStart": 0,
 | |
|           "end": 0,
 | |
|           "id": {
 | |
|             "commentStart": 0,
 | |
|             "end": 0,
 | |
|             "name": "arr",
 | |
|             "start": 0,
 | |
|             "type": "Identifier"
 | |
|           },
 | |
|           "init": {
 | |
|             "commentStart": 0,
 | |
|             "elements": [
 | |
|               {
 | |
|                 "commentStart": 0,
 | |
|                 "end": 0,
 | |
|                 "raw": "90",
 | |
|                 "start": 0,
 | |
|                 "type": "Literal",
 | |
|                 "type": "Literal",
 | |
|                 "value": {
 | |
|                   "value": 90.0,
 | |
|                   "suffix": "None"
 | |
|                 }
 | |
|               },
 | |
|               {
 | |
|                 "commentStart": 0,
 | |
|                 "end": 0,
 | |
|                 "raw": "91",
 | |
|                 "start": 0,
 | |
|                 "type": "Literal",
 | |
|                 "type": "Literal",
 | |
|                 "value": {
 | |
|                   "value": 91.0,
 | |
|                   "suffix": "None"
 | |
|                 }
 | |
|               },
 | |
|               {
 | |
|                 "commentStart": 0,
 | |
|                 "end": 0,
 | |
|                 "raw": "92",
 | |
|                 "start": 0,
 | |
|                 "type": "Literal",
 | |
|                 "type": "Literal",
 | |
|                 "value": {
 | |
|                   "value": 92.0,
 | |
|                   "suffix": "None"
 | |
|                 }
 | |
|               }
 | |
|             ],
 | |
|             "end": 0,
 | |
|             "start": 0,
 | |
|             "type": "ArrayExpression",
 | |
|             "type": "ArrayExpression"
 | |
|           },
 | |
|           "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": "result0",
 | |
|             "start": 0,
 | |
|             "type": "Identifier"
 | |
|           },
 | |
|           "init": {
 | |
|             "commentStart": 0,
 | |
|             "computed": false,
 | |
|             "end": 0,
 | |
|             "object": {
 | |
|               "commentStart": 0,
 | |
|               "end": 0,
 | |
|               "name": "arr",
 | |
|               "start": 0,
 | |
|               "type": "Identifier",
 | |
|               "type": "Identifier"
 | |
|             },
 | |
|             "property": {
 | |
|               "commentStart": 0,
 | |
|               "end": 0,
 | |
|               "raw": "1",
 | |
|               "start": 0,
 | |
|               "type": "Literal",
 | |
|               "type": "Literal",
 | |
|               "value": {
 | |
|                 "value": 1.0,
 | |
|                 "suffix": "None"
 | |
|               }
 | |
|             },
 | |
|             "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": [
 | |
|             {
 | |
|               "type": "LabeledArg",
 | |
|               "label": {
 | |
|                 "commentStart": 0,
 | |
|                 "end": 0,
 | |
|                 "name": "isLessThanOrEqual",
 | |
|                 "start": 0,
 | |
|                 "type": "Identifier"
 | |
|               },
 | |
|               "arg": {
 | |
|                 "commentStart": 0,
 | |
|                 "end": 0,
 | |
|                 "raw": "91",
 | |
|                 "start": 0,
 | |
|                 "type": "Literal",
 | |
|                 "type": "Literal",
 | |
|                 "value": {
 | |
|                   "value": 91.0,
 | |
|                   "suffix": "None"
 | |
|                 }
 | |
|               }
 | |
|             },
 | |
|             {
 | |
|               "type": "LabeledArg",
 | |
|               "label": {
 | |
|                 "commentStart": 0,
 | |
|                 "end": 0,
 | |
|                 "name": "error",
 | |
|                 "start": 0,
 | |
|                 "type": "Identifier"
 | |
|               },
 | |
|               "arg": {
 | |
|                 "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": "assert",
 | |
|               "start": 0,
 | |
|               "type": "Identifier"
 | |
|             },
 | |
|             "path": [],
 | |
|             "start": 0,
 | |
|             "type": "Name"
 | |
|           },
 | |
|           "commentStart": 0,
 | |
|           "end": 0,
 | |
|           "start": 0,
 | |
|           "type": "CallExpressionKw",
 | |
|           "type": "CallExpressionKw",
 | |
|           "unlabeled": {
 | |
|             "abs_path": false,
 | |
|             "commentStart": 0,
 | |
|             "end": 0,
 | |
|             "name": {
 | |
|               "commentStart": 0,
 | |
|               "end": 0,
 | |
|               "name": "result0",
 | |
|               "start": 0,
 | |
|               "type": "Identifier"
 | |
|             },
 | |
|             "path": [],
 | |
|             "start": 0,
 | |
|             "type": "Name",
 | |
|             "type": "Name"
 | |
|           }
 | |
|         },
 | |
|         "start": 0,
 | |
|         "type": "ExpressionStatement",
 | |
|         "type": "ExpressionStatement"
 | |
|       },
 | |
|       {
 | |
|         "commentStart": 0,
 | |
|         "end": 0,
 | |
|         "expression": {
 | |
|           "arguments": [
 | |
|             {
 | |
|               "type": "LabeledArg",
 | |
|               "label": {
 | |
|                 "commentStart": 0,
 | |
|                 "end": 0,
 | |
|                 "name": "isGreaterThanOrEqual",
 | |
|                 "start": 0,
 | |
|                 "type": "Identifier"
 | |
|               },
 | |
|               "arg": {
 | |
|                 "commentStart": 0,
 | |
|                 "end": 0,
 | |
|                 "raw": "91",
 | |
|                 "start": 0,
 | |
|                 "type": "Literal",
 | |
|                 "type": "Literal",
 | |
|                 "value": {
 | |
|                   "value": 91.0,
 | |
|                   "suffix": "None"
 | |
|                 }
 | |
|               }
 | |
|             },
 | |
|             {
 | |
|               "type": "LabeledArg",
 | |
|               "label": {
 | |
|                 "commentStart": 0,
 | |
|                 "end": 0,
 | |
|                 "name": "error",
 | |
|                 "start": 0,
 | |
|                 "type": "Identifier"
 | |
|               },
 | |
|               "arg": {
 | |
|                 "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": "assert",
 | |
|               "start": 0,
 | |
|               "type": "Identifier"
 | |
|             },
 | |
|             "path": [],
 | |
|             "start": 0,
 | |
|             "type": "Name"
 | |
|           },
 | |
|           "commentStart": 0,
 | |
|           "end": 0,
 | |
|           "start": 0,
 | |
|           "type": "CallExpressionKw",
 | |
|           "type": "CallExpressionKw",
 | |
|           "unlabeled": {
 | |
|             "abs_path": false,
 | |
|             "commentStart": 0,
 | |
|             "end": 0,
 | |
|             "name": {
 | |
|               "commentStart": 0,
 | |
|               "end": 0,
 | |
|               "name": "result0",
 | |
|               "start": 0,
 | |
|               "type": "Identifier"
 | |
|             },
 | |
|             "path": [],
 | |
|             "start": 0,
 | |
|             "type": "Name",
 | |
|             "type": "Name"
 | |
|           }
 | |
|         },
 | |
|         "start": 0,
 | |
|         "type": "ExpressionStatement",
 | |
|         "type": "ExpressionStatement"
 | |
|       },
 | |
|       {
 | |
|         "commentStart": 0,
 | |
|         "declaration": {
 | |
|           "commentStart": 0,
 | |
|           "end": 0,
 | |
|           "id": {
 | |
|             "commentStart": 0,
 | |
|             "end": 0,
 | |
|             "name": "i",
 | |
|             "start": 0,
 | |
|             "type": "Identifier"
 | |
|           },
 | |
|           "init": {
 | |
|             "commentStart": 0,
 | |
|             "end": 0,
 | |
|             "left": {
 | |
|               "commentStart": 0,
 | |
|               "end": 0,
 | |
|               "raw": "1",
 | |
|               "start": 0,
 | |
|               "type": "Literal",
 | |
|               "type": "Literal",
 | |
|               "value": {
 | |
|                 "value": 1.0,
 | |
|                 "suffix": "None"
 | |
|               }
 | |
|             },
 | |
|             "operator": "+",
 | |
|             "right": {
 | |
|               "commentStart": 0,
 | |
|               "end": 0,
 | |
|               "raw": "0",
 | |
|               "start": 0,
 | |
|               "type": "Literal",
 | |
|               "type": "Literal",
 | |
|               "value": {
 | |
|                 "value": 0.0,
 | |
|                 "suffix": "None"
 | |
|               }
 | |
|             },
 | |
|             "start": 0,
 | |
|             "type": "BinaryExpression",
 | |
|             "type": "BinaryExpression"
 | |
|           },
 | |
|           "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": "result1",
 | |
|             "start": 0,
 | |
|             "type": "Identifier"
 | |
|           },
 | |
|           "init": {
 | |
|             "commentStart": 0,
 | |
|             "computed": true,
 | |
|             "end": 0,
 | |
|             "object": {
 | |
|               "commentStart": 0,
 | |
|               "end": 0,
 | |
|               "name": "arr",
 | |
|               "start": 0,
 | |
|               "type": "Identifier",
 | |
|               "type": "Identifier"
 | |
|             },
 | |
|             "property": {
 | |
|               "commentStart": 0,
 | |
|               "end": 0,
 | |
|               "name": "i",
 | |
|               "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": [
 | |
|             {
 | |
|               "type": "LabeledArg",
 | |
|               "label": {
 | |
|                 "commentStart": 0,
 | |
|                 "end": 0,
 | |
|                 "name": "isLessThanOrEqual",
 | |
|                 "start": 0,
 | |
|                 "type": "Identifier"
 | |
|               },
 | |
|               "arg": {
 | |
|                 "commentStart": 0,
 | |
|                 "end": 0,
 | |
|                 "raw": "91",
 | |
|                 "start": 0,
 | |
|                 "type": "Literal",
 | |
|                 "type": "Literal",
 | |
|                 "value": {
 | |
|                   "value": 91.0,
 | |
|                   "suffix": "None"
 | |
|                 }
 | |
|               }
 | |
|             },
 | |
|             {
 | |
|               "type": "LabeledArg",
 | |
|               "label": {
 | |
|                 "commentStart": 0,
 | |
|                 "end": 0,
 | |
|                 "name": "error",
 | |
|                 "start": 0,
 | |
|                 "type": "Identifier"
 | |
|               },
 | |
|               "arg": {
 | |
|                 "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": "assert",
 | |
|               "start": 0,
 | |
|               "type": "Identifier"
 | |
|             },
 | |
|             "path": [],
 | |
|             "start": 0,
 | |
|             "type": "Name"
 | |
|           },
 | |
|           "commentStart": 0,
 | |
|           "end": 0,
 | |
|           "start": 0,
 | |
|           "type": "CallExpressionKw",
 | |
|           "type": "CallExpressionKw",
 | |
|           "unlabeled": {
 | |
|             "abs_path": false,
 | |
|             "commentStart": 0,
 | |
|             "end": 0,
 | |
|             "name": {
 | |
|               "commentStart": 0,
 | |
|               "end": 0,
 | |
|               "name": "result1",
 | |
|               "start": 0,
 | |
|               "type": "Identifier"
 | |
|             },
 | |
|             "path": [],
 | |
|             "start": 0,
 | |
|             "type": "Name",
 | |
|             "type": "Name"
 | |
|           }
 | |
|         },
 | |
|         "start": 0,
 | |
|         "type": "ExpressionStatement",
 | |
|         "type": "ExpressionStatement"
 | |
|       },
 | |
|       {
 | |
|         "commentStart": 0,
 | |
|         "end": 0,
 | |
|         "expression": {
 | |
|           "arguments": [
 | |
|             {
 | |
|               "type": "LabeledArg",
 | |
|               "label": {
 | |
|                 "commentStart": 0,
 | |
|                 "end": 0,
 | |
|                 "name": "isGreaterThanOrEqual",
 | |
|                 "start": 0,
 | |
|                 "type": "Identifier"
 | |
|               },
 | |
|               "arg": {
 | |
|                 "commentStart": 0,
 | |
|                 "end": 0,
 | |
|                 "raw": "91",
 | |
|                 "start": 0,
 | |
|                 "type": "Literal",
 | |
|                 "type": "Literal",
 | |
|                 "value": {
 | |
|                   "value": 91.0,
 | |
|                   "suffix": "None"
 | |
|                 }
 | |
|               }
 | |
|             },
 | |
|             {
 | |
|               "type": "LabeledArg",
 | |
|               "label": {
 | |
|                 "commentStart": 0,
 | |
|                 "end": 0,
 | |
|                 "name": "error",
 | |
|                 "start": 0,
 | |
|                 "type": "Identifier"
 | |
|               },
 | |
|               "arg": {
 | |
|                 "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": "assert",
 | |
|               "start": 0,
 | |
|               "type": "Identifier"
 | |
|             },
 | |
|             "path": [],
 | |
|             "start": 0,
 | |
|             "type": "Name"
 | |
|           },
 | |
|           "commentStart": 0,
 | |
|           "end": 0,
 | |
|           "start": 0,
 | |
|           "type": "CallExpressionKw",
 | |
|           "type": "CallExpressionKw",
 | |
|           "unlabeled": {
 | |
|             "abs_path": false,
 | |
|             "commentStart": 0,
 | |
|             "end": 0,
 | |
|             "name": {
 | |
|               "commentStart": 0,
 | |
|               "end": 0,
 | |
|               "name": "result1",
 | |
|               "start": 0,
 | |
|               "type": "Identifier"
 | |
|             },
 | |
|             "path": [],
 | |
|             "start": 0,
 | |
|             "type": "Name",
 | |
|             "type": "Name"
 | |
|           }
 | |
|         },
 | |
|         "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: literal index.",
 | |
|               "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: computed index.",
 | |
|               "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"
 | |
|             }
 | |
|           }
 | |
|         ]
 | |
|       },
 | |
|       "startNodes": [
 | |
|         {
 | |
|           "commentStart": 0,
 | |
|           "end": 0,
 | |
|           "start": 0,
 | |
|           "type": "NonCodeNode",
 | |
|           "value": {
 | |
|             "type": "blockComment",
 | |
|             "value": "This tests indexing an array.",
 | |
|             "style": "line"
 | |
|           }
 | |
|         },
 | |
|         {
 | |
|           "commentStart": 0,
 | |
|           "end": 0,
 | |
|           "start": 0,
 | |
|           "type": "NonCodeNode",
 | |
|           "value": {
 | |
|             "type": "newLine"
 | |
|           }
 | |
|         }
 | |
|       ]
 | |
|     },
 | |
|     "start": 0
 | |
|   }
 | |
| }
 |