aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEdvard Thörnros <edvard.thornros@gmail.com>2021-02-10 22:12:31 +0100
committerEdvard Thörnros <edvard.thornros@gmail.com>2021-02-10 22:12:31 +0100
commitcd1e464c11fb84ef8319e52019c23c0a91d5e3a7 (patch)
tree27975901883ebb8aaa79f21acbfa3937b1b60a0e
parentbe4559ed0af1d12401365b5ffeae99885842314f (diff)
downloadsylt-cd1e464c11fb84ef8319e52019c23c0a91d5e3a7.tar.gz
fix the assignment
-rw-r--r--src/compiler.rs6
1 files changed, 5 insertions, 1 deletions
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 {