From ed3fce2b19fa0d28054382093b019967a9a16177 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Tue, 2 Mar 2021 22:26:02 +0200 Subject: feat(tazjin/rlox): Implement expression statements These aren't particularly useful without side effects, but one step at a time. This diverges slightly from the book, in that OpPop retains the last value it "forgot" from the stack in a special field on the interpreter. This makes it possible to return values from expression statements, which helps in cases where Lox is embedded as a scripting language (please don't do this ever) or in tests. Change-Id: Ided0bc04c6e80ddb23ba4693d61ac9e08b002d58 Reviewed-on: https://cl.tvl.fyi/c/depot/+/2584 Reviewed-by: tazjin Tested-by: BuildkiteCI --- users/tazjin/rlox/src/bytecode/opcode.rs | 1 + 1 file changed, 1 insertion(+) (limited to 'users/tazjin/rlox/src/bytecode/opcode.rs') diff --git a/users/tazjin/rlox/src/bytecode/opcode.rs b/users/tazjin/rlox/src/bytecode/opcode.rs index 7a3355460473..37466b30564c 100644 --- a/users/tazjin/rlox/src/bytecode/opcode.rs +++ b/users/tazjin/rlox/src/bytecode/opcode.rs @@ -28,4 +28,5 @@ pub enum OpCode { // Built in operations OpPrint, + OpPop, } -- cgit 1.4.1