diff --git a/src/ast.rs b/src/ast.rs index be98defca..952996d6b 100644 --- a/src/ast.rs +++ b/src/ast.rs @@ -634,7 +634,7 @@ fn can_be_parsed(pop: &mut Populator<'_>) -> bool { #[derive(Debug)] pub enum ArgumentOrRedirection { Argument(Argument), - Redirection(Redirection), + Redirection(Box), // Boxed because it's bigger } impl Default for ArgumentOrRedirection { @@ -647,7 +647,7 @@ impl Acceptor for ArgumentOrRedirection { fn accept<'a>(&'a self, visitor: &mut dyn NodeVisitor<'a>) { match self { Self::Argument(child) => visitor.visit(child), - Self::Redirection(child) => visitor.visit(child), + Self::Redirection(child) => visitor.visit(&**child), }; } } @@ -2641,7 +2641,7 @@ fn visit_argument_or_redirection(&mut self, node: &mut ArgumentOrRedirection) { if let Some(arg) = self.try_parse::() { *node = ArgumentOrRedirection::Argument(arg); } else if let Some(redir) = self.try_parse::() { - *node = ArgumentOrRedirection::Redirection(redir); + *node = ArgumentOrRedirection::Redirection(Box::new(redir)); } else { internal_error!( self,