Skip to content

Commit

Permalink
fix rebase errors
Browse files Browse the repository at this point in the history
  • Loading branch information
raskad committed Dec 20, 2024
1 parent 5144f10 commit aeb2e2f
Showing 1 changed file with 18 additions and 5 deletions.
23 changes: 18 additions & 5 deletions core/engine/src/bytecompiler/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -799,17 +799,27 @@ impl<'ctx> ByteCompiler<'ctx> {
) {
match binding {
BindingKind::Global(index) => match opcode {
Opcode::SetNameByLocator => self.emit_opcode(opcode),
Opcode::SetNameByLocator => self.emit(opcode, &[Operand::Register(value)]),
Opcode::GetName => {
let ic_index = self.ic.len() as u32;
let name = self.bindings[*index as usize].name().clone();
self.ic.push(InlineCache::new(name));
self.emit(
Opcode::GetNameGlobal,
&[Operand::Varying(*index), Operand::Varying(ic_index)],
&[
Operand::Register(value),
Operand::Varying(*index),
Operand::Varying(ic_index),
],
);
}
_ => self.emit_with_varying_operand(opcode, *index),
Opcode::GetLocator | Opcode::DefVar => {
self.emit(opcode, &[Operand::Varying(*index)]);
}
_ => self.emit(
opcode,
&[Operand::Register(value), Operand::Varying(*index)],
),
},
BindingKind::Stack(index) => match opcode {
Opcode::SetNameByLocator => self.emit(opcode, &[Operand::Register(value)]),
Expand Down Expand Up @@ -2131,8 +2141,11 @@ impl<'ctx> ByteCompiler<'ctx> {
let name = self.resolve_identifier_expect(*ident);
let binding = self.lexical_scope.get_identifier_reference(name);
let index = self.get_or_insert_binding(binding);
let BindingKind::Stack(index) = index else {
unreachable!("with binding cannot be local")
let index = match index {
BindingKind::Global(index) | BindingKind::Stack(index) => index,
BindingKind::Local(_) => {
unreachable!("with binding cannot be local")
}
};
let value = self.register_allocator.alloc();
self.emit(
Expand Down

0 comments on commit aeb2e2f

Please sign in to comment.