diff options
author | ridiculousfish <corydoras@ridiculousfish.com> | 2012-09-01 12:29:00 -0700 |
---|---|---|
committer | ridiculousfish <corydoras@ridiculousfish.com> | 2012-09-01 12:29:00 -0700 |
commit | ff124465fdfe39096ad14226a6c8aaa08d17bc7f (patch) | |
tree | 54ed0d09a3b7b5cc4da6b112500037a3c2b4243e /builtin.cpp | |
parent | de5223db66ba36001020f7b3c2acda4303b927b3 (diff) |
Clean up some warnings and some unused if-related code
Diffstat (limited to 'builtin.cpp')
-rw-r--r-- | builtin.cpp | 42 |
1 files changed, 2 insertions, 40 deletions
diff --git a/builtin.cpp b/builtin.cpp index 19c7e412..8c347111 100644 --- a/builtin.cpp +++ b/builtin.cpp @@ -3380,7 +3380,7 @@ static int builtin_else( parser_t &parser, wchar_t **argv ) { if_block = static_cast<if_block_t *>(parser.current_block); /* Ensure that we're past IF but not up to an ELSE */ - if (if_block->if_expr_evaluated && ! if_block->has_reached_else()) + if (if_block->if_expr_evaluated && ! if_block->else_evaluated) { block_ok = true; } @@ -3399,7 +3399,7 @@ static int builtin_else( parser_t &parser, wchar_t **argv ) /* Run the else block if the IF expression was false and so were all the ELSEIF expressions (if any) */ bool run_else = ! if_block->any_branch_taken; if_block->skip = ! run_else; - if_block->if_state = if_block_t::if_state_else; + if_block->else_evaluated = true; env_pop(); env_push(0); } @@ -3410,44 +3410,6 @@ static int builtin_else( parser_t &parser, wchar_t **argv ) return proc_get_last_status(); } -static int builtin_elseif( parser_t &parser, wchar_t **argv ) -{ - puts("BULITIN ELSEIF"); - bool block_ok = false; - if_block_t *if_block = NULL; - if (parser.current_block != NULL && parser.current_block->type() == IF) - { - if_block = static_cast<if_block_t *>(parser.current_block); - /* Make sure that we're past IF, but not up to an ELSE */ - if (if_block->if_expr_evaluated && ! if_block->has_reached_else()) - { - block_ok = true; - } - } - - if( ! block_ok ) - { - append_format(stderr_buffer, - _( L"%ls: Not inside of 'if' block\n" ), - argv[0] ); - builtin_print_help( parser, argv[0], stderr_buffer ); - return STATUS_BUILTIN_ERROR; - } - else - { - /* Run this elseif if the IF expression was false, and so were all ELSEIF expressions thus far. */ - bool run_elseif = ! if_block->any_branch_taken; - if_block->skip = ! run_elseif; - env_pop(); - env_push(0); - } - - /* - If everything goes ok, return status of last command to execute. - */ - return proc_get_last_status(); -} - /** This function handles both the 'continue' and the 'break' builtins that are used for loop control. |