jscript: Return array length in Array.unshift for invoke version >= 2.
This commit is contained in:
parent
a1ac9d661f
commit
96cbc45a52
|
@ -967,29 +967,25 @@ static HRESULT Array_unshift(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, DISP
|
||||||
return hres;
|
return hres;
|
||||||
|
|
||||||
argc = arg_cnt(dp);
|
argc = arg_cnt(dp);
|
||||||
if(!argc) {
|
if(argc) {
|
||||||
if(retv)
|
buf_end = buf + sizeof(buf)/sizeof(WCHAR)-1;
|
||||||
V_VT(retv) = VT_EMPTY;
|
*buf_end-- = 0;
|
||||||
return S_OK;
|
i = length;
|
||||||
}
|
|
||||||
|
|
||||||
buf_end = buf + sizeof(buf)/sizeof(WCHAR)-1;
|
while(i--) {
|
||||||
*buf_end-- = 0;
|
str = idx_to_str(i, buf_end);
|
||||||
i = length;
|
|
||||||
|
|
||||||
while(i--) {
|
hres = jsdisp_get_id(jsthis, str, 0, &id);
|
||||||
str = idx_to_str(i, buf_end);
|
if(SUCCEEDED(hres)) {
|
||||||
|
hres = jsdisp_propget(jsthis, id, &var, ei, caller);
|
||||||
|
if(FAILED(hres))
|
||||||
|
return hres;
|
||||||
|
|
||||||
hres = jsdisp_get_id(jsthis, str, 0, &id);
|
hres = jsdisp_propput_idx(jsthis, i+argc, &var, ei, caller);
|
||||||
if(SUCCEEDED(hres)) {
|
VariantClear(&var);
|
||||||
hres = jsdisp_propget(jsthis, id, &var, ei, caller);
|
}else if(hres == DISP_E_UNKNOWNNAME) {
|
||||||
if(FAILED(hres))
|
hres = IDispatchEx_DeleteMemberByDispID(vthis->u.dispex, id);
|
||||||
return hres;
|
}
|
||||||
|
|
||||||
hres = jsdisp_propput_idx(jsthis, i+argc, &var, ei, caller);
|
|
||||||
VariantClear(&var);
|
|
||||||
}else if(hres == DISP_E_UNKNOWNNAME) {
|
|
||||||
hres = IDispatchEx_DeleteMemberByDispID(vthis->u.dispex, id);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(FAILED(hres))
|
if(FAILED(hres))
|
||||||
|
@ -1002,12 +998,21 @@ static HRESULT Array_unshift(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, DISP
|
||||||
return hres;
|
return hres;
|
||||||
}
|
}
|
||||||
|
|
||||||
hres = set_length(jsthis, ei, length+argc);
|
if(argc) {
|
||||||
if(FAILED(hres))
|
length += argc;
|
||||||
return hres;
|
hres = set_length(jsthis, ei, length);
|
||||||
|
if(FAILED(hres))
|
||||||
|
return hres;
|
||||||
|
}
|
||||||
|
|
||||||
if(retv)
|
if(retv) {
|
||||||
V_VT(retv) = VT_EMPTY;
|
if(ctx->version < 2) {
|
||||||
|
V_VT(retv) = VT_EMPTY;
|
||||||
|
}else {
|
||||||
|
V_VT(retv) = VT_I4;
|
||||||
|
V_I4(retv) = length;
|
||||||
|
}
|
||||||
|
}
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue