most likely fixed

This commit is contained in:
mlokr 2024-09-01 23:51:59 +02:00
parent cbe6f98dff
commit 641be15703
No known key found for this signature in database
GPG key ID: DEA147DDEE644993
2 changed files with 13 additions and 5 deletions

View file

@ -2525,6 +2525,7 @@ impl Codegen {
fn handle_task(&mut self, FTask { file, id }: FTask) { fn handle_task(&mut self, FTask { file, id }: FTask) {
let func = self.tys.funcs[id as usize]; let func = self.tys.funcs[id as usize];
debug_assert!(func.file == file);
let sig = func.sig.unwrap(); let sig = func.sig.unwrap();
let ast = self.files[file as usize].clone(); let ast = self.files[file as usize].clone();
let expr = func.expr.get(&ast).unwrap(); let expr = func.expr.get(&ast).unwrap();
@ -2954,7 +2955,7 @@ impl Codegen {
op: TokenKind::Decl, op: TokenKind::Decl,
right: &Expr::Closure { pos, args, ret, .. }, right: &Expr::Closure { pos, args, ret, .. },
} => { } => {
let id = self.tys.funcs.len() as _; let mut push_task = false;
let func = Func { let func = Func {
file, file,
offset: task::id(self.tasks.len()), offset: task::id(self.tasks.len()),
@ -2970,7 +2971,7 @@ impl Codegen {
self.tys.args.push(ty); self.tys.args.push(ty);
} }
self.tasks.push(Some(FTask { file, id })); push_task = true;
let args = self.pack_args(pos, arg_base); let args = self.pack_args(pos, arg_base);
log::dbg!("eval ret"); log::dbg!("eval ret");
@ -2978,8 +2979,17 @@ impl Codegen {
Some(Sig { args, ret }) Some(Sig { args, ret })
}, },
expr: ExprRef::new(expr), expr: {
let refr = ExprRef::new(expr);
debug_assert!(refr.get(&f).is_some());
refr
},
}; };
let id = self.tys.funcs.len() as _;
if push_task {
self.tasks.push(Some(FTask { file, id }));
}
self.tys.funcs.push(func); self.tys.funcs.push(func);
ty::Kind::Func(id) ty::Kind::Func(id)
@ -3108,7 +3118,6 @@ impl Codegen {
self.output.trunc(&self.ci.snap); self.output.trunc(&self.ci.snap);
self.pool.cis.push(std::mem::replace(&mut self.ci, prev_ci)); self.pool.cis.push(std::mem::replace(&mut self.ci, prev_ci));
self.ci.snap = self.output.snap(); self.ci.snap = self.output.snap();
debug_assert_eq!(self.pool.cis.last().unwrap().snap, self.ci.snap);
self.push_stash(stash); self.push_stash(stash);
log::dbg!("eval-end"); log::dbg!("eval-end");

View file

@ -430,7 +430,6 @@ pub fn parse_from_fs(extra_threads: usize, root: &str) -> io::Result<Vec<Ast>> {
let thread = || { let thread = || {
let mut buffer = Vec::new(); let mut buffer = Vec::new();
while let Some(task @ (indx, ..)) = tasks.pop() { while let Some(task @ (indx, ..)) = tasks.pop() {
dbg!();
let res = execute_task(task, &mut buffer); let res = execute_task(task, &mut buffer);
buffer.clear(); buffer.clear();