Allow variable defs to use earlier names in list
This commit is contained in:
parent
352fa9616e
commit
bc57ed9df0
@ -490,7 +490,9 @@ public class Interpreter : AST.IExprVisitor<Env, object>
|
|||||||
switch (binding)
|
switch (binding)
|
||||||
{
|
{
|
||||||
case VarBinding(var pattern, var valueExpr):
|
case VarBinding(var pattern, var valueExpr):
|
||||||
var value = evaluate(env, valueExpr);
|
// By passing newEnv, we let the var definition refer to
|
||||||
|
// earlier bindings in the list.
|
||||||
|
var value = evaluate(newEnv, valueExpr);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
pattern.accept((value, newEnv), new PatternBinder());
|
pattern.accept((value, newEnv), new PatternBinder());
|
||||||
|
Loading…
Reference in New Issue
Block a user