Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
d6998348
Commit
d6998348
authored
Sep 17, 2008
by
Jacek Caban
Committed by
Alexandre Julliard
Sep 18, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jscript: Added '==' expression implementation.
parent
8e7dad93
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
128 additions
and
3 deletions
+128
-3
engine.c
dlls/jscript/engine.c
+116
-3
lang.js
dlls/jscript/tests/lang.js
+12
-0
No files found.
dlls/jscript/engine.c
View file @
d6998348
...
...
@@ -1853,10 +1853,123 @@ HRESULT new_expression_eval(exec_ctx_t *ctx, expression_t *expr, DWORD flags, js
return
E_NOTIMPL
;
}
HRESULT
equal_expression_eval
(
exec_ctx_t
*
ctx
,
expression_t
*
expr
,
DWORD
flags
,
jsexcept_t
*
ei
,
exprval_t
*
ret
)
/* ECMA-262 3rd Edition 11.9.3 */
static
HRESULT
equal_values
(
exec_ctx_t
*
ctx
,
VARIANT
*
lval
,
VARIANT
*
rval
,
jsexcept_t
*
ei
,
BOOL
*
ret
)
{
FIXME
(
"
\n
"
);
return
E_NOTIMPL
;
if
(
V_VT
(
lval
)
==
V_VT
(
rval
)
||
(
is_num_vt
(
V_VT
(
lval
))
&&
is_num_vt
(
V_VT
(
rval
))))
return
equal2_values
(
lval
,
rval
,
ret
);
/* FIXME: NULL disps should be handled in more general way */
if
(
V_VT
(
lval
)
==
VT_DISPATCH
&&
!
V_DISPATCH
(
lval
))
{
VARIANT
v
;
V_VT
(
&
v
)
=
VT_NULL
;
return
equal_values
(
ctx
,
&
v
,
rval
,
ei
,
ret
);
}
if
(
V_VT
(
rval
)
==
VT_DISPATCH
&&
!
V_DISPATCH
(
rval
))
{
VARIANT
v
;
V_VT
(
&
v
)
=
VT_NULL
;
return
equal_values
(
ctx
,
lval
,
&
v
,
ei
,
ret
);
}
if
((
V_VT
(
lval
)
==
VT_NULL
&&
V_VT
(
rval
)
==
VT_EMPTY
)
||
(
V_VT
(
lval
)
==
VT_EMPTY
&&
V_VT
(
rval
)
==
VT_NULL
))
{
*
ret
=
TRUE
;
return
S_OK
;
}
if
(
V_VT
(
lval
)
==
VT_BSTR
&&
is_num_vt
(
V_VT
(
rval
)))
{
VARIANT
v
;
HRESULT
hres
;
hres
=
to_number
(
ctx
->
parser
->
script
,
lval
,
ei
,
&
v
);
if
(
FAILED
(
hres
))
return
hres
;
return
equal_values
(
ctx
,
&
v
,
rval
,
ei
,
ret
);
}
if
(
V_VT
(
rval
)
==
VT_BSTR
&&
is_num_vt
(
V_VT
(
lval
)))
{
VARIANT
v
;
HRESULT
hres
;
hres
=
to_number
(
ctx
->
parser
->
script
,
rval
,
ei
,
&
v
);
if
(
FAILED
(
hres
))
return
hres
;
return
equal_values
(
ctx
,
lval
,
&
v
,
ei
,
ret
);
}
if
(
V_VT
(
rval
)
==
VT_BOOL
)
{
VARIANT
v
;
V_VT
(
&
v
)
=
VT_I4
;
V_I4
(
&
v
)
=
V_BOOL
(
rval
)
?
1
:
0
;
return
equal_values
(
ctx
,
lval
,
&
v
,
ei
,
ret
);
}
if
(
V_VT
(
lval
)
==
VT_BOOL
)
{
VARIANT
v
;
V_VT
(
&
v
)
=
VT_I4
;
V_I4
(
&
v
)
=
V_BOOL
(
lval
)
?
1
:
0
;
return
equal_values
(
ctx
,
&
v
,
rval
,
ei
,
ret
);
}
if
(
V_VT
(
rval
)
==
VT_DISPATCH
&&
(
V_VT
(
lval
)
==
VT_BSTR
||
is_num_vt
(
V_VT
(
lval
))))
{
VARIANT
v
;
HRESULT
hres
;
hres
=
to_primitive
(
ctx
->
parser
->
script
,
rval
,
ei
,
&
v
);
if
(
FAILED
(
hres
))
return
hres
;
hres
=
equal_values
(
ctx
,
lval
,
&
v
,
ei
,
ret
);
VariantClear
(
&
v
);
return
hres
;
}
if
(
V_VT
(
lval
)
==
VT_DISPATCH
&&
(
V_VT
(
rval
)
==
VT_BSTR
||
is_num_vt
(
V_VT
(
rval
))))
{
VARIANT
v
;
HRESULT
hres
;
hres
=
to_primitive
(
ctx
->
parser
->
script
,
lval
,
ei
,
&
v
);
if
(
FAILED
(
hres
))
return
hres
;
hres
=
equal_values
(
ctx
,
&
v
,
rval
,
ei
,
ret
);
VariantClear
(
&
v
);
return
hres
;
}
*
ret
=
FALSE
;
return
S_OK
;
}
/* ECMA-262 3rd Edition 11.9.1 */
HRESULT
equal_expression_eval
(
exec_ctx_t
*
ctx
,
expression_t
*
_expr
,
DWORD
flags
,
jsexcept_t
*
ei
,
exprval_t
*
ret
)
{
binary_expression_t
*
expr
=
(
binary_expression_t
*
)
_expr
;
VARIANT
rval
,
lval
;
BOOL
b
;
HRESULT
hres
;
TRACE
(
"
\n
"
);
hres
=
get_binary_expr_values
(
ctx
,
expr
,
ei
,
&
rval
,
&
lval
);
if
(
FAILED
(
hres
))
return
hres
;
hres
=
equal_values
(
ctx
,
&
rval
,
&
lval
,
ei
,
&
b
);
if
(
FAILED
(
hres
))
return
hres
;
return
return_bool
(
ret
,
b
);
}
/* ECMA-262 3rd Edition 11.9.4 */
...
...
dlls/jscript/tests/lang.js
View file @
d6998348
...
...
@@ -37,6 +37,18 @@ ok(!(undefined === null), "!(undefined === null) is false");
ok
(
1
!==
2
,
"1 !== 2 is false"
);
ok
(
null
!==
undefined
,
"null !== undefined is false"
);
ok
(
1
==
1
,
"1 == 1 is false"
);
ok
(
!
(
1
==
2
),
"!(1 == 2) is false"
);
ok
(
1.0
==
1
,
"1.0 == 1 is false"
);
ok
(
"abc"
==
"abc"
,
"
\"
abc
\"
==
\"
abc
\"
is false"
);
ok
(
true
==
true
,
"true == true is false"
);
ok
(
null
==
null
,
"null == null is false"
);
ok
(
undefined
==
undefined
,
"undefined == undefined is false"
);
ok
(
undefined
==
null
,
"undefined == null is false"
);
ok
(
true
==
1
,
"true == 1 is false"
);
ok
(
!
(
true
==
2
),
"true == 2"
);
ok
(
0
==
false
,
"0 == false is false"
);
var
trueVar
=
true
;
ok
(
trueVar
,
"trueVar is not true"
);
...
...
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