From 71bb883cbaf834850328c2a8f87a26a7ec6f9129 Mon Sep 17 00:00:00 2001 From: zawz Date: Thu, 19 Nov 2020 17:05:37 +0100 Subject: [PATCH] Fix missing recursive call on redirs in blocks --- include/recursive.hpp | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/include/recursive.hpp b/include/recursive.hpp index 69294d9..604005c 100644 --- a/include/recursive.hpp +++ b/include/recursive.hpp @@ -75,12 +75,19 @@ void recurse(bool (&fct)(_obj*, Args...), _obj* o, Args... args) subshell* t = dynamic_cast(o); recurse(fct, t->lst, args...); + for(auto it: t->redirs) + recurse(fct, it, args...); + break; } case _obj::block_brace : { brace* t = dynamic_cast(o); recurse(fct, t->lst, args...); + + for(auto it: t->redirs) + recurse(fct, it, args...); + break; } case _obj::block_main : @@ -88,12 +95,19 @@ void recurse(bool (&fct)(_obj*, Args...), _obj* o, Args... args) shmain* t = dynamic_cast(o); recurse(fct, t->lst, args...); + for(auto it: t->redirs) + recurse(fct, it, args...); + break; } case _obj::block_function : { function* t = dynamic_cast(o); recurse(fct, t->lst, args...); + + for(auto it: t->redirs) + recurse(fct, it, args...); + break; } case _obj::block_cmd : @@ -102,6 +116,10 @@ void recurse(bool (&fct)(_obj*, Args...), _obj* o, Args... args) recurse(fct, t->args, args...); for(auto it: t->var_assigns) recurse(fct, it.second, args...); + + for(auto it: t->redirs) + recurse(fct, it, args...); + break; } case _obj::block_case : @@ -118,6 +136,10 @@ void recurse(bool (&fct)(_obj*, Args...), _obj* o, Args... args) } recurse(fct, sc.second, args...); } + + for(auto it: t->redirs) + recurse(fct, it, args...); + break; } case _obj::block_if : @@ -133,6 +155,10 @@ void recurse(bool (&fct)(_obj*, Args...), _obj* o, Args... args) } // else recurse(fct, t->else_lst, args...); + + for(auto it: t->redirs) + recurse(fct, it, args...); + break; } case _obj::block_for : @@ -142,6 +168,10 @@ void recurse(bool (&fct)(_obj*, Args...), _obj* o, Args... args) recurse(fct, t->iter, args...); // for block recurse(fct, t->ops, args...); + + for(auto it: t->redirs) + recurse(fct, it, args...); + break; } case _obj::block_while : @@ -151,6 +181,10 @@ void recurse(bool (&fct)(_obj*, Args...), _obj* o, Args... args) recurse(fct, t->cond, args...); // operations recurse(fct, t->ops, args...); + + for(auto it: t->redirs) + recurse(fct, it, args...); + break; } case _obj::subarg_subshell :