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/pa1-tests/core/def_func_global.py.ast

105 lines
2.3 KiB

{
"kind" : "Program",
"location" : [ 1, 1, 7, 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" : "z"
},
"type" : {
"kind" : "ClassType",
"location" : [ 1, 3, 1, 5 ],
"className" : "int"
}
},
"value" : {
"kind" : "IntegerLiteral",
"location" : [ 1, 9, 1, 9 ],
"value" : 0
}
}, {
"kind" : "FuncDef",
"location" : [ 3, 1, 5, 17 ],
"name" : {
"kind" : "Identifier",
"location" : [ 3, 5, 3, 7 ],
"name" : "foo"
},
"params" : [ {
"kind" : "TypedVar",
"location" : [ 3, 9, 3, 13 ],
"identifier" : {
"kind" : "Identifier",
"location" : [ 3, 9, 3, 9 ],
"name" : "x"
},
"type" : {
"kind" : "ClassType",
"location" : [ 3, 11, 3, 13 ],
"className" : "int"
}
} ],
"returnType" : {
"kind" : "ClassType",
"location" : [ 3, 19, 3, 22 ],
"className" : "bool"
},
"declarations" : [ {
"kind" : "GlobalDecl",
"location" : [ 4, 5, 4, 12 ],
"variable" : {
"kind" : "Identifier",
"location" : [ 4, 12, 4, 12 ],
"name" : "z"
}
} ],
"statements" : [ {
"kind" : "ReturnStmt",
"location" : [ 5, 5, 5, 16 ],
"value" : {
"kind" : "BinaryExpr",
"location" : [ 5, 12, 5, 16 ],
"left" : {
"kind" : "Identifier",
"location" : [ 5, 12, 5, 12 ],
"name" : "x"
},
"operator" : ">",
"right" : {
"kind" : "Identifier",
"location" : [ 5, 16, 5, 16 ],
"name" : "z"
}
}
} ]
} ],
"statements" : [ {
"kind" : "ExprStmt",
"location" : [ 7, 1, 7, 6 ],
"expr" : {
"kind" : "CallExpr",
"location" : [ 7, 1, 7, 6 ],
"function" : {
"kind" : "Identifier",
"location" : [ 7, 1, 7, 3 ],
"name" : "foo"
},
"args" : [ {
"kind" : "IntegerLiteral",
"location" : [ 7, 5, 7, 5 ],
"value" : 1
} ]
}
} ],
"errors" : {
"errors" : [ ],
"kind" : "Errors",
"location" : [ 0, 0, 0, 0 ]
}
}