c# 7 features are breaking things

This commit is contained in:
Dylan Wilson
2018-05-02 20:43:46 +10:00
parent 4c6e2e7995
commit c55a8ce5d0
5 changed files with 9 additions and 6 deletions
@@ -19,7 +19,7 @@ namespace MonoGame.Extended.Tweening
private static Func<object, object> CompileGetMethod(FieldInfo fieldInfo)
{
var self = Expression.Parameter(typeof(object));
var instance = Expression.Convert(self, fieldInfo.DeclaringType ?? throw new InvalidOperationException());
var instance = Expression.Convert(self, fieldInfo.DeclaringType);
var field = Expression.Field(instance, fieldInfo);
var convert = Expression.TypeAs(field, typeof(object));
@@ -44,8 +44,8 @@ namespace MonoGame.Extended.Tweening
public T Value
{
get => (T)_getMethod(Target);
set => _setMethod(Target, value);
get { return (T) _getMethod(Target); }
set { _setMethod(Target, value); }
}
}
}
@@ -22,7 +22,7 @@ namespace MonoGame.Extended.Tweening
private static Func<object, object> CompileGetMethod(PropertyInfo propertyInfo)
{
var param = Expression.Parameter(typeof(object));
var instance = Expression.Convert(param, propertyInfo.DeclaringType ?? throw new InvalidOperationException());
var instance = Expression.Convert(param, propertyInfo.DeclaringType);
var convert = Expression.TypeAs(Expression.Property(instance, propertyInfo), typeof(object));
return Expression.Lambda<Func<object, object>>(convert, param).Compile();
}