vbscript: Added '<>' expression implementation.

This commit is contained in:
Jacek Caban 2011-09-12 12:32:27 +02:00 committed by Alexandre Julliard
parent 324aadd2a9
commit 43f6a6842a
6 changed files with 26 additions and 0 deletions

View file

@ -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:

View file

@ -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;

View file

@ -25,6 +25,7 @@ typedef enum {
EXPR_EQUAL,
EXPR_MEMBER,
EXPR_NEG,
EXPR_NEQUAL,
EXPR_NOT,
EXPR_NULL,
EXPR_STRING,

View file

@ -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; }

View file

@ -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")

View file

@ -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) \