Example #1
0
 public override CodeNode VisitSkipAssignmentIfMissingValue(SkipAssignmentIfMissingValueNode node)
 {
     _Writer.WriteStartElement("SkipAssignmentIfMissingValue");
     _Writer.WriteAttributeString("MissingValue", node.MissingValue.ToString());
     _Writer.WriteAttributeString("Type", node.MissingValue.GetType().ToString());
     _Writer.WriteEndElement();
     return(node);
 }
Example #2
0
 public override CodeNode VisitSkipAssignmentIfMissingValue(SkipAssignmentIfMissingValueNode node)
 {
     if (!_InFieldAssignment)
     {
         throw new InvalidOperationException("SkipAssignmentIfMissingValueNode must be in a FieldAssignmentNode");
     }
     ILGen.Ldloca(_FieldLocal);
     ILGen.Ldc(node.MissingValue, node.MissingValue.GetType());
     //BUG: Revisit this.  The purpose of constrained is so you don't have to do different codegen for valuetype vs. reference type
     if (_FieldLocal.LocalType.IsValueType)
     {
         ILGen.Box(_FieldLocal.LocalType);
     }
     ILGen.Constrained(_FieldLocal.LocalType);
     // TODO: if (!node.AllowMissingValue) { do the next two lines... }
     ILGen.Callvirt(typeof(object).GetMethod("Equals", typeof(object)));
     ILGen.Brtrue(_SkipAssignmentLabel);
     return(node);
 }
Example #3
0
 public virtual CodeNode VisitSkipAssignmentIfMissingValue(SkipAssignmentIfMissingValueNode node)
 {
     return(node);
 }