forked from koniifer/ableos
brahmaputra
This commit is contained in:
parent
620e994e4c
commit
b6898adb3b
|
@ -1639,6 +1639,14 @@ impl Codegen {
|
||||||
self.find_or_declare(target.pos(), idx, Err(field), "")
|
self.find_or_declare(target.pos(), idx, Err(field), "")
|
||||||
.compress(),
|
.compress(),
|
||||||
)),
|
)),
|
||||||
|
ty::Kind::Global(idx) => Some(Value::ty({
|
||||||
|
let global = &self.tys.globals[idx as usize];
|
||||||
|
ty::Id::from(u32::from_ne_bytes(
|
||||||
|
self.output.code[global.offset as usize..][..4]
|
||||||
|
.try_into()
|
||||||
|
.unwrap(),
|
||||||
|
))
|
||||||
|
})),
|
||||||
e => unimplemented!("{e:?}"),
|
e => unimplemented!("{e:?}"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -876,7 +876,23 @@ impl<'a> std::fmt::Display for Expr<'a> {
|
||||||
Self::Ident { name, .. } => write!(f, "{name}"),
|
Self::Ident { name, .. } => write!(f, "{name}"),
|
||||||
Self::Block { stmts, .. } => {
|
Self::Block { stmts, .. } => {
|
||||||
write!(f, "{{")?;
|
write!(f, "{{")?;
|
||||||
fmt_trailing_list(f, "}", stmts, std::fmt::Display::fmt)
|
writeln!(f)?;
|
||||||
|
INDENT.with(|i| i.set(i.get() + 1));
|
||||||
|
let res = (|| {
|
||||||
|
for stmt in list {
|
||||||
|
for _ in 0..INDENT.with(|i| i.get()) {
|
||||||
|
write!(f, "\t")?;
|
||||||
|
}
|
||||||
|
fmt(stmt, f)?;
|
||||||
|
}
|
||||||
|
Ok(())
|
||||||
|
})();
|
||||||
|
INDENT.with(|i| i.set(i.get() - 1));
|
||||||
|
for _ in 0..INDENT.with(|i| i.get()) {
|
||||||
|
write!(f, "\t")?;
|
||||||
|
}
|
||||||
|
write!(f, "{end}")?;
|
||||||
|
res
|
||||||
}
|
}
|
||||||
Self::Number { value, .. } => write!(f, "{value}"),
|
Self::Number { value, .. } => write!(f, "{value}"),
|
||||||
Self::Bool { value, .. } => write!(f, "{value}"),
|
Self::Bool { value, .. } => write!(f, "{value}"),
|
||||||
|
|
Loading…
Reference in a new issue