You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ChocoPy/pa2-tests/core/bad_local_assign.py.ast.typed

330 lines
8.1 KiB

{
"kind" : "Program",
"location" : [ 1, 1, 22, 7 ],
"declarations" : [ {
"kind" : "VarDef",
"location" : [ 1, 1, 1, 9 ],
"var" : {
"kind" : "TypedVar",
"location" : [ 1, 1, 1, 5 ],
"identifier" : {
"kind" : "Identifier",
"location" : [ 1, 1, 1, 1 ],
"name" : "x"
},
"type" : {
"kind" : "ClassType",
"location" : [ 1, 3, 1, 5 ],
"className" : "int"
}
},
"value" : {
"kind" : "IntegerLiteral",
"location" : [ 1, 9, 1, 9 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"value" : 1
}
}, {
"kind" : "VarDef",
"location" : [ 2, 1, 2, 9 ],
"var" : {
"kind" : "TypedVar",
"location" : [ 2, 1, 2, 5 ],
"identifier" : {
"kind" : "Identifier",
"location" : [ 2, 1, 2, 1 ],
"name" : "y"
},
"type" : {
"kind" : "ClassType",
"location" : [ 2, 3, 2, 5 ],
"className" : "int"
}
},
"value" : {
"kind" : "IntegerLiteral",
"location" : [ 2, 9, 2, 9 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"value" : 2
}
}, {
"kind" : "VarDef",
"location" : [ 3, 1, 3, 9 ],
"var" : {
"kind" : "TypedVar",
"location" : [ 3, 1, 3, 5 ],
"identifier" : {
"kind" : "Identifier",
"location" : [ 3, 1, 3, 1 ],
"name" : "z"
},
"type" : {
"kind" : "ClassType",
"location" : [ 3, 3, 3, 5 ],
"className" : "int"
}
},
"value" : {
"kind" : "IntegerLiteral",
"location" : [ 3, 9, 3, 9 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"value" : 3
}
}, {
"kind" : "FuncDef",
"location" : [ 5, 1, 15, 9 ],
"name" : {
"kind" : "Identifier",
"location" : [ 5, 5, 5, 7 ],
"name" : "foo"
},
"params" : [ {
"kind" : "TypedVar",
"location" : [ 5, 9, 5, 13 ],
"identifier" : {
"kind" : "Identifier",
"location" : [ 5, 9, 5, 9 ],
"name" : "x"
},
"type" : {
"kind" : "ClassType",
"location" : [ 5, 11, 5, 13 ],
"className" : "int"
}
} ],
"returnType" : {
"kind" : "ClassType",
"location" : [ 5, 19, 5, 24 ],
"className" : "object"
},
"declarations" : [ {
"kind" : "VarDef",
"location" : [ 6, 5, 6, 13 ],
"var" : {
"kind" : "TypedVar",
"location" : [ 6, 5, 6, 9 ],
"identifier" : {
"kind" : "Identifier",
"location" : [ 6, 5, 6, 5 ],
"name" : "y"
},
"type" : {
"kind" : "ClassType",
"location" : [ 6, 7, 6, 9 ],
"className" : "int"
}
},
"value" : {
"kind" : "IntegerLiteral",
"location" : [ 6, 13, 6, 13 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"value" : 4
}
}, {
"kind" : "GlobalDecl",
"location" : [ 7, 5, 7, 12 ],
"variable" : {
"kind" : "Identifier",
"location" : [ 7, 12, 7, 12 ],
"name" : "z"
}
}, {
"kind" : "FuncDef",
"location" : [ 9, 5, 11, 17 ],
"name" : {
"kind" : "Identifier",
"location" : [ 9, 9, 9, 11 ],
"name" : "qux"
},
"params" : [ ],
"returnType" : {
"kind" : "ClassType",
"location" : [ 9, 18, 9, 20 ],
"className" : "int"
},
"declarations" : [ ],
"statements" : [ {
"kind" : "AssignStmt",
"location" : [ 10, 9, 10, 13 ],
"targets" : [ {
"kind" : "Identifier",
"location" : [ 10, 9, 10, 9 ],
"errorMsg" : "Cannot assign to variable that is not explicitly declared in this scope: y",
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"name" : "y"
} ],
"value" : {
"kind" : "IntegerLiteral",
"location" : [ 10, 13, 10, 13 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"value" : 1
}
}, {
"kind" : "ReturnStmt",
"location" : [ 11, 9, 11, 16 ],
"value" : {
"kind" : "IntegerLiteral",
"location" : [ 11, 16, 11, 16 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"value" : 0
}
} ]
} ],
"statements" : [ {
"kind" : "AssignStmt",
"location" : [ 13, 5, 13, 9 ],
"targets" : [ {
"kind" : "Identifier",
"location" : [ 13, 5, 13, 5 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"name" : "z"
} ],
"value" : {
"kind" : "IntegerLiteral",
"location" : [ 13, 9, 13, 9 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"value" : 1
}
} ]
}, {
"kind" : "FuncDef",
"location" : [ 17, 1, 19, 13 ],
"name" : {
"kind" : "Identifier",
"location" : [ 17, 5, 17, 7 ],
"name" : "bar"
},
"params" : [ {
"kind" : "TypedVar",
"location" : [ 17, 9, 17, 13 ],
"identifier" : {
"kind" : "Identifier",
"location" : [ 17, 9, 17, 9 ],
"name" : "x"
},
"type" : {
"kind" : "ClassType",
"location" : [ 17, 11, 17, 13 ],
"className" : "int"
}
} ],
"returnType" : {
"kind" : "ClassType",
"location" : [ 17, 19, 17, 21 ],
"className" : "int"
},
"declarations" : [ ],
"statements" : [ {
"kind" : "AssignStmt",
"location" : [ 18, 5, 18, 9 ],
"targets" : [ {
"kind" : "Identifier",
"location" : [ 18, 5, 18, 5 ],
"errorMsg" : "Cannot assign to variable that is not explicitly declared in this scope: z",
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"name" : "z"
} ],
"value" : {
"kind" : "IntegerLiteral",
"location" : [ 18, 9, 18, 9 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"value" : 1
}
}, {
"kind" : "ReturnStmt",
"location" : [ 19, 5, 19, 12 ],
"value" : {
"kind" : "Identifier",
"location" : [ 19, 12, 19, 12 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"name" : "x"
}
} ]
} ],
"statements" : [ {
"kind" : "ExprStmt",
"location" : [ 22, 1, 22, 6 ],
"expr" : {
"kind" : "CallExpr",
"location" : [ 22, 1, 22, 6 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "object"
},
"function" : {
"kind" : "Identifier",
"location" : [ 22, 1, 22, 3 ],
"inferredType" : {
"kind" : "FuncType",
"parameters" : [ {
"kind" : "ClassValueType",
"className" : "int"
} ],
"returnType" : {
"kind" : "ClassValueType",
"className" : "object"
}
},
"name" : "foo"
},
"args" : [ {
"kind" : "IntegerLiteral",
"location" : [ 22, 5, 22, 5 ],
"inferredType" : {
"kind" : "ClassValueType",
"className" : "int"
},
"value" : 1
} ]
}
} ],
"errors" : {
"errors" : [ {
"kind" : "CompilerError",
"location" : [ 10, 9, 10, 9 ],
"message" : "Cannot assign to variable that is not explicitly declared in this scope: y"
}, {
"kind" : "CompilerError",
"location" : [ 18, 5, 18, 5 ],
"message" : "Cannot assign to variable that is not explicitly declared in this scope: z"
} ],
"kind" : "Errors",
"location" : [ 0, 0, 0, 0 ]
}
}