public override Expression asCLRSetValueExpression(Expression newValue) { return(Expression.Condition( isMutable, Expression.Assign(Expression.ArrayAccess(namedSlots, slotIndex), newValue), Expression.Block( TypeGuru.objectType, Expression.Throw(Expression.Constant(new ImmutableObjectException())), newValue))); }
public override Expression Bind(Object[] args, ReadOnlyCollection <ParameterExpression> parameters, LabelTarget returnLabel) { Expression testRuleValidityExpression = null; Expression setVariableValueExpression = null; ParameterExpression value = parameters[1]; doAllButFinalBinding( args, (BindingHandle handle) => { testRuleValidityExpression = Expression.Constant(true); setVariableValueExpression = Expression.Assign( Expression.Property(Expression.Constant(handle), "Value"), value); }); return(Expression .IfThen( testRuleValidityExpression, Expression.Return(returnLabel, setVariableValueExpression))); }
public override Expression asCLRSetValueExpression(Expression newValue) { return(Expression.Assign(parameter, newValue)); }