brahmaputra
This commit is contained in:
parent
22f925b3f5
commit
e9589ebcae
|
@ -1639,6 +1639,14 @@ impl Codegen {
|
|||
self.find_or_declare(target.pos(), idx, Err(field), "")
|
||||
.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:?}"),
|
||||
}
|
||||
}
|
||||
|
|
|
@ -876,7 +876,23 @@ impl<'a> std::fmt::Display for Expr<'a> {
|
|||
Self::Ident { name, .. } => write!(f, "{name}"),
|
||||
Self::Block { stmts, .. } => {
|
||||
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::Bool { value, .. } => write!(f, "{value}"),
|
||||
|
|
Loading…
Reference in a new issue