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
f34722e7
Commit
f34722e7
authored
May 27, 2013
by
Jacek Caban
Committed by
Alexandre Julliard
May 27, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jscript: Added RegExp.toString() implementation.
parent
41fe3558
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
56 additions
and
2 deletions
+56
-2
jsregexp.c
dlls/jscript/jsregexp.c
+44
-2
regexp.js
dlls/jscript/tests/regexp.js
+12
-0
No files found.
dlls/jscript/jsregexp.c
View file @
f34722e7
...
...
@@ -333,8 +333,50 @@ static HRESULT RegExp_lastIndex(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
static
HRESULT
RegExp_toString
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
)
{
FIXME
(
"
\n
"
);
return
E_NOTIMPL
;
RegExpInstance
*
regexp
;
unsigned
len
,
f
;
jsstr_t
*
ret
;
WCHAR
*
ptr
;
TRACE
(
"
\n
"
);
if
(
!
is_vclass
(
jsthis
,
JSCLASS_REGEXP
))
{
FIXME
(
"Not a RegExp
\n
"
);
return
E_NOTIMPL
;
}
regexp
=
regexp_from_vdisp
(
jsthis
);
if
(
!
r
)
return
S_OK
;
len
=
jsstr_length
(
regexp
->
str
)
+
2
;
f
=
regexp
->
jsregexp
->
flags
;
if
(
f
&
REG_FOLD
)
len
++
;
if
(
f
&
REG_GLOB
)
len
++
;
if
(
f
&
REG_MULTILINE
)
len
++
;
ptr
=
jsstr_alloc_buf
(
len
,
&
ret
);
if
(
!
ptr
)
return
E_OUTOFMEMORY
;
*
ptr
++
=
'/'
;
ptr
+=
jsstr_flush
(
regexp
->
str
,
ptr
);
*
ptr
++
=
'/'
;
if
(
f
&
REG_FOLD
)
*
ptr
++
=
'i'
;
if
(
f
&
REG_GLOB
)
*
ptr
++
=
'g'
;
if
(
f
&
REG_MULTILINE
)
*
ptr
++
=
'm'
;
*
r
=
jsval_string
(
ret
);
return
S_OK
;
}
static
HRESULT
create_match_array
(
script_ctx_t
*
ctx
,
jsstr_t
*
input_str
,
...
...
dlls/jscript/tests/regexp.js
View file @
f34722e7
...
...
@@ -648,4 +648,16 @@ ok(!("$10" in RegExp), "RegExp.$10 exists");
RegExp
.
$1
=
"a"
;
ok
(
RegExp
.
$1
===
"b"
,
"RegExp.$1 = "
+
RegExp
.
$1
);
ok
(
/abc/
.
toString
()
===
"/abc/"
,
"/abc/.toString() = "
+
/abc/
.
toString
());
ok
(
/
\/
/
.
toString
()
===
"/
\\
//"
,
"/
\
//.toString() = "
+
/
\/
/
.
toString
());
tmp
=
new
RegExp
(
"abc/"
);
ok
(
tmp
.
toString
()
===
"/abc//"
,
"(new RegExp(
\"
abc/
\"
)).toString() = "
+
tmp
.
toString
());
ok
(
/abc/g
.
toString
()
===
"/abc/g"
,
"/abc/g.toString() = "
+
/abc/g
.
toString
());
ok
(
/abc/i
.
toString
()
===
"/abc/i"
,
"/abc/i.toString() = "
+
/abc/i
.
toString
());
ok
(
/abc/ig
.
toString
()
===
"/abc/ig"
,
"/abc/ig.toString() = "
+
/abc/ig
.
toString
());
ok
(
/abc/mgi
.
toString
()
===
"/abc/igm"
,
"/abc/mgi.toString() = "
+
/abc/mgi
.
toString
());
tmp
=
new
RegExp
(
"abc/"
,
"mgi"
);
ok
(
tmp
.
toString
()
===
"/abc//igm"
,
"(new RegExp(
\"
abc/
\"
)).toString() = "
+
tmp
.
toString
());
ok
(
/abc/
.
toString
(
1
,
false
,
"3"
)
===
"/abc/"
,
"/abc/.toString(1, false,
\"
3
\"
) = "
+
/abc/
.
toString
());
reportSuccess
();
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