Skip to content

Commit

Permalink
Fix bool primitive loading and setting variables for the interpreter.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ivorforce committed Apr 28, 2024
1 parent caf659e commit 5df6c91
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/interpreter/builtins.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ pub fn load(runtime: &mut Runtime) -> RResult<()> {
let representation = &runtime.source.fn_representations[function];

runtime.function_inlines.insert(Rc::clone(function), match representation.name.as_str() {
"true" => inline_fn_push_with_u8(OpCode::TRANSPILE_ADD, true as u8),
"false" => inline_fn_push_with_u8(OpCode::TRANSPILE_ADD, false as u8),
"true" => inline_fn_push_with_u8(OpCode::LOAD8, true as u8),
"false" => inline_fn_push_with_u8(OpCode::LOAD8, false as u8),
_ => continue,
});
}
Expand Down
2 changes: 2 additions & 0 deletions src/interpreter/compiler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,8 @@ impl FunctionCompiler<'_> {
self.chunk.push_with_u32(OpCode::LOAD_LOCAL, slot);
},
ExpressionOperation::SetLocal(local) => {
assert_eq!(children.len(), 1);
self.compile_expression(&children[0])?;
let slot = self.get_variable_slot(local);
self.chunk.push_with_u32(OpCode::STORE_LOCAL, slot);
},
Expand Down

0 comments on commit 5df6c91

Please sign in to comment.