getFieldBuilder() public method

public getFieldBuilder ( ) : Object
return Object
Exemplo n.º 1
0
        void genLoad(Var e)
        {
            int id = e.getClassId();

            if (e == null)
            {
                Io.ICE("Load instruction with no variable ptr");
            }
            if (e.getLocalToken() != null)
            {
                //    LocalToken lt = (LocalToken) e.getLocalToken();
                LocalBuilder lt = (LocalBuilder)e.getLocalToken();
                il.Emit(OpCodes.Ldloc, lt);
            }
            else if (e.getFieldBuilder() != null)
            {
                FieldBuilder fb = (FieldBuilder)e.getFieldBuilder();
                if (id == Tok.T_STATIC)
                {
                    il.Emit(OpCodes.Ldsfld, fb);
                }
                else
                {
                    il.Emit(OpCodes.Ldfld, fb);
                }
            }
            else
            {
                int index = e.getIndex();
                if (id == Tok.T_PARAM)
                {
                    if (index <= 256)
                    {
                        il.Emit(OpCodes.Ldarg_S, index);
                    }
                    else
                    {
                        il.Emit(OpCodes.Ldarg, index);
                    }
                }
                else if (id == Tok.T_AUTO || id == Tok.T_DEFCLASS)
                {
                    if (index <= 256)
                    {
                        il.Emit(OpCodes.Ldloc_S, e.getIndex());
                    }
                    else
                    {
                        il.Emit(OpCodes.Ldloc, e.getIndex());
                    }
                }
                else
                {
                    Io.ICE("Instruction load of unknown class ("
                           + e.getClassId() + ")");
                }
            }
        }
Exemplo n.º 2
0
        public void Store(IAsm a)
        {
            Var e  = a.getVar();
            int id = e.getClassId();

            if (e == null)
            {
                Io.ICE("Store instruction with no variable ptr");
            }
            if (e.getLocalToken() != null)
            {
                //    LocalToken lt = (LocalToken) e.getLocalToken();
                LocalBuilder lt = (LocalBuilder)e.getLocalToken();
                il.Emit(OpCodes.Stloc, lt);
            }
            else if (e.getFieldBuilder() != null)
            {
                FieldBuilder fb = (FieldBuilder)e.getFieldBuilder();
                if (id == Tok.T_STATIC)
                {
                    il.Emit(OpCodes.Stsfld, fb);
                }
                else
                {
                    il.Emit(OpCodes.Stfld, fb);
                }
            }
            else
            {
                int index = e.getIndex();
                if (id == Tok.T_PARAM)
                {
                    if (index <= 256)
                    {
                        il.Emit(OpCodes.Starg_S, index);
                    }
                    else
                    {
                        il.Emit(OpCodes.Starg, index);
                    }
                }
                else if (id == Tok.T_AUTO || id == Tok.T_DEFCLASS)
                {
                    il.Emit(OpCodes.Stloc, index);
                }
                else
                {
                    Io.ICE("Instruction load of unknown class ("
                           + e.getClassId() + ")");
                }
            }
        }
Exemplo n.º 3
0
void genLoad(Var e)
  {
  int id = e.getClassId();
  if (e == null)
    Io.ICE("Load instruction with no variable ptr");
  if (e.getLocalToken() != null)
    {
    //    LocalToken lt = (LocalToken) e.getLocalToken();
    LocalBuilder lt = (LocalBuilder) e.getLocalToken();
    il.Emit(OpCodes.Ldloc, lt);
    }
  else if (e.getFieldBuilder() != null)
    {
    FieldBuilder fb = (FieldBuilder) e.getFieldBuilder();
    if (id == Tok.T_STATIC)
      il.Emit(OpCodes.Ldsfld, fb);
    else
      il.Emit(OpCodes.Ldfld, fb);
    }
  else
    {
    int index = e.getIndex();
    if (id == Tok.T_PARAM)
      {
      if (index <= 256)
	il.Emit(OpCodes.Ldarg_S, index);
      else
	il.Emit(OpCodes.Ldarg, index);
      }
    else if (id == Tok.T_AUTO || id == Tok.T_DEFCLASS)
      {
      if (index <= 256)
	il.Emit(OpCodes.Ldloc_S, e.getIndex());
      else
	il.Emit(OpCodes.Ldloc, e.getIndex());
      }
    else
      Io.ICE("Instruction load of unknown class ("
				     + e.getClassId()+")");
    }
  }