diff options
| author | Rose Hogenson <rhogenson@posteo.net> | 2022-07-30 13:34:49 -0700 |
|---|---|---|
| committer | Rose Hogenson <rhogenson@posteo.net> | 2022-07-30 13:34:49 -0700 |
| commit | 1913aeaaf0d8dba2c63b0cca42bda16071eb9e1e (patch) | |
| tree | 4942c88b4ff52f60471bb1ef9abf98fee65c65ca /bytecode/src | |
| parent | Add call-builtin syntax. (diff) | |
| download | chromatopelma-1913aeaaf0d8dba2c63b0cca42bda16071eb9e1e.tar.zst | |
Add typeof to encoding.rs.
Diffstat (limited to 'bytecode/src')
| -rw-r--r-- | bytecode/src/encoding.rs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/bytecode/src/encoding.rs b/bytecode/src/encoding.rs index 7e9ede2..b3e84ac 100644 --- a/bytecode/src/encoding.rs +++ b/bytecode/src/encoding.rs @@ -102,6 +102,7 @@ fn op_decoding<T: Read>(prog: &mut T) -> Result<Option<Op>, String> { ), 13 => Op::Exit(read_arg(prog, arg1_const)?), 14 => Op::AllocBytevector(read_local(prog)?, read_arg(prog, arg1_const)?), + 15 => Op::TypeOf(read_local(prog)?, read_arg(prog, arg1_const)?), _ => { return Err(String::from("invalid opcode")); } @@ -413,4 +414,12 @@ mod tests { decode_vec(vec![0x3a, 0, 0x15, 0, 0, 0, 0, 0, 0, 0]) ); } + + #[test] + fn decode_typeof() { + assert_eq!( + vec![TypeOf(Local(0), L(Local(1)))], + decode_vec(vec![0x3c, 0, 1]) + ); + } } |
