added table set
This commit is contained in:
parent
7276312961
commit
9a915cd274
4 changed files with 52 additions and 5 deletions
|
@ -540,7 +540,13 @@ fn do_ast_op(ast_op: ASTPart, op_count: &mut usize, ops: &mut Vec<Operation>, va
|
|||
ops.push(Operation { opcode: 30, arg1: Some(table_reg), arg2: Some(key_reg as i64), arg3: Some(reg.register) });
|
||||
set_register(registers, RegisterState { id: reg.register, used: true, variable: 0, last_used: *op_count });
|
||||
return reg.register;
|
||||
}
|
||||
},
|
||||
ASTPart::TableSet(tbl_set) => {
|
||||
let table_reg = do_ast_op(*tbl_set.table, op_count, ops, variables, next_var_id, strings, next_string_id, functions, next_function_id, registers);
|
||||
let key_reg = do_ast_op(*tbl_set.key, op_count, ops, variables, next_var_id, strings, next_string_id, functions, next_function_id, registers);
|
||||
let value_reg = do_ast_op(*tbl_set.value, op_count, ops, variables, next_var_id, strings, next_string_id, functions, next_function_id, registers);
|
||||
ops.push(Operation { opcode: 31, arg1: Some(table_reg), arg2: Some(key_reg as i64), arg3: Some(value_reg) });
|
||||
},
|
||||
_ => {}
|
||||
}
|
||||
return 0;
|
||||
|
@ -578,6 +584,7 @@ fn compile_function(ast: Vec<ASTPart>, args: Option<Vec<String>>, registers: &mu
|
|||
var.end = ops.len() - 1;
|
||||
}
|
||||
}
|
||||
println!("Compiled operations: {:?}", ops);
|
||||
|
||||
return Compiled {
|
||||
operations: ops,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue