public override CodeNode VisitAssignFieldToProperty(AssignFieldToPropertyNode node) { _Writer.WriteStartElement("AssignFieldToProperty"); _Writer.WriteAttributeString("Type", node.FieldType.ToString()); _Writer.WriteAttributeString("Property", node.Property.Name); _Writer.WriteEndElement(); return(node); }
public override CodeNode VisitAssignFieldToProperty(AssignFieldToPropertyNode node) { if (!_InFieldAssignment) { throw new InvalidOperationException("AssignFieldToPropertyNode must be in a FieldAssignmentNode"); } ILGen.Ldloc(_ConcreteRecordLocal); ILGen.Ldloc(_FieldLocal); //handle the case where the property is a nullable version of the field type if (node.FieldType.IsValueType) { Type genericType = typeof(Nullable <>).MakeGenericType(node.FieldType); if (node.Property.PropertyType == genericType) { ILGen.Newobj(genericType, node.FieldType); } } //assign the value to the property ILGen.Callvirt(node.Property.GetSetMethod()); return(node); }
public virtual CodeNode VisitAssignFieldToProperty(AssignFieldToPropertyNode node) { return(node); }