Commit 0b939338 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

jscript: Added RegExp.lastIndex implementation.

parent a0d262c5
...@@ -82,6 +82,7 @@ typedef struct { ...@@ -82,6 +82,7 @@ typedef struct {
JSRegExp *jsregexp; JSRegExp *jsregexp;
BSTR str; BSTR str;
DWORD last_index;
} RegExpInstance; } RegExpInstance;
static const WCHAR sourceW[] = {'s','o','u','r','c','e',0}; static const WCHAR sourceW[] = {'s','o','u','r','c','e',0};
...@@ -3471,8 +3472,21 @@ static HRESULT RegExp_multiline(DispatchEx *dispex, LCID lcid, WORD flags, DISPP ...@@ -3471,8 +3472,21 @@ static HRESULT RegExp_multiline(DispatchEx *dispex, LCID lcid, WORD flags, DISPP
static HRESULT RegExp_lastIndex(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp, static HRESULT RegExp_lastIndex(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp) VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{ {
FIXME("\n"); TRACE("\n");
return E_NOTIMPL;
switch(flags) {
case DISPATCH_PROPERTYGET: {
RegExpInstance *regexp = (RegExpInstance*)dispex;
V_VT(retv) = VT_I4;
V_I4(retv) = regexp->last_index;
break;
}
default:
FIXME("unimplemented flags: %x\n", flags);
return E_NOTIMPL;
}
return S_OK;
} }
static HRESULT RegExp_toString(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp, static HRESULT RegExp_toString(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
......
...@@ -17,7 +17,10 @@ ...@@ -17,7 +17,10 @@
*/ */
var m; var m, re;
re = /a+/;
ok(re.lastIndex === 0, "re.lastIndex = " + re.lastIndex);
m = "abcabc".match(/ca/); m = "abcabc".match(/ca/);
ok(typeof(m) === "object", "typeof m is not object"); ok(typeof(m) === "object", "typeof m is not object");
...@@ -208,8 +211,6 @@ ok(r.length === 2, "r.length = " + r.length); ...@@ -208,8 +211,6 @@ ok(r.length === 2, "r.length = " + r.length);
ok(r[0] === "1", "r[0] = " + r[0]); ok(r[0] === "1", "r[0] = " + r[0]);
ok(r[1] === "2", "r[1] = " + r[1]); ok(r[1] === "2", "r[1] = " + r[1]);
var re;
re = /abc[^d]/g; re = /abc[^d]/g;
ok(re.source === "abc[^d]", "re.source = '" + re.source + "', expected 'abc[^d]'"); ok(re.source === "abc[^d]", "re.source = '" + re.source + "', expected 'abc[^d]'");
......
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