internal override Expression AsExpression(Expression target) { RequireNoValueProperty(); Expression member = MemberExpression.Make(target, Binding.Member); Expression memberTemp = Spiller.MakeTemp(member.Type); var count = _initializers.Count; var block = new Expression[count + 2]; block[0] = new AssignBinaryExpression(memberTemp, member); for (var i = 0; i < count; i++) { var cr = _childRewriters[i]; var add = cr.Finish(new InstanceMethodCallExpressionN(_initializers[i].AddMethod, memberTemp, cr[0, -1])); block[i + 1] = add.Node; } // We need to copy back value types if (memberTemp.Type.IsValueType) { block[count + 1] = Expression.Block ( typeof(void), new AssignBinaryExpression(MemberExpression.Make(target, Binding.Member), memberTemp) ); } else { block[count + 1] = Utils.Empty; } return(MakeBlock(block)); }
internal override Expression AsExpression(Expression target) { RequireNoValueProperty(); Expression member = MemberExpression.Make(target, Binding.Member); Expression memberTemp = Spiller.MakeTemp(member.Type); var count = _bindings.Count; var block = new Expression[count + 2]; block[0] = new AssignBinaryExpression(memberTemp, member); for (var i = 0; i < count; i++) { var br = _bindingRewriters[i]; block[i + 1] = br.AsExpression(memberTemp); } // We need to copy back value types. if (memberTemp.Type.IsValueType) { block[count + 1] = Expression.Block ( typeof(void), new AssignBinaryExpression(MemberExpression.Make(target, Binding.Member), memberTemp) ); } else { block[count + 1] = Utils.Empty; } return(MakeBlock(block)); }
internal override Expression AsExpression(Expression target) { Expression member = MemberExpression.Make(target, Binding.Member); Expression memberTemp = Spiller.MakeTemp(member.Type); return(MakeBlock( new AssignBinaryExpression(memberTemp, _rhs), new AssignBinaryExpression(member, memberTemp), Utils.Empty )); }