mirror of
https://github.com/reactos/wine.git
synced 2024-11-29 06:30:37 +00:00
jscript: Added object initialiser expression implementation.
This commit is contained in:
parent
1edd64ef8b
commit
e7786d1d45
@ -1050,10 +1050,57 @@ HRESULT array_literal_expression_eval(exec_ctx_t *ctx, expression_t *expr, DWORD
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
HRESULT property_value_expression_eval(exec_ctx_t *ctx, expression_t *expr, DWORD flags, jsexcept_t *ei, exprval_t *ret)
|
||||
/* ECMA-262 3rd Edition 11.1.5 */
|
||||
HRESULT property_value_expression_eval(exec_ctx_t *ctx, expression_t *_expr, DWORD flags, jsexcept_t *ei, exprval_t *ret)
|
||||
{
|
||||
FIXME("\n");
|
||||
return E_NOTIMPL;
|
||||
property_value_expression_t *expr = (property_value_expression_t*)_expr;
|
||||
VARIANT val, tmp;
|
||||
DispatchEx *obj;
|
||||
prop_val_t *iter;
|
||||
exprval_t exprval;
|
||||
BSTR name;
|
||||
HRESULT hres;
|
||||
|
||||
TRACE("\n");
|
||||
|
||||
hres = create_object(ctx->parser->script, NULL, &obj);
|
||||
if(FAILED(hres))
|
||||
return hres;
|
||||
|
||||
for(iter = expr->property_list; iter; iter = iter->next) {
|
||||
hres = literal_to_var(iter->name, &tmp);
|
||||
if(FAILED(hres))
|
||||
break;
|
||||
|
||||
hres = to_string(ctx->parser->script, &tmp, ei, &name);
|
||||
VariantClear(&tmp);
|
||||
if(FAILED(hres))
|
||||
break;
|
||||
|
||||
hres = expr_eval(ctx, iter->value, 0, ei, &exprval);
|
||||
if(SUCCEEDED(hres)) {
|
||||
hres = exprval_to_value(ctx->parser->script, &exprval, ei, &val);
|
||||
exprval_release(&exprval);
|
||||
if(SUCCEEDED(hres)) {
|
||||
hres = jsdisp_propput_name(obj, name, ctx->parser->script->lcid, &val, ei, NULL/*FIXME*/);
|
||||
VariantClear(&val);
|
||||
}
|
||||
}
|
||||
|
||||
SysFreeString(name);
|
||||
if(FAILED(hres))
|
||||
break;
|
||||
}
|
||||
|
||||
if(FAILED(hres)) {
|
||||
jsdisp_release(obj);
|
||||
return hres;
|
||||
}
|
||||
|
||||
ret->type = EXPRVAL_VARIANT;
|
||||
V_VT(&ret->u.var) = VT_DISPATCH;
|
||||
V_DISPATCH(&ret->u.var) = (IDispatch*)_IDispatchEx_(obj);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT comma_expression_eval(exec_ctx_t *ctx, expression_t *expr, DWORD flags, jsexcept_t *ei, exprval_t *ret)
|
||||
|
@ -140,4 +140,8 @@ if(true)
|
||||
tmp = 1;
|
||||
ok(tmp === 1, "tmp !== 1, if(true) not evaluated?");
|
||||
|
||||
var obj3 = { prop1: 1, prop2: typeof(false) };
|
||||
ok(obj3.prop1 === 1, "obj3.prop1 is not 1");
|
||||
ok(obj3.prop2 === "boolean", "obj3.prop2 is not \"boolean\"");
|
||||
|
||||
reportSuccess();
|
||||
|
Loading…
Reference in New Issue
Block a user