コード例 #1
0
        private static Expression ReduceDynamicIndex(GetIndexDynamicCSharpExpression index, Func <Expression, Expression> functionalOp, CSharpBinderFlags flags, bool prefix)
        {
            var args  = default(DynamicCSharpArgument[]);
            var block = default(Expression[]);
            var temps = default(ParameterExpression[]);
            var i     = CopyArguments(index.Object, index.Arguments, prefix, out args, out block, out temps);

            index = index.Update(temps[0], new TrueReadOnlyCollection <DynamicCSharpArgument>(args));

            if (prefix)
            {
                block[i++] = index.ReduceAssignment(functionalOp(index), flags);
            }
            else
            {
                var lastTemp = temps[i] = Expression.Parameter(index.Type, "__index");

                block[i] = Expression.Assign(temps[i], index);
                i++;

                block[i++] = index.ReduceAssignment(functionalOp(lastTemp), flags);
                block[i++] = lastTemp;
            }

            var res = Expression.Block(temps, block);

            return(res);
        }
コード例 #2
0
        private static Expression ReduceDynamicIndex(GetIndexDynamicCSharpExpression index, Func<Expression, Expression> functionalOp, CSharpBinderFlags flags, bool prefix)
        {
            var args = default(DynamicCSharpArgument[]);
            var block = default(Expression[]);
            var temps = default(ParameterExpression[]);
            var i = CopyArguments(index.Object, index.Arguments, prefix, out args, out block, out temps);

            index = index.Update(temps[0], new TrueReadOnlyCollection<DynamicCSharpArgument>(args));

            if (prefix)
            {
                block[i++] = index.ReduceAssignment(functionalOp(index), flags);
            }
            else
            {
                var lastTemp = temps[i] = Expression.Parameter(index.Type, "__index");

                block[i] = Expression.Assign(temps[i], index);
                i++;

                block[i++] = index.ReduceAssignment(functionalOp(lastTemp), flags);
                block[i++] = lastTemp;
            }

            var res = Expression.Block(temps, block);
            return res;
        }
コード例 #3
0
        protected internal override Expression VisitDynamicGetIndex(GetIndexDynamicCSharpExpression node)
        {
            var args = VisitDynamicCSharpExpression(node);

            args.Add(new XElement(nameof(node.Object), Visit(node.Object)));
            args.Add(Visit(nameof(node.Arguments), node.Arguments, Visit));

            return(Push(node, args));
        }
コード例 #4
0
        private Expression ReduceAssign()
        {
            var lhs = Left.Expression;

            return(lhs switch
            {
                GetMemberDynamicCSharpExpression getMember => getMember.ReduceAssignment(Right.Expression, Flags, Left.Flags, Right.Flags),
                GetIndexDynamicCSharpExpression getIndex => getIndex.ReduceAssignment(Right.Expression, Flags, Left.Flags, Right.Flags),
                _ => ReduceStaticAssign(),
            });
コード例 #5
0
        public static Expression ReduceDynamicAssignment(DynamicCSharpArgument left, Func <Expression, Expression> functionalOp, CSharpBinderFlags flags, bool prefix = true)
        {
            var lhs = MakeWriteable(left.Expression);

            return(lhs switch
            {
                GetMemberDynamicCSharpExpression dynamicMember => ReduceDynamicMember(dynamicMember, functionalOp, flags, prefix),
                GetIndexDynamicCSharpExpression dynamicIndex => ReduceDynamicIndex(dynamicIndex, functionalOp, flags, prefix),
                _ => Helpers.ReduceAssignment(lhs, functionalOp, prefix),
            });
コード例 #6
0
 public GetIndexDynamicCSharpExpressionProxy(GetIndexDynamicCSharpExpression node)
 {
     _node = node;
 }
コード例 #7
0
 protected internal virtual Expression VisitDynamicGetIndex(GetIndexDynamicCSharpExpression node)
 {
     return(node.Update(Visit(node.Object), Visit(node.Arguments, VisitDynamicArgument)));
 }
コード例 #8
0
 public GetIndexDynamicCSharpExpressionProxy(GetIndexDynamicCSharpExpression node)
 {
     _node = node;
 }
コード例 #9
0
 protected internal virtual Expression VisitDynamicGetIndex(GetIndexDynamicCSharpExpression node)
 {
     return node.Update(Visit(node.Object), Visit(node.Arguments, VisitDynamicArgument));
 }