Commit 0eff79ec authored by Jason Millard's avatar Jason Millard Committed by Alexandre Julliard

vbscript: Add support for VT_DISPATCH in Global_TypeName.

parent c1aee64e
......@@ -2450,6 +2450,10 @@ static HRESULT Global_DatePart(BuiltinDisp *This, VARIANT *arg, unsigned args_cn
static HRESULT Global_TypeName(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
{
ITypeInfo *typeinfo;
BSTR name = NULL;
HRESULT hres;
TRACE("(%s)\n", debugstr_variant(arg));
assert(args_cnt == 1);
......@@ -2482,6 +2486,18 @@ static HRESULT Global_TypeName(BuiltinDisp *This, VARIANT *arg, unsigned args_cn
return return_string(res, L"Empty");
case VT_NULL:
return return_string(res, L"Null");
case VT_DISPATCH:
if (SUCCEEDED(IDispatch_GetTypeInfo(V_DISPATCH(arg), 0, GetUserDefaultLCID(), &typeinfo)))
{
hres = ITypeInfo_GetDocumentation(typeinfo, MEMBERID_NIL, &name, NULL, NULL, NULL);
ITypeInfo_Release(typeinfo);
if (SUCCEEDED(hres) && name && *name)
return return_bstr(res, name);
SysFreeString(name);
}
return return_string(res, L"Object");
default:
FIXME("arg %s not supported\n", debugstr_variant(arg));
return E_NOTIMPL;
......
......@@ -1555,6 +1555,10 @@ Call ok(TypeName(True) = "Boolean", "TypeName(True) = " & TypeName(True))
Call ok(getVT(TypeName(True)) = "VT_BSTR", "getVT(TypeName(True)) = " & getVT(TypeName(True)))
Call ok(TypeName(arr) = "Variant()", "TypeName(arr) = " & TypeName(arr))
Call ok(getVT(TypeName(arr)) = "VT_BSTR", "getVT(TypeName(arr)) = " & getVT(TypeName(arr)))
Call ok(TypeName(collectionObj) = "Object", "TypeName(collectionObj) = " & TypeName(collectionObj))
Dim regex
set regex = new RegExp
Call ok(TypeName(regex) = "IRegExp2", "TypeName(regex) = " & TypeName(regex))
Call ok(VarType(Empty) = vbEmpty, "VarType(Empty) = " & VarType(Empty))
Call ok(getVT(VarType(Empty)) = "VT_I2", "getVT(VarType(Empty)) = " & getVT(VarType(Empty)))
......
......@@ -1140,8 +1140,12 @@ static HRESULT WINAPI RegExp2_GetTypeInfo(IRegExp2 *iface,
UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo)
{
RegExp2 *This = impl_from_IRegExp2(iface);
FIXME("(%p)->(%u %lu %p)\n", This, iTInfo, lcid, ppTInfo);
return E_NOTIMPL;
TRACE("(%p)->(%u %lu %p)\n", This, iTInfo, lcid, ppTInfo);
*ppTInfo = typeinfos[RegExp2_tid];
ITypeInfo_AddRef(*ppTInfo);
return S_OK;
}
static HRESULT WINAPI RegExp2_GetIDsOfNames(IRegExp2 *iface, REFIID riid,
......
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