fixing different file imports

This commit is contained in:
Jakub Doka 2024-11-10 12:26:30 +01:00
parent c353d28be0
commit 8b98c2ed1b
No known key found for this signature in database
GPG key ID: C6E9A89936B8C143

View file

@ -3816,6 +3816,7 @@ impl<'a> Codegen<'a> {
fn gen_const(&mut self, cnst: ty::Const, ctx: Ctx) -> Option<Value> {
let c = &self.tys.ins.consts[cnst];
let prev = mem::replace(&mut self.ci.file, c.file);
let f = &self.files[c.file.index()];
let Expr::BinOp { left, right, .. } = c.ast.get(f) else { unreachable!() };
@ -3826,6 +3827,7 @@ impl<'a> Codegen<'a> {
})
.unwrap_or_else(|_| unreachable!())?;
self.strip_var(&mut value);
self.ci.file = prev;
Some(value)
}