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_nested.py.ast

187 lines
4.5 KiB

{
"kind" : "Program",
"location" : [ 2, 1, 10, 7 ],
"declarations" : [ {
"kind" : "FuncDef",
"location" : [ 2, 1, 8, 22 ],
"name" : {
"kind" : "Identifier",
"location" : [ 2, 5, 2, 7 ],
"name" : "foo"
},
"params" : [ {
"kind" : "TypedVar",
"location" : [ 2, 9, 2, 13 ],
"identifier" : {
"kind" : "Identifier",
"location" : [ 2, 9, 2, 9 ],
"name" : "x"
},
"type" : {
"kind" : "ClassType",
"location" : [ 2, 11, 2, 13 ],
"className" : "int"
}
} ],
"returnType" : {
"kind" : "ClassType",
"location" : [ 2, 19, 2, 22 ],
"className" : "bool"
},
"declarations" : [ {
"kind" : "VarDef",
"location" : [ 3, 5, 3, 13 ],
"var" : {
"kind" : "TypedVar",
"location" : [ 3, 5, 3, 9 ],
"identifier" : {
"kind" : "Identifier",
"location" : [ 3, 5, 3, 5 ],
"name" : "a"
},
"type" : {
"kind" : "ClassType",
"location" : [ 3, 7, 3, 9 ],
"className" : "int"
}
},
"value" : {
"kind" : "IntegerLiteral",
"location" : [ 3, 13, 3, 13 ],
"value" : 0
}
}, {
"kind" : "VarDef",
"location" : [ 4, 5, 4, 13 ],
"var" : {
"kind" : "TypedVar",
"location" : [ 4, 5, 4, 9 ],
"identifier" : {
"kind" : "Identifier",
"location" : [ 4, 5, 4, 5 ],
"name" : "b"
},
"type" : {
"kind" : "ClassType",
"location" : [ 4, 7, 4, 9 ],
"className" : "int"
}
},
"value" : {
"kind" : "IntegerLiteral",
"location" : [ 4, 13, 4, 13 ],
"value" : 1
}
}, {
"kind" : "FuncDef",
"location" : [ 5, 5, 7, 17 ],
"name" : {
"kind" : "Identifier",
"location" : [ 5, 9, 5, 11 ],
"name" : "bar"
},
"params" : [ {
"kind" : "TypedVar",
"location" : [ 5, 13, 5, 18 ],
"identifier" : {
"kind" : "Identifier",
"location" : [ 5, 13, 5, 13 ],
"name" : "y"
},
"type" : {
"kind" : "ClassType",
"location" : [ 5, 16, 5, 18 ],
"className" : "int"
}
} ],
"returnType" : {
"kind" : "ClassType",
"location" : [ 5, 24, 5, 26 ],
"className" : "int"
},
"declarations" : [ {
"kind" : "VarDef",
"location" : [ 6, 9, 6, 17 ],
"var" : {
"kind" : "TypedVar",
"location" : [ 6, 9, 6, 13 ],
"identifier" : {
"kind" : "Identifier",
"location" : [ 6, 9, 6, 9 ],
"name" : "a"
},
"type" : {
"kind" : "ClassType",
"location" : [ 6, 11, 6, 13 ],
"className" : "int"
}
},
"value" : {
"kind" : "IntegerLiteral",
"location" : [ 6, 17, 6, 17 ],
"value" : 2
}
} ],
"statements" : [ {
"kind" : "ReturnStmt",
"location" : [ 7, 9, 7, 16 ],
"value" : {
"kind" : "Identifier",
"location" : [ 7, 16, 7, 16 ],
"name" : "y"
}
} ]
} ],
"statements" : [ {
"kind" : "ReturnStmt",
"location" : [ 8, 5, 8, 21 ],
"value" : {
"kind" : "BinaryExpr",
"location" : [ 8, 12, 8, 21 ],
"left" : {
"kind" : "CallExpr",
"location" : [ 8, 12, 8, 17 ],
"function" : {
"kind" : "Identifier",
"location" : [ 8, 12, 8, 14 ],
"name" : "bar"
},
"args" : [ {
"kind" : "Identifier",
"location" : [ 8, 16, 8, 16 ],
"name" : "x"
} ]
},
"operator" : ">",
"right" : {
"kind" : "Identifier",
"location" : [ 8, 21, 8, 21 ],
"name" : "a"
}
}
} ]
} ],
"statements" : [ {
"kind" : "ExprStmt",
"location" : [ 10, 1, 10, 6 ],
"expr" : {
"kind" : "CallExpr",
"location" : [ 10, 1, 10, 6 ],
"function" : {
"kind" : "Identifier",
"location" : [ 10, 1, 10, 3 ],
"name" : "foo"
},
"args" : [ {
"kind" : "IntegerLiteral",
"location" : [ 10, 5, 10, 5 ],
"value" : 1
} ]
}
} ],
"errors" : {
"errors" : [ ],
"kind" : "Errors",
"location" : [ 0, 0, 0, 0 ]
}
}