Added record update field punning
This commit is contained in:
parent
c12a0cffc8
commit
fc710d038f
@ -508,10 +508,10 @@ public class Interpreter : AST.IExprVisitor<Env, object>
|
|||||||
throw new RuntimeError(tok, "Record updates must be to unique fields.");
|
throw new RuntimeError(tok, "Record updates must be to unique fields.");
|
||||||
}
|
}
|
||||||
updateLabels.Add(label);
|
updateLabels.Add(label);
|
||||||
if (update.Value == null) throw new NotImplementedException();
|
var updateValue = update.Value == null ? env[update.Name] : evaluate(env, update.Value);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
baseRec = baseRec.Update(label, evaluate(env, update.Value));
|
baseRec = baseRec.Update(label, updateValue);
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user