Example #1
0
        public ElizFunction Bind(ElizInstance instance)
        {
            Environment environment = new Environment(closure);

            environment.Define("this", instance);
            return(new ElizFunction(declaration, environment, isInitializer));
        }
Example #2
0
        public object Call(Interpreter interpreter, List <object> arguments)
        {
            ElizInstance instance = new ElizInstance(this);

            ElizFunction initializer = FindMethod("init");

            if (initializer != null)
            {
                initializer.Bind(instance).Call(interpreter, arguments);
            }

            return(instance);
        }