php2go/fixtures/0001.php.parse.json

1168 lines
32 KiB
JSON

{
"type": "*node.Root",
"position": {
"startPos": 7,
"endPos": 400,
"startLine": 3,
"endLine": 30
},
"Stmts": [
{
"type": "*stmt.Class",
"position": {
"startPos": 7,
"endPos": 250,
"startLine": 3,
"endLine": 19
},
"PhpDocComment": "",
"ClassName": {
"type": "*node.Identifier",
"position": {
"startPos": 13,
"endPos": 16,
"startLine": 3,
"endLine": 3
},
"Value": "Bar"
},
"Stmts": [
{
"type": "*stmt.PropertyList",
"position": {
"startPos": 20,
"endPos": 41,
"startLine": 4,
"endLine": 4
},
"Modifiers": [
{
"type": "*node.Identifier",
"position": {
"startPos": 20,
"endPos": 29,
"startLine": 4,
"endLine": 4
},
"Value": "protected"
}
],
"Properties": [
{
"type": "*stmt.Property",
"position": {
"startPos": 30,
"endPos": 40,
"startLine": 4,
"endLine": 4
},
"PhpDocComment": "",
"Variable": {
"type": "*expr.Variable",
"position": {
"startPos": 30,
"endPos": 33,
"startLine": 4,
"endLine": 4
},
"VarName": {
"type": "*node.Identifier",
"position": {
"startPos": 30,
"endPos": 33,
"startLine": 4,
"endLine": 4
},
"Value": "mX"
}
},
"Expr": {
"type": "*expr.ConstFetch",
"position": {
"startPos": 36,
"endPos": 40,
"startLine": 4,
"endLine": 4
},
"Constant": {
"type": "*name.Name",
"position": {
"startPos": 36,
"endPos": 40,
"startLine": 4,
"endLine": 4
},
"Parts": [
{
"type": "*name.NamePart",
"position": {
"startPos": 36,
"endPos": 40,
"startLine": 4,
"endLine": 4
},
"Value": "null"
}
]
}
}
}
]
},
{
"type": "*stmt.PropertyList",
"position": {
"startPos": 43,
"endPos": 61,
"startLine": 5,
"endLine": 5
},
"Modifiers": [
{
"type": "*node.Identifier",
"position": {
"startPos": 43,
"endPos": 52,
"startLine": 5,
"endLine": 5
},
"Value": "protected"
}
],
"Properties": [
{
"type": "*stmt.Property",
"position": {
"startPos": 53,
"endPos": 60,
"startLine": 5,
"endLine": 5
},
"PhpDocComment": "",
"Variable": {
"type": "*expr.Variable",
"position": {
"startPos": 53,
"endPos": 56,
"startLine": 5,
"endLine": 5
},
"VarName": {
"type": "*node.Identifier",
"position": {
"startPos": 53,
"endPos": 56,
"startLine": 5,
"endLine": 5
},
"Value": "mY"
}
},
"Expr": {
"type": "*scalar.Lnumber",
"position": {
"startPos": 59,
"endPos": 60,
"startLine": 5,
"endLine": 5
},
"Value": "3"
}
}
]
},
{
"type": "*stmt.ClassMethod",
"position": {
"startPos": 65,
"endPos": 119,
"startLine": 7,
"endLine": 9
},
"PhpDocComment": "",
"ReturnsRef": false,
"MethodName": {
"type": "*node.Identifier",
"position": {
"startPos": 74,
"endPos": 85,
"startLine": 7,
"endLine": 7
},
"Value": "__construct"
},
"Params": [
{
"type": "*node.Parameter",
"position": {
"startPos": 86,
"endPos": 95,
"startLine": 7,
"endLine": 7
},
"ByRef": false,
"Variadic": false,
"VariableType": {
"type": "*name.Name",
"position": {
"startPos": 86,
"endPos": 92,
"startLine": 7,
"endLine": 7
},
"Parts": [
{
"type": "*name.NamePart",
"position": {
"startPos": 86,
"endPos": 92,
"startLine": 7,
"endLine": 7
},
"Value": "string"
}
]
},
"Variable": {
"type": "*expr.Variable",
"position": {
"startPos": 93,
"endPos": 95,
"startLine": 7,
"endLine": 7
},
"VarName": {
"type": "*node.Identifier",
"position": {
"startPos": 93,
"endPos": 95,
"startLine": 7,
"endLine": 7
},
"Value": "x"
}
}
}
],
"Stmt": {
"type": "*stmt.StmtList",
"position": {
"startPos": 97,
"endPos": 119,
"startLine": 7,
"endLine": 9
},
"Stmts": [
{
"type": "*stmt.Expression",
"position": {
"startPos": 101,
"endPos": 116,
"startLine": 8,
"endLine": 8
},
"Expr": {
"type": "*assign.Assign",
"position": {
"startPos": 101,
"endPos": 115,
"startLine": 8,
"endLine": 8
},
"Variable": {
"type": "*expr.PropertyFetch",
"position": {
"startPos": 101,
"endPos": 110,
"startLine": 8,
"endLine": 8
},
"Variable": {
"type": "*expr.Variable",
"position": {
"startPos": 101,
"endPos": 106,
"startLine": 8,
"endLine": 8
},
"VarName": {
"type": "*node.Identifier",
"position": {
"startPos": 101,
"endPos": 106,
"startLine": 8,
"endLine": 8
},
"Value": "this"
}
},
"Property": {
"type": "*node.Identifier",
"position": {
"startPos": 108,
"endPos": 110,
"startLine": 8,
"endLine": 8
},
"Value": "mX"
}
},
"Expression": {
"type": "*expr.Variable",
"position": {
"startPos": 113,
"endPos": 115,
"startLine": 8,
"endLine": 8
},
"VarName": {
"type": "*node.Identifier",
"position": {
"startPos": 113,
"endPos": 115,
"startLine": 8,
"endLine": 8
},
"Value": "x"
}
}
}
}
]
}
},
{
"type": "*stmt.ClassMethod",
"position": {
"startPos": 123,
"endPos": 200,
"startLine": 11,
"endLine": 14
},
"PhpDocComment": "",
"ReturnsRef": false,
"MethodName": {
"type": "*node.Identifier",
"position": {
"startPos": 132,
"endPos": 137,
"startLine": 11,
"endLine": 11
},
"Value": "hello"
},
"Stmt": {
"type": "*stmt.StmtList",
"position": {
"startPos": 140,
"endPos": 200,
"startLine": 11,
"endLine": 14
},
"Stmts": [
{
"type": "*stmt.Echo",
"position": {
"startPos": 144,
"endPos": 166,
"startLine": 12,
"endLine": 12
},
"Exprs": [
{
"type": "*binary.Concat",
"position": {
"startPos": 149,
"endPos": 165,
"startLine": 12,
"endLine": 12
},
"Left": {
"type": "*expr.PropertyFetch",
"position": {
"startPos": 149,
"endPos": 158,
"startLine": 12,
"endLine": 12
},
"Variable": {
"type": "*expr.Variable",
"position": {
"startPos": 149,
"endPos": 154,
"startLine": 12,
"endLine": 12
},
"VarName": {
"type": "*node.Identifier",
"position": {
"startPos": 149,
"endPos": 154,
"startLine": 12,
"endLine": 12
},
"Value": "this"
}
},
"Property": {
"type": "*node.Identifier",
"position": {
"startPos": 156,
"endPos": 158,
"startLine": 12,
"endLine": 12
},
"Value": "mX"
}
},
"Right": {
"type": "*scalar.String",
"position": {
"startPos": 161,
"endPos": 165,
"startLine": 12,
"endLine": 12
},
"Value": "\"\\n\""
}
}
]
},
{
"type": "*stmt.Throw",
"position": {
"startPos": 169,
"endPos": 197,
"startLine": 13,
"endLine": 13
},
"Expr": {
"type": "*expr.New",
"position": {
"startPos": 175,
"endPos": 196,
"startLine": 13,
"endLine": 13
},
"Class": {
"type": "*name.Name",
"position": {
"startPos": 179,
"endPos": 188,
"startLine": 13,
"endLine": 13
},
"Parts": [
{
"type": "*name.NamePart",
"position": {
"startPos": 179,
"endPos": 188,
"startLine": 13,
"endLine": 13
},
"Value": "Exception"
}
]
},
"ArgumentList": {
"type": "*node.ArgumentList",
"position": {
"startPos": 188,
"endPos": 196,
"startLine": 13,
"endLine": 13
},
"Arguments": [
{
"type": "*node.Argument",
"position": {
"startPos": 189,
"endPos": 195,
"startLine": 13,
"endLine": 13
},
"Variadic": false,
"IsReference": false,
"Expr": {
"type": "*scalar.String",
"position": {
"startPos": 189,
"endPos": 195,
"startLine": 13,
"endLine": 13
},
"Value": "\"asdf\""
}
}
]
}
}
}
]
}
},
{
"type": "*stmt.ClassMethod",
"position": {
"startPos": 204,
"endPos": 248,
"startLine": 16,
"endLine": 18
},
"ReturnsRef": false,
"PhpDocComment": "",
"MethodName": {
"type": "*node.Identifier",
"position": {
"startPos": 213,
"endPos": 226,
"startLine": 16,
"endLine": 16
},
"Value": "scalarThrower"
},
"Stmt": {
"type": "*stmt.StmtList",
"position": {
"startPos": 229,
"endPos": 248,
"startLine": 16,
"endLine": 18
},
"Stmts": [
{
"type": "*stmt.Throw",
"position": {
"startPos": 233,
"endPos": 245,
"startLine": 17,
"endLine": 17
},
"Expr": {
"type": "*scalar.String",
"position": {
"startPos": 239,
"endPos": 244,
"startLine": 17,
"endLine": 17
},
"Value": "\"str\""
}
}
]
}
}
]
},
{
"type": "*stmt.Function",
"position": {
"startPos": 252,
"endPos": 306,
"startLine": 21,
"endLine": 23
},
"PhpDocComment": "",
"ReturnsRef": false,
"FunctionName": {
"type": "*node.Identifier",
"position": {
"startPos": 261,
"endPos": 264,
"startLine": 21,
"endLine": 21
},
"Value": "foo"
},
"Params": [
{
"type": "*node.Parameter",
"position": {
"startPos": 265,
"endPos": 267,
"startLine": 21,
"endLine": 21
},
"Variadic": false,
"ByRef": false,
"Variable": {
"type": "*expr.Variable",
"position": {
"startPos": 265,
"endPos": 267,
"startLine": 21,
"endLine": 21
},
"VarName": {
"type": "*node.Identifier",
"position": {
"startPos": 265,
"endPos": 267,
"startLine": 21,
"endLine": 21
},
"Value": "a"
}
}
},
{
"type": "*node.Parameter",
"position": {
"startPos": 269,
"endPos": 275,
"startLine": 21,
"endLine": 21
},
"Variadic": false,
"ByRef": false,
"VariableType": {
"type": "*name.Name",
"position": {
"startPos": 269,
"endPos": 272,
"startLine": 21,
"endLine": 21
},
"Parts": [
{
"type": "*name.NamePart",
"position": {
"startPos": 269,
"endPos": 272,
"startLine": 21,
"endLine": 21
},
"Value": "int"
}
]
},
"Variable": {
"type": "*expr.Variable",
"position": {
"startPos": 273,
"endPos": 275,
"startLine": 21,
"endLine": 21
},
"VarName": {
"type": "*node.Identifier",
"position": {
"startPos": 273,
"endPos": 275,
"startLine": 21,
"endLine": 21
},
"Value": "b"
}
}
}
],
"ReturnType": {
"type": "*name.Name",
"position": {
"startPos": 278,
"endPos": 281,
"startLine": 21,
"endLine": 21
},
"Parts": [
{
"type": "*name.NamePart",
"position": {
"startPos": 278,
"endPos": 281,
"startLine": 21,
"endLine": 21
},
"Value": "int"
}
]
},
"Stmts": [
{
"type": "*stmt.Return",
"position": {
"startPos": 285,
"endPos": 304,
"startLine": 22,
"endLine": 22
},
"Expr": {
"type": "*binary.Plus",
"position": {
"startPos": 292,
"endPos": 303,
"startLine": 22,
"endLine": 22
},
"Left": {
"type": "*binary.Plus",
"position": {
"startPos": 292,
"endPos": 298,
"startLine": 22,
"endLine": 22
},
"Left": {
"type": "*scalar.Lnumber",
"position": {
"startPos": 292,
"endPos": 293,
"startLine": 22,
"endLine": 22
},
"Value": "3"
},
"Right": {
"type": "*expr.Variable",
"position": {
"startPos": 296,
"endPos": 298,
"startLine": 22,
"endLine": 22
},
"VarName": {
"type": "*node.Identifier",
"position": {
"startPos": 296,
"endPos": 298,
"startLine": 22,
"endLine": 22
},
"Value": "a"
}
}
},
"Right": {
"type": "*expr.Variable",
"position": {
"startPos": 301,
"endPos": 303,
"startLine": 22,
"endLine": 22
},
"VarName": {
"type": "*node.Identifier",
"position": {
"startPos": 301,
"endPos": 303,
"startLine": 22,
"endLine": 22
},
"Value": "b"
}
}
}
}
]
},
{
"type": "*stmt.For",
"position": {
"startPos": 308,
"endPos": 361,
"startLine": 25,
"endLine": 27
},
"Init": [
{
"type": "*assign.Assign",
"position": {
"startPos": 313,
"endPos": 319,
"startLine": 25,
"endLine": 25
},
"Variable": {
"type": "*expr.Variable",
"position": {
"startPos": 313,
"endPos": 315,
"startLine": 25,
"endLine": 25
},
"VarName": {
"type": "*node.Identifier",
"position": {
"startPos": 313,
"endPos": 315,
"startLine": 25,
"endLine": 25
},
"Value": "i"
}
},
"Expression": {
"type": "*scalar.Lnumber",
"position": {
"startPos": 318,
"endPos": 319,
"startLine": 25,
"endLine": 25
},
"Value": "0"
}
}
],
"Cond": [
{
"type": "*binary.Smaller",
"position": {
"startPos": 321,
"endPos": 327,
"startLine": 25,
"endLine": 25
},
"Left": {
"type": "*expr.Variable",
"position": {
"startPos": 321,
"endPos": 323,
"startLine": 25,
"endLine": 25
},
"VarName": {
"type": "*node.Identifier",
"position": {
"startPos": 321,
"endPos": 323,
"startLine": 25,
"endLine": 25
},
"Value": "i"
}
},
"Right": {
"type": "*scalar.Lnumber",
"position": {
"startPos": 326,
"endPos": 327,
"startLine": 25,
"endLine": 25
},
"Value": "3"
}
}
],
"Loop": [
{
"type": "*expr.PreInc",
"position": {
"startPos": 329,
"endPos": 333,
"startLine": 25,
"endLine": 25
},
"Variable": {
"type": "*expr.Variable",
"position": {
"startPos": 331,
"endPos": 333,
"startLine": 25,
"endLine": 25
},
"VarName": {
"type": "*node.Identifier",
"position": {
"startPos": 331,
"endPos": 333,
"startLine": 25,
"endLine": 25
},
"Value": "i"
}
}
}
],
"Stmt": {
"type": "*stmt.StmtList",
"position": {
"startPos": 335,
"endPos": 361,
"startLine": 25,
"endLine": 27
},
"Stmts": [
{
"type": "*stmt.Echo",
"position": {
"startPos": 338,
"endPos": 359,
"startLine": 26,
"endLine": 26
},
"Exprs": [
{
"type": "*binary.Concat",
"position": {
"startPos": 343,
"endPos": 358,
"startLine": 26,
"endLine": 26
},
"Left": {
"type": "*expr.FunctionCall",
"position": {
"startPos": 343,
"endPos": 353,
"startLine": 26,
"endLine": 26
},
"Function": {
"type": "*name.Name",
"position": {
"startPos": 343,
"endPos": 346,
"startLine": 26,
"endLine": 26
},
"Parts": [
{
"type": "*name.NamePart",
"position": {
"startPos": 343,
"endPos": 346,
"startLine": 26,
"endLine": 26
},
"Value": "foo"
}
]
},
"ArgumentList": {
"type": "*node.ArgumentList",
"position": {
"startPos": 346,
"endPos": 353,
"startLine": 26,
"endLine": 26
},
"Arguments": [
{
"type": "*node.Argument",
"position": {
"startPos": 347,
"endPos": 349,
"startLine": 26,
"endLine": 26
},
"Variadic": false,
"IsReference": false,
"Expr": {
"type": "*expr.Variable",
"position": {
"startPos": 347,
"endPos": 349,
"startLine": 26,
"endLine": 26
},
"VarName": {
"type": "*node.Identifier",
"position": {
"startPos": 347,
"endPos": 349,
"startLine": 26,
"endLine": 26
},
"Value": "i"
}
}
},
{
"type": "*node.Argument",
"position": {
"startPos": 351,
"endPos": 352,
"startLine": 26,
"endLine": 26
},
"Variadic": false,
"IsReference": false,
"Expr": {
"type": "*scalar.Lnumber",
"position": {
"startPos": 351,
"endPos": 352,
"startLine": 26,
"endLine": 26
},
"Value": "2"
}
}
]
}
},
"Right": {
"type": "*scalar.String",
"position": {
"startPos": 354,
"endPos": 358,
"startLine": 26,
"endLine": 26
},
"Value": "\"\\n\""
}
}
]
}
]
}
},
{
"type": "*stmt.Expression",
"position": {
"startPos": 363,
"endPos": 386,
"startLine": 29,
"endLine": 29
},
"Expr": {
"type": "*assign.Assign",
"position": {
"startPos": 363,
"endPos": 385,
"startLine": 29,
"endLine": 29
},
"Variable": {
"type": "*expr.Variable",
"position": {
"startPos": 363,
"endPos": 366,
"startLine": 29,
"endLine": 29
},
"VarName": {
"type": "*node.Identifier",
"position": {
"startPos": 363,
"endPos": 366,
"startLine": 29,
"endLine": 29
},
"Value": "bb"
}
},
"Expression": {
"type": "*expr.New",
"position": {
"startPos": 369,
"endPos": 385,
"startLine": 29,
"endLine": 29
},
"Class": {
"type": "*name.Name",
"position": {
"startPos": 373,
"endPos": 376,
"startLine": 29,
"endLine": 29
},
"Parts": [
{
"type": "*name.NamePart",
"position": {
"startPos": 373,
"endPos": 376,
"startLine": 29,
"endLine": 29
},
"Value": "Bar"
}
]
},
"ArgumentList": {
"type": "*node.ArgumentList",
"position": {
"startPos": 376,
"endPos": 385,
"startLine": 29,
"endLine": 29
},
"Arguments": [
{
"type": "*node.Argument",
"position": {
"startPos": 377,
"endPos": 384,
"startLine": 29,
"endLine": 29
},
"Variadic": false,
"IsReference": false,
"Expr": {
"type": "*scalar.String",
"position": {
"startPos": 377,
"endPos": 384,
"startLine": 29,
"endLine": 29
},
"Value": "\"hello\""
}
}
]
}
}
}
},
{
"type": "*stmt.Expression",
"position": {
"startPos": 387,
"endPos": 400,
"startLine": 30,
"endLine": 30
},
"Expr": {
"type": "*expr.MethodCall",
"position": {
"startPos": 387,
"endPos": 399,
"startLine": 30,
"endLine": 30
},
"Variable": {
"type": "*expr.Variable",
"position": {
"startPos": 387,
"endPos": 390,
"startLine": 30,
"endLine": 30
},
"VarName": {
"type": "*node.Identifier",
"position": {
"startPos": 387,
"endPos": 390,
"startLine": 30,
"endLine": 30
},
"Value": "bb"
}
},
"Method": {
"type": "*node.Identifier",
"position": {
"startPos": 392,
"endPos": 397,
"startLine": 30,
"endLine": 30
},
"Value": "hello"
},
"ArgumentList": {
"type": "*node.ArgumentList",
"position": {
"startPos": 397,
"endPos": 399,
"startLine": 30,
"endLine": 30
}
}
}
}
]
}