mirror of
https://github.com/fish-shell/fish-shell
synced 2025-01-13 05:28:49 +00:00
Eliminate the parser_use_ast switch, which does nothing, and
exec_no_exec, which also does nothing in the new parser
This commit is contained in:
parent
ec6dee8bd1
commit
7a75e7341b
3 changed files with 0 additions and 57 deletions
40
exec.cpp
40
exec.cpp
|
@ -574,45 +574,6 @@ static bool can_use_posix_spawn_for_job(const job_t *job, const process_t *proce
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* What exec does if no_exec is set. This only has to handle block pushing and popping. See #624. */
|
|
||||||
static void exec_no_exec(parser_t &parser, const job_t *job)
|
|
||||||
{
|
|
||||||
if (parser_use_ast())
|
|
||||||
{
|
|
||||||
/* With the new parser, commands aren't responsible for pushing / popping blocks, so there's nothing to do */
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Hack hack hack. If this is an 'end' job, then trigger a pop. If this is a job that would create a block, trigger a push. See #624 */
|
|
||||||
const process_t *p = job->first_process;
|
|
||||||
if (p && p->type == INTERNAL_BUILTIN)
|
|
||||||
{
|
|
||||||
const wchar_t *builtin_name_cstr = p->argv0();
|
|
||||||
if (builtin_name_cstr != NULL)
|
|
||||||
{
|
|
||||||
const wcstring builtin_name = builtin_name_cstr;
|
|
||||||
if (contains(builtin_name, L"for", L"function", L"begin", L"switch"))
|
|
||||||
{
|
|
||||||
// The above builtins are the ones that produce an unbalanced block from within their function implementation
|
|
||||||
// This list should be maintained somewhere else
|
|
||||||
parser.push_block(new fake_block_t());
|
|
||||||
}
|
|
||||||
else if (builtin_name == L"end")
|
|
||||||
{
|
|
||||||
const block_t *block = parser.current_block();
|
|
||||||
if (block == NULL || block->type() == TOP)
|
|
||||||
{
|
|
||||||
fprintf(stderr, "Warning: not popping the root block\n");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
parser.pop_block();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void exec_job(parser_t &parser, job_t *j)
|
void exec_job(parser_t &parser, job_t *j)
|
||||||
{
|
{
|
||||||
pid_t pid = 0;
|
pid_t pid = 0;
|
||||||
|
@ -633,7 +594,6 @@ void exec_job(parser_t &parser, job_t *j)
|
||||||
|
|
||||||
if (no_exec)
|
if (no_exec)
|
||||||
{
|
{
|
||||||
exec_no_exec(parser, j);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
13
parser.cpp
13
parser.cpp
|
@ -1205,16 +1205,3 @@ scope_block_t::scope_block_t(block_type_t type) : block_t(type)
|
||||||
breakpoint_block_t::breakpoint_block_t() : block_t(BREAKPOINT)
|
breakpoint_block_t::breakpoint_block_t() : block_t(BREAKPOINT)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
bool parser_use_ast(void)
|
|
||||||
{
|
|
||||||
env_var_t var = env_get_string(L"fish_new_parser");
|
|
||||||
if (var.missing_or_empty())
|
|
||||||
{
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return from_string<bool>(var);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
4
parser.h
4
parser.h
|
@ -433,8 +433,4 @@ public:
|
||||||
void stack_trace(size_t block_idx, wcstring &buff) const;
|
void stack_trace(size_t block_idx, wcstring &buff) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Temporary */
|
|
||||||
bool parser_use_ast(void);
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue