fixed multi file error messages

This commit is contained in:
afonya 2025-06-18 19:37:47 +02:00
parent f234dc1564
commit 60ce82e68b
Signed by: afonya
GPG key ID: EBB9C4CAFAAFB2DC
3 changed files with 8 additions and 12 deletions

View file

@ -32,7 +32,8 @@ struct Compiled {
variables: Vec<Variable>,
strings: HashMap<u32, String>,
functions: HashMap<u32, Compiled>,
try_catch: Option<u32>
try_catch: Option<u32>,
ctx: Context
}
#[derive(Debug, Clone)]
@ -753,7 +754,8 @@ fn compile_function(ast: Vec<ASTPart>, args: Option<Vec<String>>, registers: &mu
variables,
strings,
functions,
try_catch
try_catch,
ctx: ctx.clone(),
};
}
@ -825,7 +827,7 @@ fn compile_body(compiled: Compiled, fpos: &mut usize, ctx: &Context) -> (Vec<u8>
*fpos += 1;
append_be_num(&mut output, 3, *funcs as usize);
append_be_num(&mut output, 4, *fpos);
let (compiled, mut context) = compile_body(compiled.functions[funcs].clone(), fpos, ctx);
let (compiled, mut context) = compile_body(compiled.functions[funcs].clone(), fpos, &compiled.functions[funcs].ctx);
for c in &mut context {
c.c_funcid = *fpos
}

View file

@ -10,7 +10,7 @@ mod virtualmachine;
mod errors;
mod decompiler;
const CLIVER: [u8; 3] = [1,0,1];
const CLIVER: [u8; 3] = [1,0,2];
#[derive(Debug, Clone)]
struct Context {

View file

@ -1,8 +1,2 @@
gethelj con = kábel.kapcsolódj(szaft"example.com:80"szaft)
con.írj(con, szaft"GET / HTTP/1.1
User-Agent: Astro Lang
Host: example.com
"szaft)
ugass(con.olvass(con, 5120))
con.zár(con)
hámozd test be szaft"test2.asl"szaft
gethelj a = szaft"asd"szaft+1