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); }
internal object Get(Token name) { if (fields.ContainsKey(name.lexeme)) { return(fields[name.lexeme]); } LoxFunction method = klass.FindMethod(name.lexeme); if (method != null) { return(method.Bind(this)); } throw new RuntimeError(name, "Undefined property '" + name.lexeme + "'."); }