From aaaf72b3f4eddfe82262caf5e07a2f029c068143 Mon Sep 17 00:00:00 2001 From: Baitinq Date: Sun, 12 Jan 2025 16:48:43 +0100 Subject: Evaluator: Fix bug when variables are initialized with the same identifier as the defined --- src/evaluator.zig | 3 ++- todo/3.src | 1 - 2 files changed, 2 insertions(+), 2 deletions(-) delete mode 100644 todo/3.src 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; -- cgit 1.4.1