Commit 5a787b3a authored by Piotr Caban's avatar Piotr Caban Committed by Alexandre Julliard

jscript: Added VBArray handling to to_object().

parent 29cdb212
......@@ -243,6 +243,7 @@ HRESULT create_regexp_var(script_ctx_t*,VARIANT*,VARIANT*,jsdisp_t**);
HRESULT create_string(script_ctx_t*,const WCHAR*,DWORD,jsdisp_t**);
HRESULT create_bool(script_ctx_t*,VARIANT_BOOL,jsdisp_t**);
HRESULT create_number(script_ctx_t*,VARIANT*,jsdisp_t**);
HRESULT create_vbarray(script_ctx_t*,SAFEARRAY*,jsdisp_t**);
typedef enum {
NO_HINT,
......
......@@ -633,6 +633,13 @@ HRESULT to_object(script_ctx_t *ctx, VARIANT *v, IDispatch **disp)
*disp = to_disp(dispex);
break;
case VT_ARRAY|VT_VARIANT:
hres = create_vbarray(ctx, V_ARRAY(v), &dispex);
if(FAILED(hres))
return hres;
*disp = to_disp(dispex);
break;
default:
FIXME("unsupported vt %d\n", V_VT(v));
return E_NOTIMPL;
......
......@@ -1901,11 +1901,11 @@ exception_test(function() {new null;}, "TypeError", -2146823281);
exception_test(function() {new nullDisp;}, "TypeError", -2146827850);
exception_test(function() {new VBArray();}, "TypeError", -2146823275);
exception_test(function() {new VBArray(new VBArray(createArray()));}, "TypeError", -2146823275);
exception_test(function() {(new VBArray(createArray())).lbound("aaa");}, "RangeError", -2146828279);
exception_test(function() {(new VBArray(createArray())).lbound(3);}, "RangeError", -2146828279);
exception_test(function() {createArray().lbound("aaa");}, "RangeError", -2146828279);
exception_test(function() {createArray().lbound(3);}, "RangeError", -2146828279);
exception_test(function() {tmp = new Object(); tmp.lb = VBArray.prototype.lbound; tmp.lb();}, "TypeError", -2146823275);
exception_test(function() {tmp = new Object(); tmp.lb = VBArray.prototype.lbound; tmp.lb();}, "TypeError", -2146823275);
exception_test(function() {(new VBArray(createArray())).getItem(3);}, "RangeError", -2146828279);
exception_test(function() {createArray().getItem(3);}, "RangeError", -2146828279);
function testThisExcept(func, number) {
exception_test(function() {func.call(new Object())}, "TypeError", number);
......
......@@ -325,3 +325,18 @@ HRESULT create_vbarray_constr(script_ctx_t *ctx, jsdisp_t *object_prototype, jsd
jsdisp_release(&vbarray->dispex);
return hres;
}
HRESULT create_vbarray(script_ctx_t *ctx, SAFEARRAY *sa, jsdisp_t **ret)
{
VBArrayInstance *vbarray;
HRESULT hres;
hres = alloc_vbarray(ctx, NULL, &vbarray);
if(FAILED(hres))
return hres;
SafeArrayCopy(sa, &vbarray->safearray);
*ret = &vbarray->dispex;
return S_OK;
}
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