diff --git a/dlls/vbscript/parser.y b/dlls/vbscript/parser.y index 2d80c402eae..728bd9299c2 100644 --- a/dlls/vbscript/parser.y +++ b/dlls/vbscript/parser.y @@ -198,7 +198,9 @@ DoType IfStatement : tIF Expression tTHEN tNL StatementsNl ElseIfs_opt Else_opt tEND tIF { $$ = new_if_statement(ctx, $2, $5, $6, $7); CHECK_ERROR; } - /* FIXME: short if statement */ + | tIF Expression tTHEN Statement { $$ = new_if_statement(ctx, $2, $4, NULL, NULL); CHECK_ERROR; } + | tIF Expression tTHEN Statement tELSE Statement + { $$ = new_if_statement(ctx, $2, $4, NULL, $6); CHECK_ERROR; } ElseIfs_opt : /* empty */ { $$ = NULL; } diff --git a/dlls/vbscript/tests/lang.vbs b/dlls/vbscript/tests/lang.vbs index 17c92e56606..029c5ac3963 100644 --- a/dlls/vbscript/tests/lang.vbs +++ b/dlls/vbscript/tests/lang.vbs @@ -164,6 +164,29 @@ Call ok(2^3^2 = 64, "2^3^2 = " & (2^3^2)) Call ok(-3^2 = 9, "-3^2 = " & (-3^2)) Call ok(2*3^2 = 18, "2*3^2 = " & (2*3^2)) +if true then y = true : x = y +ok x, "x is false" + +x = true : if false then x = false +ok x, "x is false, if false called?" + +if not false then x = true +ok x, "x is false, if not false not called?" + +if not false then x = "test" : x = true +ok x, "x is false, if not false not called?" + +if false then x = y : call ok(false, "if false .. : called") + +if false then x = y : call ok(false, "if false .. : called") else x = "else" +Call ok(x = "else", "else not called?") + +if true then x = y else y = x : Call ok(false, "in else?") + +if false then : + +if false then x = y : if true then call ok(false, "embedded if called") + if false then ok false, "if false called" end if