{ "kind" : "Program", "location" : [ 1, 1, 17, 10 ], "declarations" : [ { "kind" : "VarDef", "location" : [ 1, 1, 1, 11 ], "var" : { "kind" : "TypedVar", "location" : [ 1, 1, 1, 7 ], "identifier" : { "kind" : "Identifier", "location" : [ 1, 1, 1, 1 ], "name" : "x" }, "type" : { "kind" : "ClassType", "location" : [ 1, 5, 1, 7 ], "className" : "int" } }, "value" : { "kind" : "IntegerLiteral", "location" : [ 1, 11, 1, 11 ], "value" : 0 } }, { "kind" : "VarDef", "location" : [ 2, 1, 2, 11 ], "var" : { "kind" : "TypedVar", "location" : [ 2, 1, 2, 7 ], "identifier" : { "kind" : "Identifier", "location" : [ 2, 1, 2, 1 ], "name" : "y" }, "type" : { "kind" : "ClassType", "location" : [ 2, 5, 2, 7 ], "className" : "int" } }, "value" : { "kind" : "IntegerLiteral", "location" : [ 2, 11, 2, 11 ], "value" : 5 } }, { "kind" : "VarDef", "location" : [ 3, 1, 3, 14 ], "var" : { "kind" : "TypedVar", "location" : [ 3, 1, 3, 7 ], "identifier" : { "kind" : "Identifier", "location" : [ 3, 1, 3, 1 ], "name" : "z" }, "type" : { "kind" : "ClassType", "location" : [ 3, 5, 3, 7 ], "className" : "Foo" } }, "value" : { "kind" : "NoneLiteral", "location" : [ 3, 11, 3, 14 ] } }, { "kind" : "ClassDef", "location" : [ 4, 1, 5, 16 ], "name" : { "kind" : "Identifier", "location" : [ 4, 7, 4, 9 ], "name" : "Foo" }, "superClass" : { "kind" : "Identifier", "location" : [ 4, 11, 4, 16 ], "name" : "object" }, "declarations" : [ { "kind" : "VarDef", "location" : [ 5, 5, 5, 15 ], "var" : { "kind" : "TypedVar", "location" : [ 5, 5, 5, 11 ], "identifier" : { "kind" : "Identifier", "location" : [ 5, 5, 5, 5 ], "name" : "x" }, "type" : { "kind" : "ClassType", "location" : [ 5, 9, 5, 11 ], "className" : "int" } }, "value" : { "kind" : "IntegerLiteral", "location" : [ 5, 15, 5, 15 ], "value" : 3 } } ] }, { "kind" : "FuncDef", "location" : [ 6, 1, 15, 13 ], "name" : { "kind" : "Identifier", "location" : [ 6, 5, 6, 7 ], "name" : "foo" }, "params" : [ { "kind" : "TypedVar", "location" : [ 6, 9, 6, 15 ], "identifier" : { "kind" : "Identifier", "location" : [ 6, 9, 6, 9 ], "name" : "x" }, "type" : { "kind" : "ClassType", "location" : [ 6, 13, 6, 15 ], "className" : "int" } } ], "returnType" : { "kind" : "ClassType", "location" : [ 6, 21, 6, 23 ], "className" : "int" }, "declarations" : [ { "kind" : "VarDef", "location" : [ 7, 5, 7, 20 ], "var" : { "kind" : "TypedVar", "location" : [ 7, 5, 7, 11 ], "identifier" : { "kind" : "Identifier", "location" : [ 7, 5, 7, 5 ], "name" : "y" }, "type" : { "kind" : "ClassType", "location" : [ 7, 9, 7, 11 ], "className" : "str" } }, "value" : { "kind" : "StringLiteral", "location" : [ 7, 15, 7, 20 ], "value" : "test" } }, { "kind" : "FuncDef", "location" : [ 8, 5, 10, 17 ], "name" : { "kind" : "Identifier", "location" : [ 8, 9, 8, 12 ], "name" : "foo2" }, "params" : [ ], "returnType" : { "kind" : "ClassType", "location" : [ 8, 19, 8, 21 ], "className" : "str" }, "declarations" : [ { "kind" : "NonLocalDecl", "location" : [ 9, 9, 9, 18 ], "variable" : { "kind" : "Identifier", "location" : [ 9, 18, 9, 18 ], "name" : "y" } } ], "statements" : [ { "kind" : "ReturnStmt", "location" : [ 10, 9, 10, 16 ], "value" : { "kind" : "Identifier", "location" : [ 10, 16, 10, 16 ], "name" : "y" } } ] }, { "kind" : "NonLocalDecl", "location" : [ 11, 5, 11, 14 ], "variable" : { "kind" : "Identifier", "location" : [ 11, 14, 11, 14 ], "errorMsg" : "Duplicate declaration of identifier in same scope: x", "name" : "x" } } ], "statements" : [ { "kind" : "ReturnStmt", "location" : [ 15, 5, 15, 12 ], "value" : { "kind" : "Identifier", "location" : [ 15, 12, 15, 12 ], "name" : "x" } } ] } ], "statements" : [ { "kind" : "AssignStmt", "location" : [ 16, 1, 16, 11 ], "targets" : [ { "kind" : "Identifier", "location" : [ 16, 1, 16, 1 ], "name" : "x" } ], "value" : { "kind" : "BinaryExpr", "location" : [ 16, 5, 16, 11 ], "left" : { "kind" : "IntegerLiteral", "location" : [ 16, 5, 16, 5 ], "value" : 1 }, "operator" : "and", "right" : { "kind" : "IntegerLiteral", "location" : [ 16, 11, 16, 11 ], "value" : 2 } } }, { "kind" : "ExprStmt", "location" : [ 17, 1, 17, 9 ], "expr" : { "kind" : "CallExpr", "location" : [ 17, 1, 17, 9 ], "function" : { "kind" : "Identifier", "location" : [ 17, 1, 17, 3 ], "name" : "foo" }, "args" : [ { "kind" : "Identifier", "location" : [ 17, 5, 17, 5 ], "name" : "y" }, { "kind" : "IntegerLiteral", "location" : [ 17, 8, 17, 8 ], "value" : 5 } ] } } ], "errors" : { "errors" : [ { "kind" : "CompilerError", "location" : [ 11, 14, 11, 14 ], "message" : "Duplicate declaration of identifier in same scope: x" } ], "kind" : "Errors", "location" : [ 0, 0, 0, 0 ] } }