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