예제 #1
0
 public ILBuilder GetMember(TinyMember mm)
 {
     if (mm.IsProperty)
     {
         var method = (mm.Property).GetGetMethod(true);
         return(CallVirtual(method));
     }
     return(LoadField((FieldInfo)mm.Field));
 }
예제 #2
0
 public ILBuilder SetMember(TinyMember mm)
 {
     if (mm.IsProperty)
     {
         var method = mm.Property.GetSetMethod(true);
         return(CallVirtual(method));
     }
     return(SetField(mm.Field));
 }
예제 #3
0
        private static void GenerateSetValue(Type model, TypeBuilder builder, TinyMember info, Type memberType)
        {
            var method = builder.DefineMethod("SetValue", CtMethodAttr,
                                              null, new Type[] { objectType, objectType });
            var processor = new ILBuilder(method.GetILGenerator());

            processor.LoadArg(1).Cast(model).LoadArg(2).CastOrUnbox(memberType);
            processor.SetMember(info);
            processor.Return();
        }
예제 #4
0
		private static void GenerateSetValue(Type model, TypeBuilder builder, TinyMember info, Type memberType)
		{
			var method = builder.DefineMethod("SetValue", CtMethodAttr, 
				null, new Type[]{objectType, objectType});
			var processor = new ILBuilder(method.GetILGenerator());

			processor.LoadArg(1).Cast(model).LoadArg(2).CastOrUnbox(memberType);
			processor.SetMember(info);
			processor.Return();
		}
예제 #5
0
        private static void GenerateGetValue(Type model, TypeBuilder builder, TinyMember info, Type memberType)
        {
            var method = builder.DefineMethod("GetValue", CtMethodAttr,
                                              objectType, new Type[] { objectType });
            var processor = new ILBuilder(method.GetILGenerator());

            processor.DeclareLocal(objectType);
            processor.LoadArg(1).Cast(model);
            processor.GetMember(info);
            if (memberType.IsValueType)
            {
                processor.Box(memberType);
            }
            processor.SetLoc(0);
            processor.LoadLoc(0);
            processor.Return();
        }
예제 #6
0
		private static void GenerateGetValue(Type model, TypeBuilder builder, TinyMember info, Type memberType)
		{
			var method = builder.DefineMethod("GetValue", CtMethodAttr, 
				objectType, new Type[]{objectType});
			var processor = new ILBuilder(method.GetILGenerator());

			processor.DeclareLocal(objectType);
			processor.LoadArg(1).Cast(model);
			processor.GetMember(info);
			if (memberType.IsValueType)
			{
				processor.Box(memberType);
			}
			processor.SetLoc(0);
			processor.LoadLoc(0);
			processor.Return();
		}
예제 #7
0
		public ILBuilder GetMember(TinyMember mm)
		{
			if (mm.IsProperty)
			{
				var method = (mm.Property).GetGetMethod(true);
				return CallVirtual(method);
			}
			return LoadField((FieldInfo)mm.Field);
		}
예제 #8
0
		public ILBuilder SetMember(TinyMember mm)
		{
			if(mm.IsProperty)
			{
				var method = mm.Property.GetSetMethod(true);
				return CallVirtual(method);
			}
			return SetField(mm.Field);
		}