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);
recurse(fct, t->lst, args...);
for(auto it: t->redirs)
recurse(fct, it, args...);
break;
}
case _obj::block_brace :
{
brace* t = dynamic_cast<brace*>(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<shmain*>(o);
recurse(fct, t->lst, args...);
for(auto it: t->redirs)
recurse(fct, it, args...);
break;
}
case _obj::block_function :
{
function* t = dynamic_cast<function*>(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 :