Commit 5a2b3e0d authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

vbscript: Added support for do..loop statement without an expression.

parent 3fa78601
......@@ -625,6 +625,7 @@ static HRESULT compile_dowhile_statement(compile_ctx_t *ctx, while_statement_t *
{
statement_ctx_t loop_ctx = {0};
unsigned start_addr;
vbsop_t jmp_op;
HRESULT hres;
start_addr = ctx->instr_cnt;
......@@ -636,11 +637,17 @@ static HRESULT compile_dowhile_statement(compile_ctx_t *ctx, while_statement_t *
if(FAILED(hres))
return hres;
hres = compile_expression(ctx, stat->expr);
if(FAILED(hres))
return hres;
if(stat->expr) {
hres = compile_expression(ctx, stat->expr);
if(FAILED(hres))
return hres;
jmp_op = stat->stat.type == STAT_DOUNTIL ? OP_jmp_false : OP_jmp_true;
}else {
jmp_op = OP_jmp;
}
hres = push_instr_addr(ctx, stat->stat.type == STAT_DOUNTIL ? OP_jmp_false : OP_jmp_true, start_addr);
hres = push_instr_addr(ctx, jmp_op, start_addr);
if(FAILED(hres))
return hres;
......
......@@ -185,6 +185,7 @@ SimpleStatement
| tDO tNL StatementsNl_opt tLOOP DoType Expression
{ $$ = new_while_statement(ctx, $5 ? STAT_DOWHILE : STAT_DOUNTIL, $6, $3);
CHECK_ERROR; }
| tDO tNL StatementsNl_opt tLOOP { $$ = new_while_statement(ctx, STAT_DOWHILE, NULL, $3); CHECK_ERROR; }
| FunctionDecl { $$ = new_function_statement(ctx, $1); CHECK_ERROR; }
| tEXIT tDO { $$ = new_statement(ctx, STAT_EXITDO, 0); CHECK_ERROR; }
| tEXIT tFOR { $$ = new_statement(ctx, STAT_EXITFOR, 0); CHECK_ERROR; }
......
......@@ -346,6 +346,13 @@ do until false
loop
x = false
do
if x then exit do
x = true
loop
call ok(x, "x is false after do..loop?")
x = false
y = false
do
if x then
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment