mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-05-29 10:31:14 -03:00
Drop the optional checking of block type for the end builtin
darcs-hash:20061004233206-ac50b-cf72c879b4b58c8e5ba4e1dff5c2746ca2e8844f.gz
This commit is contained in:
31
builtin.c
31
builtin.c
@@ -2759,37 +2759,6 @@ static int builtin_end( wchar_t **argv )
|
||||
variables in the current loop scope won't die between laps.
|
||||
*/
|
||||
int kill_block = 1;
|
||||
wchar_t *type = argv[1];
|
||||
if( type )
|
||||
{
|
||||
int t = parser_get_block_type( type );
|
||||
if( t != current_block->type )
|
||||
{
|
||||
if( t == -1 )
|
||||
{
|
||||
sb_printf( sb_err,
|
||||
BUILTIN_END_BLOCK_UNKNOWN,
|
||||
argv[0],
|
||||
type,
|
||||
parser_get_block_command( current_block->type ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
sb_printf( sb_err,
|
||||
BUILTIN_END_BLOCK_MISMATCH,
|
||||
argv[0],
|
||||
type,
|
||||
parser_get_block_command( current_block->type ) );
|
||||
}
|
||||
|
||||
builtin_print_help( argv[0], sb_err );
|
||||
return 1;
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
switch( current_block->type )
|
||||
{
|
||||
|
||||
53
parser.c
53
parser.c
@@ -3441,59 +3441,6 @@ int parser_test( const wchar_t * buff,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
Try to make sure that arguments passed to 'end'
|
||||
is always the type of block to close
|
||||
*/
|
||||
if( wcscmp( cmd, L"end" ) == 0 )
|
||||
{
|
||||
if( (arg_count == 1) /*&& (count > 0)*/ )
|
||||
{
|
||||
|
||||
int t = parser_get_block_type( tok_last( &tok ) );
|
||||
|
||||
/*
|
||||
This is ugly. We peek at the element
|
||||
past the current element on the
|
||||
block_type stack. It will always contain
|
||||
the type of the block that just went out
|
||||
of scope, which is what we need, but it
|
||||
is not nice coding practice to search
|
||||
through the 'junk pile' like that...
|
||||
*/
|
||||
if( t != block_type[count] )
|
||||
{
|
||||
err=1;
|
||||
if( out )
|
||||
{
|
||||
if( t == -1 )
|
||||
{
|
||||
error( SYNTAX_ERROR,
|
||||
tok_get_pos( &tok ),
|
||||
BUILTIN_END_BLOCK_UNKNOWN,
|
||||
L"end",
|
||||
tok_last( &tok ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
error( SYNTAX_ERROR,
|
||||
tok_get_pos( &tok ),
|
||||
BUILTIN_END_BLOCK_MISMATCH,
|
||||
L"end",
|
||||
tok_last( &tok ),
|
||||
parser_get_block_command( block_type[count-1] ) );
|
||||
}
|
||||
|
||||
print_errors( out, prefix );
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user