summary refs log tree commit diff
diff options
context:
space:
mode:
authorBaitinq <manuelpalenzuelamerino@gmail.com>2025-01-12 16:48:43 +0100
committerBaitinq <manuelpalenzuelamerino@gmail.com>2025-01-12 16:48:43 +0100
commitaaaf72b3f4eddfe82262caf5e07a2f029c068143 (patch)
tree67fc9ea8ad6c53b59333d873b597a2a2b8ba4aae
parentTokenizer: Fix tokenizer invalid strings (diff)
downloadinterpreter-aaaf72b3f4eddfe82262caf5e07a2f029c068143.tar.gz
interpreter-aaaf72b3f4eddfe82262caf5e07a2f029c068143.tar.bz2
interpreter-aaaf72b3f4eddfe82262caf5e07a2f029c068143.zip
Evaluator: Fix bug when variables are initialized with the same identifier as the defined
-rw-r--r--src/evaluator.zig3
-rw-r--r--todo/3.src1
2 files changed, 2 insertions, 2 deletions
diff --git a/src/evaluator.zig b/src/evaluator.zig
index e8e1bc5..f8bb052 100644
--- a/src/evaluator.zig
+++ b/src/evaluator.zig
@@ -90,7 +90,8 @@ pub const Evaluator = struct {
                     std.debug.print("Identifier {any} not found\n", .{identifier.name});
                     return EvaluatorError.EvaluationError;
                 };
-                return try self.get_expression_value(expression.?);
+
+                return try self.get_expression_value(expression orelse return EvaluatorError.EvaluationError);
             },
         };
     }
diff --git a/todo/3.src b/todo/3.src
deleted file mode 100644
index 29ade8c..0000000
--- a/todo/3.src
+++ /dev/null
@@ -1 +0,0 @@
-let x = x;