Exemple #1
0
        public void FuncBegin(IAsm a)
        {
            Var  func    = a.getVar();
            Type funcsig = genDataTypeSig(a.getVar());

            VarList paramlist = func.getParams();

            Type[] paramTypes = null;

            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);

            for (int i = 0; i < paramlist.Length(); i++)
            {
                emethod.DefineParameter(i + 1, 0, paramlist.FindByIndex(i).getName());
            }

            il = emethod.GetILGenerator();

            if (func.getName().ToLower().Equals("main"))
            {
                appbuild.SetEntryPoint(emethod);
            }
            //    emodule.SetUserEntryPoint(emethod);

            labelhash = new Hashtable();
        }