Example #1
0
File: Func.cs Project: nomit007/f4
        //////////////////////////////////////////////////////////////////////////
        // Bind
        //////////////////////////////////////////////////////////////////////////
        public Func bind(List args)
        {
            if (args.sz() == 0) return this;
              if (args.sz() > @params().sz()) throw ArgErr.make("args.size > params.size").val;

              Type[] newParams = new Type[@params().sz()-args.sz()];
              for (int i=0; i<newParams.Length; ++i)
            newParams[i] = ((Param)@params().get(args.sz()+i)).m_type;

              FuncType newType = new FuncType(newParams, this.returns());
              return new BindFunc(newType, this, args);
        }
Example #2
0
File: Func.cs Project: nomit007/f4
            public override object callList(List args)
            {
                int origReq  = [email protected]().sz();
                int haveSize = m_bound.sz() + args.sz();
                Method m = m_orig.method();
                if (m != null)
                {
                  origReq = m.minParams();
                  if (haveSize > origReq) origReq = haveSize;
                }
                if (origReq <= m_bound.sz()) return m_orig.callList(m_bound);

                object[] temp = new object[haveSize];
                m_bound.copyInto(temp, 0, m_bound.sz());
                args.copyInto(temp, m_bound.sz(), temp.Length-m_bound.sz());
                return m_orig.callList(new List(Sys.ObjType, temp));
            }