jscript: Properly handle return value evaluation in comma expression.
This commit is contained in:
parent
42d5cc3c6e
commit
10c2a2bba4
|
@ -474,18 +474,15 @@ static HRESULT compile_increment_expression(compiler_ctx_t *ctx, unary_expressio
|
|||
}
|
||||
|
||||
/* ECMA-262 3rd Edition 11.14 */
|
||||
static HRESULT compile_comma_expression(compiler_ctx_t *ctx, binary_expression_t *expr)
|
||||
static HRESULT compile_comma_expression(compiler_ctx_t *ctx, binary_expression_t *expr, BOOL emit_ret)
|
||||
{
|
||||
HRESULT hres;
|
||||
|
||||
hres = compile_expression(ctx, expr->expression1, TRUE);
|
||||
hres = compile_expression(ctx, expr->expression1, FALSE);
|
||||
if(FAILED(hres))
|
||||
return hres;
|
||||
|
||||
if(!push_instr(ctx, OP_pop))
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
return compile_expression(ctx, expr->expression2, TRUE);
|
||||
return compile_expression(ctx, expr->expression2, emit_ret);
|
||||
}
|
||||
|
||||
/* ECMA-262 3rd Edition 11.11 */
|
||||
|
@ -938,8 +935,7 @@ static HRESULT compile_expression(compiler_ctx_t *ctx, expression_t *expr, BOOL
|
|||
case EXPR_CALL:
|
||||
return compile_call_expression(ctx, (call_expression_t*)expr, emit_ret);
|
||||
case EXPR_COMMA:
|
||||
hres = compile_comma_expression(ctx, (binary_expression_t*)expr);
|
||||
break;
|
||||
return compile_comma_expression(ctx, (binary_expression_t*)expr, emit_ret);
|
||||
case EXPR_COND:
|
||||
hres = compile_conditional_expression(ctx, (conditional_expression_t*)expr);
|
||||
break;
|
||||
|
|
|
@ -189,14 +189,19 @@ tmp = eval("1;");
|
|||
ok(tmp === 1, "tmp = " + tmp);
|
||||
tmp = eval("1,2;");
|
||||
ok(tmp === 2, "tmp = " + tmp);
|
||||
tmp = eval("testNoRes(),2;");
|
||||
ok(tmp === 2, "tmp = " + tmp);
|
||||
tmp = eval("if(true) {3}");
|
||||
ok(tmp === 3, "tmp = " + tmp);
|
||||
testNoRes();
|
||||
eval("testRes(); testRes()");
|
||||
tmp = eval("3; if(false) {4;} else {};;;")
|
||||
ok(tmp === 3, "tmp = " + tmp);
|
||||
|
||||
tmp = (function(){ return testRes();})();
|
||||
testNoRes();
|
||||
testRes() && testRes();
|
||||
testNoRes(), testNoRes();
|
||||
|
||||
tmp = (function(){ return testNoRes(), testRes();})();
|
||||
|
||||
var obj1 = new Object();
|
||||
ok(typeof(obj1) === "object", "typeof(obj1) is not object");
|
||||
|
|
|
@ -749,8 +749,10 @@ static HRESULT WINAPI Global_InvokeEx(IDispatchEx *iface, DISPID id, LCID lcid,
|
|||
|
||||
case DISPID_GLOBAL_TESTRES:
|
||||
ok(pvarRes != NULL, "pvarRes = NULL\n");
|
||||
if(pvarRes)
|
||||
V_VT(pvarRes) = VT_NULL;
|
||||
if(pvarRes) {
|
||||
V_VT(pvarRes) = VT_BOOL;
|
||||
V_BOOL(pvarRes) = VARIANT_TRUE;
|
||||
}
|
||||
return S_OK;
|
||||
|
||||
case DISPID_GLOBAL_TESTNORES:
|
||||
|
|
Loading…
Reference in New Issue