Skip to content

Commit

Permalink
fix(eval): check labels exist
Browse files Browse the repository at this point in the history
  • Loading branch information
dxrcy committed Dec 18, 2024
1 parent ac76a6a commit f7971c2
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/debugger/eval.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,11 @@ pub fn eval(state: &mut RunState, line: String) {
fn eval_inner(state: &mut RunState, line: &'static str) -> Result<()> {
// Parse
let stmt = AsmParser::new_simple(line)?.parse_simple()?;
// Check labels
let mut asm = AsmLine::new(0, stmt, Span::dummy());
asm.backpatch()?;
// Emit
let instr = AsmLine::new(0, stmt, Span::dummy()).emit()?;
let instr = asm.emit()?;
// Execute
RunState::OP_TABLE[(instr >> 12) as usize](state, instr);
Ok(())
Expand Down

0 comments on commit f7971c2

Please sign in to comment.