Beispiel #1
0
 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);
 }
Beispiel #2
0
 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);
 }
Beispiel #3
0
 public virtual CodeNode VisitAssignFieldToProperty(AssignFieldToPropertyNode node)
 {
     return(node);
 }