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
4778c069
Commit
4778c069
authored
Sep 19, 2008
by
Jacek Caban
Committed by
Alexandre Julliard
Sep 19, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jscript: Added more to_string implementation.
parent
34356035
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
1 deletion
+29
-1
jsutils.c
dlls/jscript/jsutils.c
+25
-1
lang.js
dlls/jscript/tests/lang.js
+4
-0
No files found.
dlls/jscript/jsutils.c
View file @
4778c069
...
...
@@ -320,15 +320,39 @@ static BSTR int_to_bstr(INT i)
/* ECMA-262 3rd Edition 9.8 */
HRESULT
to_string
(
script_ctx_t
*
ctx
,
VARIANT
*
v
,
jsexcept_t
*
ei
,
BSTR
*
str
)
{
const
WCHAR
undefinedW
[]
=
{
'u'
,
'n'
,
'd'
,
'e'
,
'f'
,
'i'
,
'n'
,
'e'
,
'd'
,
0
};
const
WCHAR
nullW
[]
=
{
'n'
,
'u'
,
'l'
,
'l'
,
0
};
const
WCHAR
trueW
[]
=
{
't'
,
'r'
,
'u'
,
'e'
,
0
};
const
WCHAR
falseW
[]
=
{
'f'
,
'a'
,
'l'
,
's'
,
'e'
,
0
};
switch
(
V_VT
(
v
))
{
case
VT_EMPTY
:
*
str
=
SysAllocString
(
undefinedW
);
break
;
case
VT_NULL
:
*
str
=
SysAllocString
(
nullW
);
break
;
case
VT_I4
:
*
str
=
int_to_bstr
(
V_I4
(
v
));
break
;
case
VT_BSTR
:
*
str
=
SysAllocString
(
V_BSTR
(
v
));
break
;
case
VT_DISPATCH
:
{
VARIANT
prim
;
HRESULT
hres
;
hres
=
to_primitive
(
ctx
,
v
,
ei
,
&
prim
);
if
(
FAILED
(
hres
))
return
hres
;
hres
=
to_string
(
ctx
,
&
prim
,
ei
,
str
);
VariantClear
(
&
prim
);
return
hres
;
}
case
VT_BOOL
:
*
str
=
SysAllocString
(
V_BOOL
(
v
)
?
trueW
:
falseW
);
break
;
default:
FIXME
(
"unsupported vt %d
\n
"
,
V_VT
(
v
));
return
E_NOTIMPL
;
...
...
dlls/jscript/tests/lang.js
View file @
4778c069
...
...
@@ -342,6 +342,10 @@ ok(+null === 0, "+null !== 0");
ok
(
""
+
0
===
"0"
,
"
\"\"
+ 0 !==
\"
0
\"
"
);
ok
(
""
+
123
===
"123"
,
"
\"\"
+ 123 !==
\"
123
\"
"
);
ok
(
""
+
(
-
5
)
===
"-5"
,
"
\"\"
+ (-5) !==
\"
-5
\"
"
);
ok
(
""
+
null
===
"null"
,
"
\"\"
+ null !==
\"
null
\"
"
);
ok
(
""
+
undefined
===
"undefined"
,
"
\"\"
+ undefined !==
\"
undefined
\"
"
);
ok
(
""
+
true
===
"true"
,
"
\"\"
+ true !==
\"
true
\"
"
);
ok
(
""
+
false
===
"false"
,
"
\"\"
+ false !==
\"
false
\"
"
);
ok
(
1
<
3.4
,
"1 < 3.4 failed"
);
ok
(
!
(
3.4
<
1
),
"3.4 < 1"
);
...
...
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