forked from koniifer/ableos
bratenburg
This commit is contained in:
parent
b85c93466f
commit
ad9798d0f5
|
@ -913,3 +913,25 @@ main := fn(): int {
|
|||
return back_buffer[1024 * 2]
|
||||
}
|
||||
```
|
||||
|
||||
#### something_somehow
|
||||
```hb
|
||||
foo := @use("foo.hb")
|
||||
main := fn(): void {
|
||||
foo.blue
|
||||
foo.red
|
||||
return
|
||||
}
|
||||
|
||||
// in module: foo.hb
|
||||
|
||||
bar := @use("bar.hb")
|
||||
default := bar
|
||||
blue := default.blue
|
||||
red := default.red
|
||||
|
||||
// in module: bar.hb
|
||||
Color := struct {r: u8, g: u8, b: u8, a: u8}
|
||||
red := Color.(255, 0, 0, 0)
|
||||
blue := Color.(1, 0, 1, 0)
|
||||
```
|
||||
|
|
|
@ -2547,7 +2547,7 @@ impl Codegen {
|
|||
|
||||
pub fn disasm(&mut self, output: &mut impl std::io::Write) -> std::io::Result<()> {
|
||||
let mut bin = Vec::new();
|
||||
self.tys.assemble(&mut bin);
|
||||
self.assemble(&mut bin);
|
||||
self.tys.disasm(&bin, &self.files, output, |_| {})
|
||||
}
|
||||
|
||||
|
@ -2701,5 +2701,6 @@ mod tests {
|
|||
writing_into_string => README;
|
||||
request_page => README;
|
||||
tests_ptr_to_ptr_copy => README;
|
||||
something_somehow => README;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -862,11 +862,11 @@ fn disasm(
|
|||
|
||||
let mut label_count = 0;
|
||||
while let Some(&byte) = binary.first() {
|
||||
let inst = instr_from_byte(byte)?;
|
||||
let offset: i32 = (prev.len() - binary.len()).try_into().unwrap();
|
||||
if offset as u32 == off + len {
|
||||
break;
|
||||
}
|
||||
let Ok(inst) = instr_from_byte(byte) else { break };
|
||||
instrs::parse_args(binary, inst, &mut buf).ok_or(std::io::ErrorKind::OutOfMemory)?;
|
||||
|
||||
for op in buf.drain(..) {
|
||||
|
@ -903,11 +903,14 @@ fn disasm(
|
|||
|
||||
binary.take(..off as usize).unwrap();
|
||||
while let Some(&byte) = binary.first() {
|
||||
let inst = instr_from_byte(byte).unwrap();
|
||||
let offset: i32 = (prev.len() - binary.len()).try_into().unwrap();
|
||||
if offset as u32 == off + len {
|
||||
break;
|
||||
}
|
||||
let Ok(inst) = instr_from_byte(byte) else {
|
||||
writeln!(out, "invalid instr {byte}")?;
|
||||
break;
|
||||
};
|
||||
instrs::parse_args(binary, inst, &mut buf).unwrap();
|
||||
|
||||
if let Some(label) = labels.get(&offset.try_into().unwrap()) {
|
||||
|
|
0
hblang/tests/codegen_tests_something_somehow.txt
Normal file
0
hblang/tests/codegen_tests_something_somehow.txt
Normal file
Loading…
Reference in a new issue