added table functions, fixed a bug with var update
This commit is contained in:
parent
d22014a1e0
commit
c9a626cdab
3 changed files with 72 additions and 12 deletions
|
@ -556,12 +556,12 @@ fn do_ast_op(ast_op: ASTPart, op_count: &mut usize, ops: &mut Vec<Operation>, va
|
|||
print_error(&err, &ctx);
|
||||
process::exit(1);
|
||||
}
|
||||
let value_reg = do_ast_op(*upd.value, op_count, ops, variables, next_var_id, strings, next_string_id, functions, next_function_id, registers, ctx, traceback);
|
||||
let reg = get_register_by_variable(registers, get_variable_by_name(variables, &upd.variable, ops.len(), traceback).expect("Variable should exist").clone());
|
||||
if reg.id != 0 {
|
||||
ops.push(Operation { opcode: 8, arg1: Some(reg.id), arg2: None, arg3: None, pos: upd.pos as u32 });
|
||||
set_register(registers, RegisterState { id: reg.id, used: false, variable: 0, last_used: 0 });
|
||||
}
|
||||
let value_reg = do_ast_op(*upd.value, op_count, ops, variables, next_var_id, strings, next_string_id, functions, next_function_id, registers, ctx, traceback);
|
||||
ops.push(Operation { opcode: 7, arg1: Some(value_reg), arg2: Some(get_variable_by_name(variables, &upd.variable, ops.len(), traceback).expect("Variable should exist").id as i64), arg3: None, pos: upd.pos as u32 });
|
||||
set_register(registers, RegisterState { id: value_reg, used: true, variable: get_variable_by_name(variables, &upd.variable, ops.len(), traceback).expect("Variable should exist").id, last_used: *op_count });
|
||||
garbage_collect_registers(registers);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue