public object Call(IInterpreter interpreter, List <object> arguments) { var environment = new PerlangEnvironment(closure); for (int i = 0; i < declaration.Parameters.Count; i++) { environment.Define(declaration.Parameters[i].Name, arguments[i]); } try { interpreter.ExecuteBlock(declaration.Body, environment); return(null); } catch (Return returnValue) { return(returnValue.Value); } }
public object Call(IInterpreter interpreter, IList <object> args) { var environment = new EnkelEnvironment(_closure); for (var i = 0; i < _declaration.Params.Count; i++) { environment.Define(_declaration.Params[i], args[i]); } try { interpreter.ExecuteBlock(_declaration.Body, environment); } catch (Return @return) { return(@return.Value); } return(_isConstructor ? _closure.GetAt(0, new DummyToken(TokenType.This, "this", null, 0)) : null); }