MyC.Var.setMethodBuilder C# (CSharp) Method

setMethodBuilder() public method

public setMethodBuilder ( Object f ) : void
f Object
return void
  public void setMethodBuilder(Object f) { methodbuilder = f; }
  public Object getLocalToken() { return localtoken; }

Usage Example

Beispiel #1
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;
        }