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); }
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; }
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)); }
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(), });
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), });
public GetIndexDynamicCSharpExpressionProxy(GetIndexDynamicCSharpExpression node) { _node = node; }
protected internal virtual Expression VisitDynamicGetIndex(GetIndexDynamicCSharpExpression node) { return(node.Update(Visit(node.Object), Visit(node.Arguments, VisitDynamicArgument))); }
protected internal virtual Expression VisitDynamicGetIndex(GetIndexDynamicCSharpExpression node) { return node.Update(Visit(node.Object), Visit(node.Arguments, VisitDynamicArgument)); }