jscript: Added '>>>' expression implementation.

This commit is contained in:
Jacek Caban 2008-09-19 00:44:49 +02:00 committed by Alexandre Julliard
parent 74fefe94eb
commit 13790a640b
2 changed files with 31 additions and 2 deletions

View File

@ -2807,10 +2807,33 @@ HRESULT right_shift_expression_eval(exec_ctx_t *ctx, expression_t *_expr, DWORD
return binary_expr_eval(ctx, expr, rshift_eval, ei, ret);
}
/* ECMA-262 3rd Edition 11.7.3 */
static HRESULT rshift2_eval(exec_ctx_t *ctx, VARIANT *lval, VARIANT *rval, jsexcept_t *ei, VARIANT *retv)
{
DWORD li, ri;
HRESULT hres;
hres = to_uint32(ctx->parser->script, lval, ei, &li);
if(FAILED(hres))
return hres;
hres = to_uint32(ctx->parser->script, rval, ei, &ri);
if(FAILED(hres))
return hres;
V_VT(retv) = VT_I4;
V_I4(retv) = li >> (ri&0x1f);
return S_OK;
}
/* ECMA-262 3rd Edition 11.7.3 */
HRESULT right2_shift_expression_eval(exec_ctx_t *ctx, expression_t *_expr, DWORD flags, jsexcept_t *ei, exprval_t *ret)
{
FIXME("\n");
return E_NOTIMPL;
binary_expression_t *expr = (binary_expression_t*)_expr;
TRACE("\n");
return binary_expr_eval(ctx, expr, rshift2_eval, ei, ret);
}
/* ECMA-262 3rd Edition 11.13.1 */

View File

@ -301,6 +301,12 @@ ok(tmp === 2, "8 >> 2 = " + tmp);
tmp = -64 >> 4;
ok(tmp === -4, "-64 >> 4 = " + tmp);
tmp = 8 >>> 2;
ok(tmp === 2, "8 >> 2 = " + tmp);
tmp = -64 >>> 4;
ok(tmp === 0x0ffffffc, "-64 >>> 4 = " + tmp);
tmp = 10;
ok((tmp &= 8) === 8, "tmp(10) &= 8 !== 8");
ok(getVT(tmp) === "VT_I4", "getVT(tmp &= 8) = " + getVT(tmp));