jscript: Added '^' expression implementation.

This commit is contained in:
Jacek Caban 2008-09-17 23:32:11 +02:00 committed by Alexandre Julliard
parent b8aeb15cb5
commit 7202197dfa
2 changed files with 30 additions and 3 deletions

View File

@ -1513,10 +1513,33 @@ HRESULT binary_or_expression_eval(exec_ctx_t *ctx, expression_t *_expr, DWORD fl
return binary_expr_eval(ctx, expr, bitor_eval, ei, ret);
}
HRESULT binary_xor_expression_eval(exec_ctx_t *ctx, expression_t *expr, DWORD flags, jsexcept_t *ei, exprval_t *ret)
/* ECMA-262 3rd Edition 11.10 */
static HRESULT xor_eval(exec_ctx_t *ctx, VARIANT *lval, VARIANT *rval, jsexcept_t *ei, VARIANT *retv)
{
FIXME("\n");
return E_NOTIMPL;
INT li, ri;
HRESULT hres;
hres = to_int32(ctx->parser->script, lval, ei, &li);
if(FAILED(hres))
return hres;
hres = to_int32(ctx->parser->script, rval, ei, &ri);
if(FAILED(hres))
return hres;
V_VT(retv) = VT_I4;
V_I4(retv) = li^ri;
return S_OK;
}
/* ECMA-262 3rd Edition 11.10 */
HRESULT binary_xor_expression_eval(exec_ctx_t *ctx, expression_t *_expr, DWORD flags, jsexcept_t *ei, exprval_t *ret)
{
binary_expression_t *expr = (binary_expression_t*)_expr;
TRACE("\n");
return binary_expr_eval(ctx, expr, xor_eval, ei, ret);
}
/* ECMA-262 3rd Edition 11.10 */

View File

@ -293,6 +293,10 @@ tmp = 10;
ok((tmp &= 8) === 8, "tmp(10) &= 8 !== 8");
ok(getVT(tmp) === "VT_I4", "getVT(tmp &= 8) = " + getVT(tmp));
tmp = 0xf0f0^0xff00;
ok(tmp === 0x0ff0, "0xf0f0^0xff00 !== 0x0ff0");
ok(getVT(tmp) === "VT_I4", "getVT(0xf0f0^0xff00) = " + getVT(tmp));
ok(1 < 3.4, "1 < 3.4 failed");
ok(!(3.4 < 1), "3.4 < 1");
ok("abc" < "abcd", "abc < abcd failed");