From fc710d038f62ff0796984939866c64ad10fc9201 Mon Sep 17 00:00:00 2001 From: Brandon Dyck Date: Tue, 11 Jul 2023 13:12:02 -0600 Subject: [PATCH] Added record update field punning --- Interpreter.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Interpreter.cs b/Interpreter.cs index 45aeee7..e1bad2e 100644 --- a/Interpreter.cs +++ b/Interpreter.cs @@ -508,10 +508,10 @@ public class Interpreter : AST.IExprVisitor throw new RuntimeError(tok, "Record updates must be to unique fields."); } updateLabels.Add(label); - if (update.Value == null) throw new NotImplementedException(); + var updateValue = update.Value == null ? env[update.Name] : evaluate(env, update.Value); try { - baseRec = baseRec.Update(label, evaluate(env, update.Value)); + baseRec = baseRec.Update(label, updateValue); } catch {