public Void VisitAnonymousFunctionExpr(Expr.AnonymousFunction expr) { var enclosingFunction = _currentFunction; _currentFunction = FunctionType.FUNCTION; BeginScope(); foreach (var param in expr.Parameters) { Declare(param); Define(param); } Resolve(expr.Body); EndScope(); _currentFunction = enclosingFunction; return(null); }
public object VisitAnonymousFunctionExpr(Expr.AnonymousFunction expr) => new LoxAnonymousFunction(expr, _environment);
public LoxAnonymousFunction(Expr.AnonymousFunction declaration, LoxEnvironment closure) { _declaration = declaration; _closure = closure; }