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

277 lines
6.8 KiB

{
"kind" : "Program",
"location" : [ 1, 1, 20, 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 ],
"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 ],
"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 ],
"value" : 3
}
}, {
"kind" : "FuncDef",
"location" : [ 5, 1, 14, 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 ],
"value" : 4
}
}, {
"kind" : "VarDef",
"location" : [ 7, 5, 7, 13 ],
"var" : {
"kind" : "TypedVar",
"location" : [ 7, 5, 7, 9 ],
"identifier" : {
"kind" : "Identifier",
"location" : [ 7, 5, 7, 5 ],
"errorMsg" : "Duplicate declaration of identifier in same scope: x",
"name" : "x"
},
"type" : {
"kind" : "ClassType",
"location" : [ 7, 7, 7, 9 ],
"className" : "int"
}
},
"value" : {
"kind" : "IntegerLiteral",
"location" : [ 7, 13, 7, 13 ],
"value" : 5
}
}, {
"kind" : "GlobalDecl",
"location" : [ 8, 5, 8, 12 ],
"variable" : {
"kind" : "Identifier",
"location" : [ 8, 12, 8, 12 ],
"name" : "z"
}
}, {
"kind" : "GlobalDecl",
"location" : [ 9, 5, 9, 12 ],
"variable" : {
"kind" : "Identifier",
"location" : [ 9, 12, 9, 12 ],
"errorMsg" : "Duplicate declaration of identifier in same scope: y",
"name" : "y"
}
}, {
"kind" : "FuncDef",
"location" : [ 11, 5, 12, 17 ],
"name" : {
"kind" : "Identifier",
"location" : [ 11, 9, 11, 9 ],
"errorMsg" : "Duplicate declaration of identifier in same scope: x",
"name" : "x"
},
"params" : [ ],
"returnType" : {
"kind" : "ClassType",
"location" : [ 11, 16, 11, 18 ],
"className" : "int"
},
"declarations" : [ ],
"statements" : [ {
"kind" : "ReturnStmt",
"location" : [ 12, 9, 12, 16 ],
"value" : {
"kind" : "IntegerLiteral",
"location" : [ 12, 16, 12, 16 ],
"value" : 0
}
} ]
} ],
"statements" : [ ]
}, {
"kind" : "FuncDef",
"location" : [ 16, 1, 17, 13 ],
"name" : {
"kind" : "Identifier",
"location" : [ 16, 5, 16, 7 ],
"name" : "bar"
},
"params" : [ {
"kind" : "TypedVar",
"location" : [ 16, 9, 16, 13 ],
"identifier" : {
"kind" : "Identifier",
"location" : [ 16, 9, 16, 9 ],
"name" : "x"
},
"type" : {
"kind" : "ClassType",
"location" : [ 16, 11, 16, 13 ],
"className" : "int"
}
}, {
"kind" : "TypedVar",
"location" : [ 16, 16, 16, 20 ],
"identifier" : {
"kind" : "Identifier",
"location" : [ 16, 16, 16, 16 ],
"errorMsg" : "Duplicate declaration of identifier in same scope: x",
"name" : "x"
},
"type" : {
"kind" : "ClassType",
"location" : [ 16, 18, 16, 20 ],
"className" : "int"
}
} ],
"returnType" : {
"kind" : "ClassType",
"location" : [ 16, 26, 16, 28 ],
"className" : "int"
},
"declarations" : [ ],
"statements" : [ {
"kind" : "ReturnStmt",
"location" : [ 17, 5, 17, 12 ],
"value" : {
"kind" : "Identifier",
"location" : [ 17, 12, 17, 12 ],
"name" : "x"
}
} ]
} ],
"statements" : [ {
"kind" : "ExprStmt",
"location" : [ 20, 1, 20, 6 ],
"expr" : {
"kind" : "CallExpr",
"location" : [ 20, 1, 20, 6 ],
"function" : {
"kind" : "Identifier",
"location" : [ 20, 1, 20, 3 ],
"name" : "foo"
},
"args" : [ {
"kind" : "IntegerLiteral",
"location" : [ 20, 5, 20, 5 ],
"value" : 1
} ]
}
} ],
"errors" : {
"errors" : [ {
"kind" : "CompilerError",
"location" : [ 7, 5, 7, 5 ],
"message" : "Duplicate declaration of identifier in same scope: x"
}, {
"kind" : "CompilerError",
"location" : [ 9, 12, 9, 12 ],
"message" : "Duplicate declaration of identifier in same scope: y"
}, {
"kind" : "CompilerError",
"location" : [ 11, 9, 11, 9 ],
"message" : "Duplicate declaration of identifier in same scope: x"
}, {
"kind" : "CompilerError",
"location" : [ 16, 16, 16, 16 ],
"message" : "Duplicate declaration of identifier in same scope: x"
} ],
"kind" : "Errors",
"location" : [ 0, 0, 0, 0 ]
}
}