forked from AbleOS/holey-bytes
brahmaputra 4
This commit is contained in:
parent
bd7384123c
commit
efa7271a59
|
@ -1629,18 +1629,13 @@ impl Codegen {
|
||||||
self.ci.free_loc(tal.loc);
|
self.ci.free_loc(tal.loc);
|
||||||
self.pop_local_snap(checkpoint);
|
self.pop_local_snap(checkpoint);
|
||||||
match ty::Kind::from_ty(self.ty(target)) {
|
match ty::Kind::from_ty(self.ty(target)) {
|
||||||
ty::Kind::Module(idx) => Some(Value::ty(
|
ty::Kind::Module(idx) => {
|
||||||
self.find_or_declare(target.pos(), idx, Err(field), "")
|
match self.find_or_declare(target.pos(), idx, Err(field), "") {
|
||||||
.compress(),
|
ty::Kind::Global(idx) => self.handle_global(idx),
|
||||||
)),
|
e => Some(Value::ty(e.compress())),
|
||||||
ty::Kind::Global(idx) => Some(Value::ty({
|
}
|
||||||
let global = &self.tys.globals[idx as usize];
|
}
|
||||||
ty::Id::from(u32::from_ne_bytes(
|
ty::Kind::Global(idx) => self.handle_global(idx),
|
||||||
self.output.code[global.offset as usize..][..4]
|
|
||||||
.try_into()
|
|
||||||
.unwrap(),
|
|
||||||
))
|
|
||||||
})),
|
|
||||||
e => unimplemented!("{e:?}"),
|
e => unimplemented!("{e:?}"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
pkg := @use("pkg.hb");
|
pkg := @use("pkg.hb");
|
||||||
|
|
||||||
main := fn(a: int): int {
|
main := fn(a: int): int {
|
||||||
return pkg.fib(10);
|
return pkg.fib(pkg.global);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
global := 10;
|
||||||
|
|
||||||
fib := fn(n: int): int {
|
fib := fn(n: int): int {
|
||||||
return n + 1;
|
return n + 1;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue