예제 #1
0
파일: LpObject.cs 프로젝트: baban/lp
        public LpObject funcall(string name, LpObject self, LpObject[] args, LpObject block)
        {
            LpObject ret = execMethod(name, self, args, block);

            if (ret != null)
            {
                return(ret);
            }

            LpMethod m = null;

            // method_missing
            m = methods["method_missing"] as LpMethod;
            if (null != m)
            {
                return(m.funcall(self, args, block));
            }

            // superclass
            if (null != superclass)
            {
                return(superclass.funcall(name, self, args, block));
            }

            throw new Error.LpNoMethodError();
        }
예제 #2
0
파일: LpObject.cs 프로젝트: baban/lp
        public LpObject doMethod(System.Object method, LpObject self, LpObject[] args, LpObject block)
        {
            LpMethod m = null;

            if (null != (m = method as LpMethod))
            {
                return(m.funcall(self, args, block));
            }
            else
            {
                var klass = (method as LpObject);
                switch (klass.class_name)
                {
                case "Macro":
                    return(LpMacro.call((LpObject)method, args, block));

                case "Lambda":
                case "Block":
                    return(LpLambda.call((LpObject)method, args, block));

                default:
                    return(null);
                }
            }
        }