Skip to content

Commit

Permalink
Merge pull request #21 from froth/local_variables
Browse files Browse the repository at this point in the history
Add support for local variables
  • Loading branch information
froth authored Dec 29, 2024
2 parents 8b565ab + 6cf9798 commit 8ea7183
Show file tree
Hide file tree
Showing 13 changed files with 1,004 additions and 289 deletions.
3 changes: 3 additions & 0 deletions src/chunk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,9 @@ impl Chunk {
let constant = self.constants[const_index];
write!(&mut result, "{:<16} {:<4} '{}'", op, const_index, constant)?;
}
Op::GetLocal(slot) | Op::SetLocal(slot) => {
write!(&mut result, "{:<16} {:<4}", op, slot)?
}
op => write!(&mut result, "{op}")?,
}
Ok((result, line_number))
Expand Down
Loading

0 comments on commit 8ea7183

Please sign in to comment.