Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
c665b86c
Commit
c665b86c
authored
Dec 08, 2009
by
Jacek Caban
Committed by
Alexandre Julliard
Dec 08, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jscript: Moved set_last_index call to do_regexp_match_next.
parent
91d62162
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
10 deletions
+34
-10
regexp.c
dlls/jscript/regexp.c
+8
-8
regexp.js
dlls/jscript/tests/regexp.js
+26
-2
No files found.
dlls/jscript/regexp.c
View file @
c665b86c
...
...
@@ -3301,6 +3301,13 @@ static inline RegExpInstance *regexp_from_vdisp(vdisp_t *vdisp)
return
(
RegExpInstance
*
)
vdisp
->
u
.
jsdisp
;
}
static
void
set_last_index
(
RegExpInstance
*
This
,
DWORD
last_index
)
{
This
->
last_index
=
last_index
;
VariantClear
(
&
This
->
last_index_var
);
num_set_val
(
&
This
->
last_index_var
,
last_index
);
}
static
HRESULT
do_regexp_match_next
(
script_ctx_t
*
ctx
,
RegExpInstance
*
regexp
,
const
WCHAR
*
str
,
DWORD
len
,
const
WCHAR
**
cp
,
match_result_t
**
parens
,
DWORD
*
parens_size
,
DWORD
*
parens_cnt
,
match_result_t
*
ret
)
{
...
...
@@ -3363,6 +3370,7 @@ static HRESULT do_regexp_match_next(script_ctx_t *ctx, RegExpInstance *regexp, c
*
cp
=
result
->
cp
;
ret
->
str
=
result
->
cp
-
matchlen
;
ret
->
len
=
matchlen
;
set_last_index
(
regexp
,
result
->
cp
-
str
);
return
S_OK
;
}
...
...
@@ -3437,13 +3445,6 @@ HRESULT regexp_match(script_ctx_t *ctx, DispatchEx *dispex, const WCHAR *str, DW
return
S_OK
;
}
static
void
set_last_index
(
RegExpInstance
*
This
,
DWORD
last_index
)
{
This
->
last_index
=
last_index
;
VariantClear
(
&
This
->
last_index_var
);
num_set_val
(
&
This
->
last_index_var
,
last_index
);
}
static
HRESULT
RegExp_source
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
DISPPARAMS
*
dp
,
VARIANT
*
retv
,
jsexcept_t
*
ei
,
IServiceProvider
*
sp
)
{
...
...
@@ -3657,7 +3658,6 @@ static HRESULT run_exec(script_ctx_t *ctx, vdisp_t *jsthis, VARIANT *arg, jsexce
}
if
(
hres
==
S_OK
)
{
set_last_index
(
regexp
,
cp
-
string
);
*
ret
=
VARIANT_TRUE
;
}
else
{
set_last_index
(
regexp
,
0
);
...
...
dlls/jscript/tests/regexp.js
View file @
c665b86c
...
...
@@ -96,10 +96,11 @@ ok(m[1] === "test", "m[1] = " + m[1]);
b
=
/a*/
.
test
();
ok
(
b
===
true
,
"/a*/.test() returned "
+
b
);
m
=
"abcabc"
.
match
(
/ca/
);
m
=
"abcabc"
.
match
(
re
=
/ca/
);
ok
(
typeof
(
m
)
===
"object"
,
"typeof m is not object"
);
ok
(
m
.
length
===
1
,
"m.length is not 1"
);
ok
(
m
[
"0"
]
===
"ca"
,
"m[0] is not
\"
ca
\"
"
);
ok
(
re
.
lastIndex
===
4
,
"re.lastIndex = "
+
re
.
lastIndex
);
m
=
"abcabc"
.
match
(
/ab/
);
ok
(
typeof
(
m
)
===
"object"
,
"typeof m is not object"
);
...
...
@@ -165,8 +166,9 @@ ok(m["0"] === "ab", "m[0] is not \"ab\"");
m
=
"abcabc"
.
match
();
ok
(
m
===
null
,
"m is not null"
);
r
=
"- [test] -"
.
replace
(
/
\[([^\[]
+
)\]
/g
,
"success"
);
r
=
"- [test] -"
.
replace
(
re
=
/
\[([^\[]
+
)\]
/g
,
"success"
);
ok
(
r
===
"- success -"
,
"r = "
+
r
+
" expected '- success -'"
);
ok
(
re
.
lastIndex
===
8
,
"re.lastIndex = "
+
re
.
lastIndex
);
r
=
"[test] [test]"
.
replace
(
/
\[([^\[]
+
)\]
/g
,
"aa"
);
ok
(
r
===
"aa aa"
,
"r = "
+
r
+
"aa aa"
);
...
...
@@ -285,6 +287,28 @@ ok(r.length === 2, "r.length = " + r.length);
ok
(
r
[
0
]
===
"1"
,
"r[0] = "
+
r
[
0
]);
ok
(
r
[
1
]
===
"2"
,
"r[1] = "
+
r
[
1
]);
re
=
/,+/
;
r
=
"1,,2,"
.
split
(
re
);
ok
(
r
.
length
===
2
,
"r.length = "
+
r
.
length
);
ok
(
r
[
0
]
===
"1"
,
"r[0] = "
+
r
[
0
]);
ok
(
r
[
1
]
===
"2"
,
"r[1] = "
+
r
[
1
]);
ok
(
re
.
lastIndex
===
5
,
"re.lastIndex = "
+
re
.
lastIndex
);
re
=
/,+/g
;
r
=
"1,,2,"
.
split
(
re
);
ok
(
r
.
length
===
2
,
"r.length = "
+
r
.
length
);
ok
(
r
[
0
]
===
"1"
,
"r[0] = "
+
r
[
0
]);
ok
(
r
[
1
]
===
"2"
,
"r[1] = "
+
r
[
1
]);
ok
(
re
.
lastIndex
===
5
,
"re.lastIndex = "
+
re
.
lastIndex
);
re
=
/,+/
;
re
.
lastIndex
=
4
;
r
=
"1,,2,"
.
split
(
re
);
ok
(
r
.
length
===
2
,
"r.length = "
+
r
.
length
);
ok
(
r
[
0
]
===
"1"
,
"r[0] = "
+
r
[
0
]);
ok
(
r
[
1
]
===
"2"
,
"r[1] = "
+
r
[
1
]);
ok
(
re
.
lastIndex
===
5
,
"re.lastIndex = "
+
re
.
lastIndex
);
re
=
/abc
[^
d
]
/g
;
ok
(
re
.
source
===
"abc[^d]"
,
"re.source = '"
+
re
.
source
+
"', expected 'abc[^d]'"
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment