Fix missing recursive call on redirs in blocks

This commit is contained in:
zawz 2020-11-19 17:05:37 +01:00
parent 806580ac2a
commit 71bb883cba

View file

@ -75,12 +75,19 @@ void recurse(bool (&fct)(_obj*, Args...), _obj* o, Args... args)
subshell* t = dynamic_cast<subshell*>(o); subshell* t = dynamic_cast<subshell*>(o);
recurse(fct, t->lst, args...); recurse(fct, t->lst, args...);
for(auto it: t->redirs)
recurse(fct, it, args...);
break; break;
} }
case _obj::block_brace : case _obj::block_brace :
{ {
brace* t = dynamic_cast<brace*>(o); brace* t = dynamic_cast<brace*>(o);
recurse(fct, t->lst, args...); recurse(fct, t->lst, args...);
for(auto it: t->redirs)
recurse(fct, it, args...);
break; break;
} }
case _obj::block_main : case _obj::block_main :
@ -88,12 +95,19 @@ void recurse(bool (&fct)(_obj*, Args...), _obj* o, Args... args)
shmain* t = dynamic_cast<shmain*>(o); shmain* t = dynamic_cast<shmain*>(o);
recurse(fct, t->lst, args...); recurse(fct, t->lst, args...);
for(auto it: t->redirs)
recurse(fct, it, args...);
break; break;
} }
case _obj::block_function : case _obj::block_function :
{ {
function* t = dynamic_cast<function*>(o); function* t = dynamic_cast<function*>(o);
recurse(fct, t->lst, args...); recurse(fct, t->lst, args...);
for(auto it: t->redirs)
recurse(fct, it, args...);
break; break;
} }
case _obj::block_cmd : case _obj::block_cmd :
@ -102,6 +116,10 @@ void recurse(bool (&fct)(_obj*, Args...), _obj* o, Args... args)
recurse(fct, t->args, args...); recurse(fct, t->args, args...);
for(auto it: t->var_assigns) for(auto it: t->var_assigns)
recurse(fct, it.second, args...); recurse(fct, it.second, args...);
for(auto it: t->redirs)
recurse(fct, it, args...);
break; break;
} }
case _obj::block_case : case _obj::block_case :
@ -118,6 +136,10 @@ void recurse(bool (&fct)(_obj*, Args...), _obj* o, Args... args)
} }
recurse(fct, sc.second, args...); recurse(fct, sc.second, args...);
} }
for(auto it: t->redirs)
recurse(fct, it, args...);
break; break;
} }
case _obj::block_if : case _obj::block_if :
@ -133,6 +155,10 @@ void recurse(bool (&fct)(_obj*, Args...), _obj* o, Args... args)
} }
// else // else
recurse(fct, t->else_lst, args...); recurse(fct, t->else_lst, args...);
for(auto it: t->redirs)
recurse(fct, it, args...);
break; break;
} }
case _obj::block_for : case _obj::block_for :
@ -142,6 +168,10 @@ void recurse(bool (&fct)(_obj*, Args...), _obj* o, Args... args)
recurse(fct, t->iter, args...); recurse(fct, t->iter, args...);
// for block // for block
recurse(fct, t->ops, args...); recurse(fct, t->ops, args...);
for(auto it: t->redirs)
recurse(fct, it, args...);
break; break;
} }
case _obj::block_while : case _obj::block_while :
@ -151,6 +181,10 @@ void recurse(bool (&fct)(_obj*, Args...), _obj* o, Args... args)
recurse(fct, t->cond, args...); recurse(fct, t->cond, args...);
// operations // operations
recurse(fct, t->ops, args...); recurse(fct, t->ops, args...);
for(auto it: t->redirs)
recurse(fct, it, args...);
break; break;
} }
case _obj::subarg_subshell : case _obj::subarg_subshell :