jscript: Added String default value implementation.

This commit is contained in:
Jacek Caban 2008-09-21 15:43:50 +02:00 committed by Alexandre Julliard
parent 3925f13023
commit 1f134b41b3
2 changed files with 23 additions and 2 deletions

View File

@ -638,8 +638,26 @@ static HRESULT String_isPrototypeOf(DispatchEx *dispex, LCID lcid, WORD flags, D
static HRESULT String_value(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{
FIXME("\n");
return E_NOTIMPL;
StringInstance *This = (StringInstance*)dispex;
TRACE("\n");
switch(flags) {
case DISPATCH_PROPERTYGET: {
BSTR str = SysAllocString(This->str);
if(!str)
return E_OUTOFMEMORY;
V_VT(retv) = VT_BSTR;
V_BSTR(retv) = str;
break;
}
default:
FIXME("flags %x\n", flags);
return E_NOTIMPL;
}
return S_OK;
}
static void String_destructor(DispatchEx *dispex)

View File

@ -66,6 +66,9 @@ ok(str.toString() === "", "str.toString() = " + str.toString());
var str = new String("test", "abc");
ok(str.toString() === "test", "str.toString() = " + str.toString());
tmp = "value " + str;
ok(tmp === "value test", "'value ' + str = " + tmp);
tmp = "abc".charAt(0);
ok(tmp === "a", "'abc',charAt(0) = " + tmp);
tmp = "abc".charAt(1);