From 7a75e7341b9a7287681fa0a850365a50ab6a993b Mon Sep 17 00:00:00 2001 From: ridiculousfish Date: Mon, 14 Apr 2014 11:12:40 -0700 Subject: [PATCH] Eliminate the parser_use_ast switch, which does nothing, and exec_no_exec, which also does nothing in the new parser --- exec.cpp | 40 ---------------------------------------- parser.cpp | 13 ------------- parser.h | 4 ---- 3 files changed, 57 deletions(-) diff --git a/exec.cpp b/exec.cpp index 320bcdd46..ca2c05d79 100644 --- a/exec.cpp +++ b/exec.cpp @@ -574,45 +574,6 @@ static bool can_use_posix_spawn_for_job(const job_t *job, const process_t *proce 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) { pid_t pid = 0; @@ -633,7 +594,6 @@ void exec_job(parser_t &parser, job_t *j) if (no_exec) { - exec_no_exec(parser, j); return; } diff --git a/parser.cpp b/parser.cpp index ec0f2256e..eebab3493 100644 --- a/parser.cpp +++ b/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) { } - -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(var); - } -} diff --git a/parser.h b/parser.h index 6d4af156f..8ffe82c8a 100644 --- a/parser.h +++ b/parser.h @@ -433,8 +433,4 @@ public: void stack_trace(size_t block_idx, wcstring &buff) const; }; -/* Temporary */ -bool parser_use_ast(void); - - #endif