forked from AbleOS/holey-bytes
updating tests and fixing bug
This commit is contained in:
parent
ed1b9459fc
commit
937c107dec
|
@ -733,7 +733,7 @@ some_func := fn($Elem: type): void {
|
|||
}
|
||||
|
||||
main := fn(): void {
|
||||
some_func(0)
|
||||
some_func(u8)
|
||||
return
|
||||
}
|
||||
```
|
||||
|
|
|
@ -1740,12 +1740,12 @@ impl Codegen {
|
|||
}
|
||||
}
|
||||
ty::Kind::Slice(arr) => {
|
||||
let arr = &self.tys.arrays[arr as usize];
|
||||
let arr = self.tys.arrays[arr as usize];
|
||||
let item_size = self.tys.size_of(arr.ty);
|
||||
for (i, value) in fields.iter().enumerate() {
|
||||
let loc = loc.as_ref().offset(i as u32 * item_size);
|
||||
let value =
|
||||
self.expr_ctx(value, Ctx::default().with_loc(loc).with_ty(ty))?;
|
||||
self.expr_ctx(value, Ctx::default().with_loc(loc).with_ty(arr.ty))?;
|
||||
self.ci.free_loc(value.loc);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,11 +2,11 @@ main:
|
|||
ADDI64 r254, r254, -72d
|
||||
ST r31, r254, 48a, 24h
|
||||
LI64 r32, 1d
|
||||
ST r32, r254, 0a, 24h
|
||||
ST r32, r254, 0a, 8h
|
||||
LI64 r32, 2d
|
||||
ST r32, r254, 8a, 24h
|
||||
ST r32, r254, 8a, 8h
|
||||
LI64 r32, 4d
|
||||
ST r32, r254, 16a, 24h
|
||||
ST r32, r254, 16a, 8h
|
||||
ADDI64 r32, r254, 0d
|
||||
ADDI64 r33, r254, 24d
|
||||
BMC r32, r33, 24h
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
main:
|
||||
ADDI64 r254, r254, -24d
|
||||
ST r31, r254, 0a, 24h
|
||||
LRA r32, r0, :string
|
||||
LRA r32, r0, :abඞ
|
||||
56789
|
||||
CP r2, r32
|
||||
JAL r31, r0, :str_len
|
||||
CP r32, r1
|
||||
LRA r33, r0, :string
|
||||
LRA r33, r0, :fff
|
||||
CP r2, r33
|
||||
JAL r31, r0, :str_len
|
||||
CP r33, r1
|
||||
|
|
16
hblang/tests/codegen_tests_some_generic_code.txt
Normal file
16
hblang/tests/codegen_tests_some_generic_code.txt
Normal file
|
@ -0,0 +1,16 @@
|
|||
main:
|
||||
ADDI64 r254, r254, -8d
|
||||
ST r31, r254, 0a, 8h
|
||||
JAL r31, r0, :some_func
|
||||
LD r31, r254, 0a, 8h
|
||||
ADDI64 r254, r254, 8d
|
||||
JALA r0, r31, 0a
|
||||
some_func:
|
||||
ADDI64 r254, r254, -8d
|
||||
ST r31, r254, 0a, 8h
|
||||
LD r31, r254, 0a, 8h
|
||||
ADDI64 r254, r254, 8d
|
||||
JALA r0, r31, 0a
|
||||
code size: 133
|
||||
ret: 0
|
||||
status: Ok(())
|
Loading…
Reference in a new issue