jscript: Added RegExp.source implementation.

This commit is contained in:
Piotr Caban 2009-08-14 11:58:44 +02:00 committed by Alexandre Julliard
parent 8d6d266977
commit 6b8fef873c
2 changed files with 26 additions and 2 deletions

View file

@ -3427,8 +3427,24 @@ HRESULT regexp_match(DispatchEx *dispex, const WCHAR *str, DWORD len, BOOL gflag
static HRESULT RegExp_source(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{
FIXME("\n");
return E_NOTIMPL;
TRACE("\n");
switch(flags) {
case DISPATCH_PROPERTYGET: {
RegExpInstance *This = (RegExpInstance*)dispex;
V_VT(retv) = VT_BSTR;
V_BSTR(retv) = SysAllocString(This->str);
if(!V_BSTR(retv))
return E_OUTOFMEMORY;
break;
}
default:
FIXME("Unimplemnted flags %x\n", flags);
return E_NOTIMPL;
}
return S_OK;
}
static HRESULT RegExp_global(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,

View file

@ -208,4 +208,12 @@ ok(r.length === 2, "r.length = " + r.length);
ok(r[0] === "1", "r[0] = " + r[0]);
ok(r[1] === "2", "r[1] = " + r[1]);
var re;
re = /abc[^d]/g;
ok(re.source === "abc[^d]", "re.source = '" + re.source + "', expected 'abc[^d]'");
re = /a\bc[^d]/g;
ok(re.source === "a\\bc[^d]", "re.source = '" + re.source + "', expected 'a\\bc[^d]'");
reportSuccess();