Remove FUNCTION_DEF_BLOCK and FAKE_BLOCK

These are old-parser block types that are no longer used.
This commit is contained in:
ridiculousfish 2017-01-21 13:57:05 -08:00
parent bb65b82c56
commit 7e3db843cd
2 changed files with 1 additions and 26 deletions

View file

@ -41,9 +41,6 @@ class io_chain_t;
/// If block description. /// If block description.
#define IF_BLOCK N_(L"'if' conditional block") #define IF_BLOCK N_(L"'if' conditional block")
/// Function definition block description.
#define FUNCTION_DEF_BLOCK N_(L"function definition block")
/// Function invocation block description. /// Function invocation block description.
#define FUNCTION_CALL_BLOCK N_(L"function invocation block") #define FUNCTION_CALL_BLOCK N_(L"function invocation block")
@ -53,9 +50,6 @@ class io_chain_t;
/// Switch block description. /// Switch block description.
#define SWITCH_BLOCK N_(L"'switch' block") #define SWITCH_BLOCK N_(L"'switch' block")
/// Fake block description.
#define FAKE_BLOCK N_(L"unexecutable block")
/// Top block description. /// Top block description.
#define TOP_BLOCK N_(L"global root block") #define TOP_BLOCK N_(L"global root block")
@ -89,11 +83,9 @@ static const struct block_lookup_entry block_lookup[] = {
{WHILE, L"while", WHILE_BLOCK}, {WHILE, L"while", WHILE_BLOCK},
{FOR, L"for", FOR_BLOCK}, {FOR, L"for", FOR_BLOCK},
{IF, L"if", IF_BLOCK}, {IF, L"if", IF_BLOCK},
{FUNCTION_DEF, L"function", FUNCTION_DEF_BLOCK},
{FUNCTION_CALL, 0, FUNCTION_CALL_BLOCK}, {FUNCTION_CALL, 0, FUNCTION_CALL_BLOCK},
{FUNCTION_CALL_NO_SHADOW, 0, FUNCTION_CALL_NO_SHADOW_BLOCK}, {FUNCTION_CALL_NO_SHADOW, 0, FUNCTION_CALL_NO_SHADOW_BLOCK},
{SWITCH, L"switch", SWITCH_BLOCK}, {SWITCH, L"switch", SWITCH_BLOCK},
{FAKE, 0, FAKE_BLOCK},
{TOP, 0, TOP_BLOCK}, {TOP, 0, TOP_BLOCK},
{SUBST, 0, SUBST_BLOCK}, {SUBST, 0, SUBST_BLOCK},
{BEGIN, L"begin", BEGIN_BLOCK}, {BEGIN, L"begin", BEGIN_BLOCK},
@ -161,10 +153,6 @@ void parser_t::push_block(block_t *new_current) {
new_current->skip = 0; new_current->skip = 0;
} }
// Fake blocks and function definition blocks are never executed.
if (type == FAKE || type == FUNCTION_DEF) {
new_current->skip = 1;
}
new_current->job = 0; new_current->job = 0;
new_current->loop_status = LOOP_NORMAL; new_current->loop_status = LOOP_NORMAL;
@ -176,8 +164,7 @@ void parser_t::push_block(block_t *new_current) {
is_block = 1; is_block = 1;
} }
if ((new_current->type() != FUNCTION_DEF) && (new_current->type() != FAKE) && if (new_current->type() != TOP) {
(new_current->type() != TOP)) {
env_push(type == FUNCTION_CALL); env_push(type == FUNCTION_CALL);
new_current->wants_pop_env = true; new_current->wants_pop_env = true;
} }
@ -822,10 +809,6 @@ wcstring block_t::description() const {
result.append(L"if"); result.append(L"if");
break; break;
} }
case FUNCTION_DEF: {
result.append(L"function_def");
break;
}
case FUNCTION_CALL: { case FUNCTION_CALL: {
result.append(L"function_call"); result.append(L"function_call");
break; break;
@ -838,10 +821,6 @@ wcstring block_t::description() const {
result.append(L"switch"); result.append(L"switch");
break; break;
} }
case FAKE: {
result.append(L"fake");
break;
}
case SUBST: { case SUBST: {
result.append(L"substitution"); result.append(L"substitution");
break; break;
@ -894,8 +873,6 @@ while_block_t::while_block_t() : block_t(WHILE) {}
switch_block_t::switch_block_t() : block_t(SWITCH) {} switch_block_t::switch_block_t() : block_t(SWITCH) {}
fake_block_t::fake_block_t() : block_t(FAKE) {}
scope_block_t::scope_block_t(block_type_t type) : block_t(type) { scope_block_t::scope_block_t(block_type_t type) : block_t(type) {
assert(type == BEGIN || type == TOP || type == SUBST); assert(type == BEGIN || type == TOP || type == SUBST);
} }

View file

@ -40,11 +40,9 @@ enum block_type_t {
WHILE, /// While loop block WHILE, /// While loop block
FOR, /// For loop block FOR, /// For loop block
IF, /// If block IF, /// If block
FUNCTION_DEF, /// Function definition block
FUNCTION_CALL, /// Function invocation block FUNCTION_CALL, /// Function invocation block
FUNCTION_CALL_NO_SHADOW, /// Function invocation block with no variable shadowing FUNCTION_CALL_NO_SHADOW, /// Function invocation block with no variable shadowing
SWITCH, /// Switch block SWITCH, /// Switch block
FAKE, /// Fake block
SUBST, /// Command substitution scope SUBST, /// Command substitution scope
TOP, /// Outermost block TOP, /// Outermost block
BEGIN, /// Unconditional block BEGIN, /// Unconditional block