From cd1e464c11fb84ef8319e52019c23c0a91d5e3a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edvard=20Th=C3=B6rnros?= Date: Wed, 10 Feb 2021 22:12:31 +0100 Subject: fix the assignment --- src/compiler.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/compiler.rs') diff --git a/src/compiler.rs b/src/compiler.rs index 7f0d32d..a7fc30b 100644 --- a/src/compiler.rs +++ b/src/compiler.rs @@ -799,7 +799,11 @@ impl Compiler { if let Some(var) = self.find_variable(&name) { if let Some(op) = op { - add_op(self, block, Op::Copy); + if var.upvalue { + add_op(self, block, Op::ReadUpvalue(var.slot)); + } else { + add_op(self, block, Op::ReadLocal(var.slot)); + } self.expression(block); add_op(self, block, op); } else { -- cgit v1.2.1