mclangc/tests/parser/functions.exp

306 lines
14 KiB
Plaintext
Raw Normal View History

2024-12-21 03:10:03 +00:00
Program {
ast: Block(
[
Statement(
LocBox {
inner: Fn(
Function {
struct_name: None,
name: Ident(
"main",
),
params: [
(
Ident(
"argc",
),
LocBox {
inner: Owned(
Ident(
"i32",
),
),
loc: Loc {
file: "parser/functions.mcl",
line: 1,
col: 18,
},
},
),
(
Ident(
"argv",
),
LocBox {
inner: Ref {
inner: Array {
inner: Owned(
Ident(
"Str",
),
),
},
mutable: false,
},
loc: Loc {
file: "parser/functions.mcl",
line: 1,
col: 27,
},
},
),
],
ret_type: Some(
LocBox {
inner: Owned(
Ident(
"i32",
),
),
loc: Loc {
file: "parser/functions.mcl",
line: 1,
col: 39,
},
},
),
qual_const: false,
qual_extern: None,
body: Some(
Block(
[
Expr(
LocBox {
inner: Return(
Some(
LocBox {
inner: Literal(
Number(
Number {
val: 0,
base: 10,
signed: false,
},
),
),
loc: Loc {
file: "parser/functions.mcl",
line: 2,
col: 13,
},
},
),
),
loc: Loc {
file: "parser/functions.mcl",
line: 2,
col: 11,
},
},
),
],
),
),
},
),
loc: Loc {
file: "parser/functions.mcl",
line: 1,
col: 3,
},
},
),
Statement(
LocBox {
inner: Fn(
Function {
struct_name: Some(
Ident(
"Baz",
),
),
name: Ident(
"main",
),
params: [
(
Ident(
"self",
),
LocBox {
inner: Ref {
inner: Owned(
Ident(
"Baz",
),
),
mutable: true,
},
loc: Loc {
file: "parser/functions.mcl",
line: 4,
col: 20,
},
},
),
(
Ident(
"a",
),
LocBox {
inner: Ref {
inner: Owned(
Ident(
"Foo",
),
),
mutable: false,
},
loc: Loc {
file: "parser/functions.mcl",
line: 4,
col: 33,
},
},
),
(
Ident(
"b",
),
LocBox {
inner: Ref {
inner: Owned(
Ident(
"Bar",
),
),
mutable: true,
},
loc: Loc {
file: "parser/functions.mcl",
line: 4,
col: 42,
},
},
),
],
ret_type: Some(
LocBox {
inner: Ref {
inner: Owned(
Ident(
"Nya",
),
),
mutable: false,
},
loc: Loc {
file: "parser/functions.mcl",
line: 4,
col: 54,
},
},
),
qual_const: false,
qual_extern: None,
body: None,
},
),
loc: Loc {
file: "parser/functions.mcl",
line: 4,
col: 3,
},
},
),
Statement(
LocBox {
inner: Fn(
Function {
struct_name: Some(
Ident(
"Baz",
),
),
name: Ident(
"main",
),
params: [
(
Ident(
"a",
),
LocBox {
inner: Ref {
inner: Owned(
Ident(
"Foo",
),
),
mutable: false,
},
loc: Loc {
file: "parser/functions.mcl",
line: 5,
col: 17,
},
},
),
(
Ident(
"b",
),
LocBox {
inner: Ref {
inner: Owned(
Ident(
"Bar",
),
),
mutable: true,
},
loc: Loc {
file: "parser/functions.mcl",
line: 5,
col: 26,
},
},
),
],
ret_type: Some(
LocBox {
inner: Ref {
inner: Owned(
Ident(
"Nya",
),
),
mutable: false,
},
loc: Loc {
file: "parser/functions.mcl",
line: 5,
col: 38,
},
},
),
qual_const: false,
qual_extern: None,
body: None,
},
),
loc: Loc {
file: "parser/functions.mcl",
line: 5,
col: 3,
},
},
),
],
2024-12-21 03:10:03 +00:00
),
structs: {},
enums: {},
types: {},
functions: {},
member_functions: {},
}