diff options
author | Vincent Ambo <mail@tazj.in> | 2021-03-05T15·48+0200 |
---|---|---|
committer | tazjin <mail@tazj.in> | 2021-03-06T11·52+0000 |
commit | 29b2a547055ba1adaf3f0d79055b7d7657eb3a5e (patch) | |
tree | e417b41322e4ba655484daa2a5f0b986381d1a3e /users/tazjin/rlox/src/bytecode/interner | |
parent | b7b94335cc3b2d5650a385e1f4a439a7ef6d30ff (diff) |
feat(tazjin/rlox): Implement global variable definition r/2273
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
Diffstat (limited to 'users/tazjin/rlox/src/bytecode/interner')
-rw-r--r-- | users/tazjin/rlox/src/bytecode/interner/mod.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/users/tazjin/rlox/src/bytecode/interner/mod.rs b/users/tazjin/rlox/src/bytecode/interner/mod.rs index f5f695904e85..1da1a24b2c5f 100644 --- a/users/tazjin/rlox/src/bytecode/interner/mod.rs +++ b/users/tazjin/rlox/src/bytecode/interner/mod.rs @@ -11,7 +11,7 @@ use std::collections::HashMap; #[cfg(test)] mod tests; -#[derive(Clone, Copy, Debug, PartialEq, Hash)] +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)] pub struct InternedStr { id: usize, } |