feat(tazjin/rlox): Implement global variable definition
identifier_str might look a bit overengineered, but we want to reuse this bit of code and it needs a reference to the token from which to pick the identifier. The problem with this is that the token would be owned by self, but the function needs to mutate (the interner), so this implementation is the most straightforward way of acquiring and working with an immutable reference to the token before interning the identifier. Change-Id: I618ce8f789cb59b3a9c5b79a13111ea6d00b2424 Reviewed-on: https://cl.tvl.fyi/c/depot/+/2592 Reviewed-by: tazjin <mail@tazj.in> Tested-by: BuildkiteCI
This commit is contained in:
parent
b7b94335cc
commit
29b2a54705
5 changed files with 80 additions and 15 deletions
|
|
@ -29,4 +29,7 @@ pub enum OpCode {
|
|||
// Built in operations
|
||||
OpPrint,
|
||||
OpPop,
|
||||
|
||||
// Variable definitions
|
||||
OpDefineGlobal(usize),
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue