fix minify single block for some situations
This commit is contained in:
parent
8c63b9a35e
commit
f8b5e04423
2 changed files with 5 additions and 2 deletions
|
|
@ -455,7 +455,7 @@ block* do_one_minify_single_block(block* in)
|
||||||
ret = l->cls[0]->pls[0]->cmds[0];
|
ret = l->cls[0]->pls[0]->cmds[0];
|
||||||
|
|
||||||
// if is a subshell and has some env set: don't remove it
|
// if is a subshell and has some env set: don't remove it
|
||||||
if(in->type == _obj::block_subshell && has_env_set(in))
|
if(in->type == _obj::block_subshell && has_env_set(ret))
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|
@ -485,6 +485,9 @@ bool r_minify_single_block(_obj* in)
|
||||||
// replace value
|
// replace value
|
||||||
delete t->cmds[i];
|
delete t->cmds[i];
|
||||||
t->cmds[i] = ret;
|
t->cmds[i] = ret;
|
||||||
|
|
||||||
|
recurse(r_minify_single_block, in);
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}; break;
|
}; break;
|
||||||
|
|
|
||||||
|
|
@ -140,7 +140,7 @@ bool possibly_expands(arglist* in)
|
||||||
|
|
||||||
bool cmd::has_var_assign()
|
bool cmd::has_var_assign()
|
||||||
{
|
{
|
||||||
if(this->args->size() == 0)
|
if(this->args == nullptr || this->args->size() == 0)
|
||||||
{
|
{
|
||||||
return this->var_assigns.size()>0;
|
return this->var_assigns.size()>0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue