Skip to content

Commit

Permalink
improving readability of two matches expr
Browse files Browse the repository at this point in the history
  • Loading branch information
xunilrj committed Nov 1, 2023
1 parent ed19a70 commit a806f58
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions sway-core/src/asm_generation/fuel/fuel_asm_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1167,12 +1167,6 @@ impl<'ir, 'eng> FuelAsmBuilder<'ir, 'eng> {
let instr_reg = self.reg_seqr.next();

match byte_len {
0 | 2..=7 => {
return Err(CompileError::Internal(
"Attempt to load {byte_len} bytes sized value.",
owning_span.unwrap_or_else(Span::dummy),
));
}
1 => {
self.cur_bytecode.push(Op {
opcode: Either::Left(VirtualOp::LB(
Expand All @@ -1195,6 +1189,12 @@ impl<'ir, 'eng> FuelAsmBuilder<'ir, 'eng> {
owning_span,
});
}
_ => {
return Err(CompileError::Internal(
"Attempt to load {byte_len} bytes sized value.",
owning_span.unwrap_or_else(Span::dummy),
));
}
}

self.reg_map.insert(*instr_val, instr_reg);
Expand Down Expand Up @@ -1661,12 +1661,6 @@ impl<'ir, 'eng> FuelAsmBuilder<'ir, 'eng> {
let val_reg = self.value_to_register(stored_val)?;

match byte_len {
0 | 2..=7 => {
return Err(CompileError::Internal(
"Attempt to load {byte_len} bytes sized value.",
owning_span.unwrap_or_else(Span::dummy),
));
}
1 => {
self.cur_bytecode.push(Op {
opcode: Either::Left(VirtualOp::SB(
Expand All @@ -1689,6 +1683,12 @@ impl<'ir, 'eng> FuelAsmBuilder<'ir, 'eng> {
owning_span,
});
}
_ => {
return Err(CompileError::Internal(
"Attempt to load {byte_len} bytes sized value.",
owning_span.unwrap_or_else(Span::dummy),
));
}
}

Ok(())
Expand Down

0 comments on commit a806f58

Please sign in to comment.