mirror of
https://github.com/boostorg/build.git
synced 2026-02-15 13:02:11 +00:00
Fix the result of while.
[SVN r75945]
This commit is contained in:
@@ -2192,6 +2192,8 @@ static void compile_parse( PARSE * parse, compiler * c, int result_location )
|
||||
int nested_result = result_location == RESULT_NONE? RESULT_NONE : RESULT_RETURN;
|
||||
int test = compile_new_label( c );
|
||||
int top = compile_new_label( c );
|
||||
/* Make sure that we return an empty list if the loop runs zero times. */
|
||||
adjust_result( c, RESULT_NONE, nested_result );
|
||||
/* Jump to the loop test */
|
||||
compile_emit_branch( c, INSTR_JUMP, test );
|
||||
compile_set_label( c, top );
|
||||
|
||||
@@ -1166,6 +1166,23 @@ rule test-rule
|
||||
|
||||
check-equal while-result : [ test-rule ] : x ;
|
||||
|
||||
rule test-rule
|
||||
{
|
||||
local value = 1 2 ;
|
||||
while $(value)
|
||||
{
|
||||
value = $(value[2-]) ;
|
||||
local inner = $(value) ;
|
||||
while $(inner)
|
||||
{
|
||||
inner = $(inner[2-]) ;
|
||||
return x ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
check-equal while-result-2 : [ test-rule ] : ;
|
||||
|
||||
}
|
||||
|
||||
#
|
||||
|
||||
Reference in New Issue
Block a user