getParams() публичный Метод

public getParams ( ) : VarList
Результат VarList
Пример #1
0
        public void Call(IAsm a)
        {
            Var    func    = a.getVar();
            String funcsig = genDataTypeSig(a.getVar()); /* gen type info */

            VarList x        = func.getParams();         /* get any params */
            String  paramsig = "";

            if (x.Length() > 0)
            {
                int           max = x.Length();
                StringBuilder t   = new StringBuilder(MyC.MAXSTR);
                for (int i = 0; i < max; i++)
                {
                    Var e = x.FindByIndex(i);
                    t.Append(genDataTypeSig(e));
                    if (i < max - 1)
                    {
                        t.Append(",");
                    }
                }
                paramsig = t.ToString();
            }

            StringBuilder sb = new StringBuilder(MyC.MAXSTR);

            sb.Append("\tcall ");
            sb.Append(funcsig);
            sb.Append("(");
            sb.Append(paramsig);
            sb.Append(")\t//");
            sb.Append(a.getICount());
            sb.Append("\r\n");
            io.Out(sb.ToString());
        }
Пример #2
0
        public void FuncBegin(IAsm a)
        {
            Var  func    = a.getVar();
            Type funcsig = genDataTypeSig(a.getVar()); /* gen return type info */

            VarList paramlist = func.getParams();      /* get any params */

            Type[] paramTypes = null;                  // in case no params
            if (paramlist.Length() > 0)
            {
                int max = paramlist.Length();
                paramTypes = new Type[max];
                for (int i = 0; i < max; i++)
                {
                    Var e = paramlist.FindByIndex(i);
                    paramTypes[i] = genDataTypeSig(e);
                }
            }

            emethod = eclass.DefineMethod(func.getName(),
                                          MethodAttributes.Static | MethodAttributes.Public,
                                          funcsig, paramTypes);
            func.setMethodBuilder(emethod); // save the method ref

            /*
             * set the argument symbol info
             */
            for (int i = 0; i < paramlist.Length(); i++)
            {
                emethod.DefineParameter(i + 1, 0, paramlist.FindByIndex(i).getName());
            }

            il = emethod.GetILGenerator();     // create new il generator

            if (func.getName().Equals("main")) /* special entry point for main */
            {
                appbuild.SetEntryPoint(emethod);
            }
            //    emodule.SetUserEntryPoint(emethod);

            /*
             * must also re-init the label hashtable for each function
             */
            labelhash = new Hashtable();

            localsdone = false;
        }
Пример #3
0
        public void FuncBegin(IAsm a)
        {
            Var    func    = a.getVar();
            String funcsig = genDataTypeSig(a.getVar()); /* gen type info */

            VarList x        = func.getParams();         /* get any params */
            String  paramsig = "";

            if (x.Length() > 0)
            {
                int           max = x.Length();
                StringBuilder t   = new StringBuilder(MyC.MAXSTR);
                for (int i = 0; i < max; i++)
                {
                    Var e = x.FindByIndex(i);
                    t.Append(genDataTypeSig(e));
                    if (i < max - 1)
                    {
                        t.Append(",");
                    }
                }
                paramsig = t.ToString();
            }
            StringBuilder sb = new StringBuilder(MyC.MAXSTR);

            sb.Append("\t.method ");
            sb.Append(funcsig);
            sb.Append(" ");
            sb.Append(func.getName());
            sb.Append("(");
            sb.Append(paramsig);
            sb.Append("){\r\n");
            io.Out(sb.ToString());

            if (func.getName().Equals("main")) /* special entry point for main */
            {
                io.Out("\t.entrypoint\r\n");
            }
        }