protected override Expression VisitPropertyDefinitionExpression(PropertyDefinitionExpression property) { var self = Expression.Variable(this.type, "self"); var retval = FickleExpression.Variable("NSDictionary", "retval"); var propertyExpression = FickleExpression.Property(self, property.PropertyType, property.PropertyName); var expression = GetSerializeExpression(property.PropertyType, propertyExpression, context.Options, false, c => FickleExpression.Call(retval, "setObject", new { obj = Expression.Convert(c, typeof(object)), forKey = Expression.Constant(property.PropertyName) }).ToStatement()); this.propertySetterExpressions.Add(new [] { FickleExpression.Comment(property.PropertyName), expression }.ToGroupedExpression(GroupedExpressionsExpressionStyle.Wide)); return(property); }
protected override Expression VisitPropertyDefinitionExpression(PropertyDefinitionExpression property) { var dictionaryType = new FickleType("NSDictionary"); var currentValueFromDictionary = Expression.Parameter(typeof(object), "currentValueFromDictionary"); var objectForKeyCall = Expression.Call(Expression.Parameter(dictionaryType, "properties"), new FickleMethodInfo(dictionaryType, typeof(object), "objectForKey", new ParameterInfo[] { new FickleParameterInfo(typeof(string), "key") }), Expression.Constant(property.PropertyName)); var propertyExpression = Expression.Property(Expression.Parameter(this.type, "self"), new FicklePropertyInfo(this.type, property.PropertyType, property.PropertyName)); var expressions = new List <Expression> { FickleExpression.Comment(property.PropertyName), Expression.Assign(currentValueFromDictionary, objectForKeyCall).ToStatement(), GetDeserializeExpressionProcessValueDeserializer(property.PropertyType, currentValueFromDictionary, c => Expression.Assign(propertyExpression, c).ToStatement()) }; this.propertyGetterExpressions.Add(expressions.ToStatementisedGroupedExpression(GroupedExpressionsExpressionStyle.Wide)); return(property); }