From 2f1e2f993002116aab6b496fe02d7d2759dd5b1b Mon Sep 17 00:00:00 2001 From: Patric Bucher Date: Fri, 5 Jul 2024 18:38:41 +0100 Subject: [PATCH] Fixing line value for constants --- src/compiler/parser/mod.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/compiler/parser/mod.rs b/src/compiler/parser/mod.rs index 2dcd2a7..bc47c92 100644 --- a/src/compiler/parser/mod.rs +++ b/src/compiler/parser/mod.rs @@ -179,7 +179,8 @@ impl Parser { } fn emit_constant(&mut self, value: Value) { - self.current_block().write_constant(value, 0) + let line = self.previous_token.line; + self.current_block().write_constant(value, line) } fn emit_op_code(&mut self, op_code: OpCode) {