public object visitCallExpr(Expr.Call expr) { object callee = evaluate(expr.callee); List <object> arguments = new List <object>(); foreach (Expr argument in expr.arguments) { arguments.Add(evaluate(argument)); } if (!(callee is LoxCallable)) { throw new RuntimeError(expr.paren, "Can only call functions and classes."); } LoxCallable function = (LoxCallable)callee; if (arguments.Count != function.arity()) { throw new RuntimeError(expr.paren, "Expected " + function.arity() + " arguments but got " + arguments.Count + "."); } return(function.call(this, arguments)); }
public object visitCallExpr(Expr.Call expr) { resolve(expr.callee); foreach (Expr argument in expr.arguments) { resolve(argument); } return(null); }
public string visitCallExpr(Expr.Call expr) { return(""); }