Commit d090c394 authored by Francois Gouget's avatar Francois Gouget Committed by Alexandre Julliard

vbscript: Add support for integer values in conditional jumps.

parent f0d30968
......@@ -350,6 +350,34 @@ static inline void release_val(variant_val_t *v)
VariantClear(v->v);
}
static int stack_pop_bool(exec_ctx_t *ctx, BOOL *b)
{
variant_val_t val;
HRESULT hres;
hres = stack_pop_val(ctx, &val);
if(FAILED(hres))
return hres;
switch (V_VT(val.v))
{
case VT_BOOL:
*b = V_BOOL(val.v);
break;
case VT_I2:
*b = V_I2(val.v);
break;
case VT_I4:
*b = V_I4(val.v);
break;
default:
FIXME("unsupported for %s\n", debugstr_variant(val.v));
release_val(&val);
return E_NOTIMPL;
}
return S_OK;
}
static HRESULT stack_pop_disp(exec_ctx_t *ctx, IDispatch **ret)
{
VARIANT *v = stack_pop(ctx);
......@@ -886,22 +914,16 @@ static HRESULT interp_jmp(exec_ctx_t *ctx)
static HRESULT interp_jmp_false(exec_ctx_t *ctx)
{
const unsigned arg = ctx->instr->arg1.uint;
variant_val_t val;
HRESULT hres;
BOOL b;
TRACE("%u\n", arg);
hres = stack_pop_val(ctx, &val);
hres = stack_pop_bool(ctx, &b);
if(FAILED(hres))
return hres;
if(V_VT(val.v) != VT_BOOL) {
FIXME("unsupported for %s\n", debugstr_variant(val.v));
release_val(&val);
return E_NOTIMPL;
}
if(V_BOOL(val.v))
if(b)
ctx->instr++;
else
instr_jmp(ctx, ctx->instr->arg1.uint);
......@@ -911,22 +933,16 @@ static HRESULT interp_jmp_false(exec_ctx_t *ctx)
static HRESULT interp_jmp_true(exec_ctx_t *ctx)
{
const unsigned arg = ctx->instr->arg1.uint;
variant_val_t val;
HRESULT hres;
BOOL b;
TRACE("%u\n", arg);
hres = stack_pop_val(ctx, &val);
hres = stack_pop_bool(ctx, &b);
if(FAILED(hres))
return hres;
if(V_VT(val.v) != VT_BOOL) {
FIXME("unsupported for %s\n", debugstr_variant(val.v));
release_val(&val);
return E_NOTIMPL;
}
if(V_BOOL(val.v))
if(b)
instr_jmp(ctx, ctx->instr->arg1.uint);
else
ctx->instr++;
......
......@@ -260,6 +260,14 @@ End If
Call ok(x, "elseif not called?")
x = false
if 1 then x = true
Call ok(x, "if 1 not run?")
x = false
if &h10000& then x = true
Call ok(x, "if &h10000& not run?")
x = false
y = false
while not (x and y)
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