protected internal override Expression VisitArrayAccess(ArrayAccessCSharpExpression node) { var args = new List <object> { new XElement(nameof(node.Array), Visit(node.Array)), Visit(nameof(node.Indexes), node.Indexes) }; return(Push(node, args)); }
/// <summary> /// Reduces the expression node to a simpler expression. /// </summary> /// <returns>The reduced expression.</returns> public override Expression Reduce() { var left = MakeWriteable(Left); if (CSharpNodeType == CSharpExpressionType.NullCoalescingAssign) { // NB: NullCoalescingAssign is handled by the Reduce implementation on the derived type. throw ContractUtils.Unreachable; } if (CSharpNodeType == CSharpExpressionType.Assign) { // NB: We still use `ReduceAssignment` here to deal with IndexCSharpExpression which is not // a valid LHS to Expression.Assign. return(left switch { IndexCSharpExpression indexCSharp => indexCSharp.ReduceAssign(lhs => Expression.Assign(lhs, Right)), ArrayAccessCSharpExpression arrayAccessCSharp => arrayAccessCSharp.ReduceAssign(lhs => Expression.Assign(lhs, Right)), IndexerAccessCSharpExpression indexerAccessCSharp => indexerAccessCSharp.ReduceAssign(lhs => Expression.Assign(lhs, Right)), _ => Expression.Assign(left, Right) });
protected internal virtual Expression VisitArrayAccess(ArrayAccessCSharpExpression node) => node.Update( Visit(node.Array), Visit(node.Indexes) );