Exemple #1
0
 public Mutator WithAssignment(Accessor accessor, Mutator value)
 {
     if (accessor == null)
     {
         return(value.Cast(GetSortMapping()));
     }
     else
     {
         return(accessor.AcceptAssignment(this, value));
     }
 }
Exemple #2
0
        /// <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));
        }
Exemple #3
0
 public Mutator WithAssignment(ParameterAccessor accessor, Mutator value)
 {
     Debug.Assert(false, "A parameter access reached a Mutator?!");
     throw new NotImplementedException();
 }
Exemple #4
0
 public virtual Mutator WithAssignment(FieldAccessor accessor, Mutator value)
 {
     throw new NotImplementedException();
 }