Commit 43f6a684 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

vbscript: Added '<>' expression implementation.

parent 324aadd2
......@@ -250,6 +250,8 @@ static HRESULT compile_expression(compile_ctx_t *ctx, expression_t *expr)
return compile_member_expression(ctx, (member_expression_t*)expr, TRUE);
case EXPR_NEG:
return compile_unary_expression(ctx, (unary_expression_t*)expr, OP_neg);
case EXPR_NEQUAL:
return compile_binary_expression(ctx, (binary_expression_t*)expr, OP_nequal);
case EXPR_NOT:
return compile_unary_expression(ctx, (unary_expression_t*)expr, OP_not);
case EXPR_NULL:
......
......@@ -367,6 +367,22 @@ static HRESULT interp_equal(exec_ctx_t *ctx)
return stack_push(ctx, &v);
}
static HRESULT interp_nequal(exec_ctx_t *ctx)
{
VARIANT v;
HRESULT hres;
TRACE("\n");
hres = cmp_oper(ctx);
if(FAILED(hres))
return hres;
V_VT(&v) = VT_BOOL;
V_BOOL(&v) = hres != VARCMP_EQ ? VARIANT_TRUE : VARIANT_FALSE;
return stack_push(ctx, &v);
}
static HRESULT interp_concat(exec_ctx_t *ctx)
{
variant_val_t r, l;
......
......@@ -25,6 +25,7 @@ typedef enum {
EXPR_EQUAL,
EXPR_MEMBER,
EXPR_NEG,
EXPR_NEQUAL,
EXPR_NOT,
EXPR_NULL,
EXPR_STRING,
......
......@@ -139,6 +139,7 @@ NotExpression
EqualityExpression
: ConcatExpression { $$ = $1; }
| EqualityExpression '=' ConcatExpression { $$ = new_binary_expression(ctx, EXPR_EQUAL, $1, $3); CHECK_ERROR; }
| EqualityExpression tNEQ ConcatExpression { $$ = new_binary_expression(ctx, EXPR_NEQUAL, $1, $3); CHECK_ERROR; }
ConcatExpression
: AdditiveExpression { $$ = $1; }
......
......@@ -40,6 +40,11 @@ Call ok(&hffFFffFF& = -1, "&hffFFffFF& <> -1")
Call ok(--1 = 1, "--1 = " & --1)
Call ok(-empty = 0, "-empty = " & (-empty))
Call ok(true <> false, "true <> false is false")
Call ok(not (true <> true), "true <> true is true")
Call ok(not ("x" <> "x"), """x"" <> ""x"" is true")
Call ok(not (empty <> empty), "empty <> empty is true")
Call ok(getVT(false) = "VT_BOOL", "getVT(false) is not VT_BOOL")
Call ok(getVT(true) = "VT_BOOL", "getVT(true) is not VT_BOOL")
Call ok(getVT("") = "VT_BSTR", "getVT("""") is not VT_BSTR")
......
......@@ -98,6 +98,7 @@ typedef enum {
X(icallv, 1, ARG_BSTR, ARG_UINT) \
X(long, 1, ARG_INT, 0) \
X(neg, 1, 0, 0) \
X(nequal, 1, 0, 0) \
X(not, 1, 0, 0) \
X(null, 1, 0, 0) \
X(ret, 0, 0, 0) \
......
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