internal LoxFunction Bind(LoxInstance instance) { Environment environment = new Environment(closure); environment.Define("this", instance); return(new LoxFunction(declaration, environment, isInitializer)); }
public object Call(Interpreter interpreter, List <object> arguments) { LoxInstance instance = new LoxInstance(this); LoxFunction initilizer = FindMethod("init"); if (initilizer != null) { initilizer.Bind(instance).Call(interpreter, arguments); } return(instance); }