parser/tests/fixtures/0038/ast.txt
2022-12-06 09:51:13 +01:00

198 lines
7.3 KiB
Plaintext

[
Function(
Function {
start: (
3,
1,
),
end: (
9,
1,
),
name: Identifier {
start: (
3,
10,
),
name: "fib",
end: (
3,
13,
),
},
attributes: [],
parameters: FunctionParameterList {
start: (
3,
13,
),
end: (
3,
18,
),
members: [
FunctionParameter {
start: (
3,
14,
),
end: (
3,
16,
),
name: Variable {
start: (
3,
14,
),
name: "n",
end: (
3,
16,
),
},
attributes: [],
type: None,
variadic: false,
default: None,
by_ref: false,
},
],
},
return_type: None,
by_ref: false,
body: [
If {
condition: Infix {
lhs: Variable(
Variable {
start: (
4,
9,
),
name: "n",
end: (
4,
12,
),
},
),
op: LessThan,
rhs: LiteralInteger {
i: 2,
},
},
then: [
Return {
value: Some(
Variable(
Variable {
start: (
5,
16,
),
name: "n",
end: (
5,
18,
),
},
),
),
},
],
else_ifs: [],
else: None,
},
Return {
value: Some(
Infix {
lhs: Call {
target: Identifier(
Identifier {
start: (
8,
12,
),
name: "fib",
end: (
8,
15,
),
},
),
args: [
Arg {
name: None,
value: Infix {
lhs: Variable(
Variable {
start: (
8,
16,
),
name: "n",
end: (
8,
19,
),
},
),
op: Sub,
rhs: LiteralInteger {
i: 1,
},
},
unpack: false,
},
],
},
op: Add,
rhs: Call {
target: Identifier(
Identifier {
start: (
8,
26,
),
name: "fib",
end: (
8,
29,
),
},
),
args: [
Arg {
name: None,
value: Infix {
lhs: Variable(
Variable {
start: (
8,
30,
),
name: "n",
end: (
8,
33,
),
},
),
op: Sub,
rhs: LiteralInteger {
i: 2,
},
},
unpack: false,
},
],
},
},
),
},
],
},
),
]