The way we handle redirections for CommandExpressionAst generates too complicated code. It's better to revisit the implementation to see if it's possible to move most of this logic into a helper method and avoid generating so much complicated code.
Background: see the comment #4847 (review)