Example #1
0
 public virtual void GetField(FieldInstance field)
 {
     if (mv != null)
     {
         mv.GetField(field);
     }
 }
Example #2
0
 protected Type InvokeGetProperty(IMethodVisitor mv, IPropertyInfo property, Type typeOfArgumentOnStack)
 {
     if (property is MethodPropertyInfo)
     {
         MethodInfo     method = ((MethodPropertyInfo)property).Getter;
         MethodInstance mi     = new MethodInstance(method);
         if (method.DeclaringType.IsInterface)
         {
             mv.InvokeInterface(mi);
         }
         else
         {
             if (!mi.Owner.Equals(typeOfArgumentOnStack))
             {
                 mv.CheckCast(mi.Owner);
             }
             mv.InvokeVirtual(mi);
             typeOfArgumentOnStack = mi.ReturnType.Type;
         }
     }
     else
     {
         FieldInfo     field = ((FieldPropertyInfo)property).BackingField;
         FieldInstance fi    = new FieldInstance(field);
         mv.GetField(fi);
         typeOfArgumentOnStack = fi.Type.Type;
     }
     return(typeOfArgumentOnStack);
 }
 protected void InvokeGetProperty(IMethodVisitor mv, IPropertyInfo property)
 {
     if (property is MethodPropertyInfo)
     {
         MethodInfo method = ((MethodPropertyInfo)property).Getter;
         mv.InvokeVirtual(new MethodInstance(method));
     }
     else
     {
         FieldInfo field = ((FieldPropertyInfo)property).BackingField;
         mv.GetField(new FieldInstance(field));
     }
 }