fixing another incorrect file reporting

Signed-off-by: Jakub Doka <jakub.doka2@gmail.com>
This commit is contained in:
Jakub Doka 2024-12-17 19:30:42 +01:00
parent 248bdf003a
commit 3702a99d03
No known key found for this signature in database
GPG key ID: C6E9A89936B8C143

View file

@ -2560,8 +2560,6 @@ impl<'a> Codegen<'a> {
} }
self.ci.ret = prev_ret; self.ci.ret = prev_ret;
self.ci.file = prev_file;
self.ci.parent = prev_parent;
self.ci.inline_depth -= 1; self.ci.inline_depth -= 1;
self.ci.inline_var_base = prev_var_base; self.ci.inline_var_base = prev_var_base;
self.ci.inline_aclass_base = prev_aclass_base; self.ci.inline_aclass_base = prev_aclass_base;
@ -2583,6 +2581,10 @@ impl<'a> Codegen<'a> {
self.error(body.pos(), "function is makred inline but it contains controlflow"); self.error(body.pos(), "function is makred inline but it contains controlflow");
} }
// this is here because we report error in the inline function file
self.ci.file = prev_file;
self.ci.parent = prev_parent;
scope.vars.drain(var_base..).for_each(|v| v.remove(&mut self.ci.nodes)); scope.vars.drain(var_base..).for_each(|v| v.remove(&mut self.ci.nodes));
scope.aclasses.drain(aclass_base..).for_each(|v| v.remove(&mut self.ci.nodes)); scope.aclasses.drain(aclass_base..).for_each(|v| v.remove(&mut self.ci.nodes));
self.ci.nodes.unlock(v.id); self.ci.nodes.unlock(v.id);
@ -2849,7 +2851,9 @@ impl<'a> Codegen<'a> {
self.tys.tmp.args.push(ty); self.tys.tmp.args.push(ty);
let sym = parser::find_symbol(&fast.symbols, carg.id); let sym = parser::find_symbol(&fast.symbols, carg.id);
let ty = if sym.flags & idfl::COMPTIME == 0 { let ty = if ty == ty::Id::ANY_TYPE {
todo!()
} else if sym.flags & idfl::COMPTIME == 0 {
// FIXME: could fuck us // FIXME: could fuck us
continue; continue;
} else { } else {
@ -3772,6 +3776,7 @@ impl<'a> Codegen<'a> {
{ {
self.find_type(pos, sc.file, inside, name) self.find_type(pos, sc.file, inside, name)
} }
Expr::Directive { name: "Any", args: [], .. } => ty::Id::ANY_TYPE,
Expr::Directive { name: "TypeOf", args: [expr], .. } => self.infer_type(expr), Expr::Directive { name: "TypeOf", args: [expr], .. } => self.infer_type(expr),
Expr::Slice { size: None, item, .. } => { Expr::Slice { size: None, item, .. } => {
let ty = self.parse_ty(sc.anon(), item); let ty = self.parse_ty(sc.anon(), item);