public Mutator WithAssignment(Accessor accessor, Mutator value) { if (accessor == null) { return(value.Cast(GetSortMapping())); } else { return(accessor.AcceptAssignment(this, value)); } }
/// <summary> /// Return a new instance with the assignment applied. Unchanged field reuse the existing <see cref="Mutator"/> instances. /// </summary> /// <param name="accessor"></param> /// <param name="value"></param> /// <returns></returns> public override Mutator WithAssignment(FieldAccessor accessor, Mutator value) { var newMutators = _sortMapping.FieldSymbols.Zip(_fieldMutators, (Symbol, Mutator) => new { Symbol, Mutator }).Select(x => { if (x.Symbol == accessor.Symbol) { return(x.Mutator.WithAssignment(accessor.Next, value)); } else { return(x.Mutator); } }); return(new StructMutator(_sortMapping, newMutators)); }
public Mutator WithAssignment(ParameterAccessor accessor, Mutator value) { Debug.Assert(false, "A parameter access reached a Mutator?!"); throw new NotImplementedException(); }
public virtual Mutator WithAssignment(FieldAccessor accessor, Mutator value) { throw new NotImplementedException(); }