Drop the optional checking of block type for the end builtin

darcs-hash:20061004233206-ac50b-cf72c879b4b58c8e5ba4e1dff5c2746ca2e8844f.gz
This commit is contained in:
axel
2006-10-05 09:32:06 +10:00
parent d1078f8582
commit 873fd83307
2 changed files with 0 additions and 84 deletions

View File

@@ -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 )
{

View File

@@ -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;