Commit 0841b60b authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

jscript: Inline add_eval implementation.

parent ea9b5073
......@@ -1734,21 +1734,27 @@ static HRESULT interp_in(script_ctx_t *ctx)
}
/* ECMA-262 3rd Edition 11.6.1 */
static HRESULT add_eval(script_ctx_t *ctx, jsval_t lval, jsval_t rval, jsval_t *ret)
static HRESULT interp_add(script_ctx_t *ctx)
{
jsval_t r, l;
jsval_t l, r, lval, rval, ret;
HRESULT hres;
rval = stack_pop(ctx);
lval = stack_pop(ctx);
TRACE("%s + %s\n", debugstr_jsval(lval), debugstr_jsval(rval));
hres = to_primitive(ctx, lval, &l, NO_HINT);
if(SUCCEEDED(hres)) {
hres = to_primitive(ctx, rval, &r, NO_HINT);
if(FAILED(hres))
jsval_release(l);
}
jsval_release(lval);
jsval_release(rval);
if(FAILED(hres))
return hres;
hres = to_primitive(ctx, rval, &r, NO_HINT);
if(FAILED(hres)) {
jsval_release(l);
return hres;
}
if(is_string(l) || is_string(r)) {
jsstr_t *lstr, *rstr = NULL;
......@@ -1761,7 +1767,7 @@ static HRESULT add_eval(script_ctx_t *ctx, jsval_t lval, jsval_t rval, jsval_t *
ret_str = jsstr_concat(lstr, rstr);
if(ret_str)
*ret = jsval_string(ret_str);
ret = jsval_string(ret_str);
else
hres = E_OUTOFMEMORY;
}
......@@ -1776,29 +1782,12 @@ static HRESULT add_eval(script_ctx_t *ctx, jsval_t lval, jsval_t rval, jsval_t *
if(SUCCEEDED(hres)) {
hres = to_number(ctx, r, &nr);
if(SUCCEEDED(hres))
*ret = jsval_number(nl+nr);
ret = jsval_number(nl+nr);
}
}
jsval_release(r);
jsval_release(l);
return hres;
}
/* ECMA-262 3rd Edition 11.6.1 */
static HRESULT interp_add(script_ctx_t *ctx)
{
jsval_t l, r, ret;
HRESULT hres;
r = stack_pop(ctx);
l = stack_pop(ctx);
TRACE("%s + %s\n", debugstr_jsval(l), debugstr_jsval(r));
hres = add_eval(ctx, l, r, &ret);
jsval_release(l);
jsval_release(r);
if(FAILED(hres))
return hres;
......
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