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
11153d0e
Commit
11153d0e
authored
Sep 09, 2008
by
Jacek Caban
Committed by
Alexandre Julliard
Sep 09, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jscript: Added logical negation implementation.
parent
b6089835
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
84 additions
and
3 deletions
+84
-3
engine.c
dlls/jscript/engine.c
+46
-3
jscript.h
dlls/jscript/jscript.h
+2
-0
jsutils.c
dlls/jscript/jsutils.c
+31
-0
lang.js
dlls/jscript/tests/lang.js
+5
-0
No files found.
dlls/jscript/engine.c
View file @
11153d0e
...
...
@@ -86,6 +86,24 @@ static HRESULT exprval_to_value(script_ctx_t *ctx, exprval_t *val, jsexcept_t *e
return
exprval_value
(
ctx
,
val
,
ei
,
ret
);
}
static
HRESULT
exprval_to_boolean
(
script_ctx_t
*
ctx
,
exprval_t
*
exprval
,
jsexcept_t
*
ei
,
VARIANT_BOOL
*
b
)
{
if
(
exprval
->
type
!=
EXPRVAL_VARIANT
)
{
VARIANT
val
;
HRESULT
hres
;
hres
=
exprval_to_value
(
ctx
,
exprval
,
ei
,
&
val
);
if
(
FAILED
(
hres
))
return
hres
;
hres
=
to_boolean
(
&
val
,
b
);
VariantClear
(
&
val
);
return
hres
;
}
return
to_boolean
(
&
exprval
->
u
.
var
,
b
);
}
static
void
exprval_set_idref
(
exprval_t
*
val
,
IDispatch
*
disp
,
DISPID
id
)
{
val
->
type
=
EXPRVAL_IDREF
;
...
...
@@ -440,6 +458,15 @@ HRESULT try_statement_eval(exec_ctx_t *ctx, statement_t *stat, return_type_t *rt
return
E_NOTIMPL
;
}
static
HRESULT
return_bool
(
exprval_t
*
ret
,
DWORD
b
)
{
ret
->
type
=
EXPRVAL_VARIANT
;
V_VT
(
&
ret
->
u
.
var
)
=
VT_BOOL
;
V_BOOL
(
&
ret
->
u
.
var
)
=
b
?
VARIANT_TRUE
:
VARIANT_FALSE
;
return
S_OK
;
}
HRESULT
function_expression_eval
(
exec_ctx_t
*
ctx
,
expression_t
*
expr
,
DWORD
flags
,
jsexcept_t
*
ei
,
exprval_t
*
ret
)
{
FIXME
(
"
\n
"
);
...
...
@@ -808,10 +835,26 @@ HRESULT binary_negation_expression_eval(exec_ctx_t *ctx, expression_t *expr, DWO
return
E_NOTIMPL
;
}
HRESULT
logical_negation_expression_eval
(
exec_ctx_t
*
ctx
,
expression_t
*
expr
,
DWORD
flags
,
jsexcept_t
*
ei
,
exprval_t
*
ret
)
/* ECMA-262 3rd Edition 11.4.9 */
HRESULT
logical_negation_expression_eval
(
exec_ctx_t
*
ctx
,
expression_t
*
_expr
,
DWORD
flags
,
jsexcept_t
*
ei
,
exprval_t
*
ret
)
{
FIXME
(
"
\n
"
);
return
E_NOTIMPL
;
unary_expression_t
*
expr
=
(
unary_expression_t
*
)
_expr
;
exprval_t
exprval
;
VARIANT_BOOL
b
;
HRESULT
hres
;
TRACE
(
"
\n
"
);
hres
=
expr_eval
(
ctx
,
expr
->
expression
,
EXPR_NEWREF
,
ei
,
&
exprval
);
if
(
FAILED
(
hres
))
return
hres
;
hres
=
exprval_to_boolean
(
ctx
->
parser
->
script
,
&
exprval
,
ei
,
&
b
);
exprval_release
(
&
exprval
);
if
(
FAILED
(
hres
))
return
hres
;
return
return_bool
(
ret
,
!
b
);
}
HRESULT
left_shift_expression_eval
(
exec_ctx_t
*
ctx
,
expression_t
*
_expr
,
DWORD
flags
,
jsexcept_t
*
ei
,
exprval_t
*
ret
)
...
...
dlls/jscript/jscript.h
View file @
11153d0e
...
...
@@ -91,6 +91,8 @@ HRESULT disp_call(IDispatch*,DISPID,LCID,WORD,DISPPARAMS*,VARIANT*,jsexcept_t*,I
HRESULT
disp_propget
(
IDispatch
*
,
DISPID
,
LCID
,
VARIANT
*
,
jsexcept_t
*
,
IServiceProvider
*
);
HRESULT
disp_propput
(
IDispatch
*
,
DISPID
,
LCID
,
VARIANT
*
,
jsexcept_t
*
,
IServiceProvider
*
);
HRESULT
to_boolean
(
VARIANT
*
,
VARIANT_BOOL
*
);
typedef
struct
named_item_t
{
IDispatch
*
disp
;
DWORD
flags
;
...
...
dlls/jscript/jsutils.c
View file @
11153d0e
...
...
@@ -132,3 +132,34 @@ void jsheap_free(jsheap_t *heap)
jsheap_init
(
heap
);
}
/* ECMA-262 3rd Edition 9.2 */
HRESULT
to_boolean
(
VARIANT
*
v
,
VARIANT_BOOL
*
b
)
{
switch
(
V_VT
(
v
))
{
case
VT_EMPTY
:
case
VT_NULL
:
*
b
=
VARIANT_FALSE
;
break
;
case
VT_I4
:
*
b
=
V_I4
(
v
)
?
VARIANT_TRUE
:
VARIANT_FALSE
;
break
;
case
VT_R8
:
*
b
=
V_R8
(
v
)
?
VARIANT_TRUE
:
VARIANT_FALSE
;
break
;
case
VT_BSTR
:
*
b
=
V_BSTR
(
v
)
&&
*
V_BSTR
(
v
)
?
VARIANT_TRUE
:
VARIANT_FALSE
;
break
;
case
VT_DISPATCH
:
*
b
=
V_DISPATCH
(
v
)
?
VARIANT_TRUE
:
VARIANT_FALSE
;
break
;
case
VT_BOOL
:
*
b
=
V_BOOL
(
v
);
break
;
default:
FIXME
(
"unimplemented for vt %d
\n
"
,
V_VT
(
v
));
return
E_NOTIMPL
;
}
return
S_OK
;
}
dlls/jscript/tests/lang.js
View file @
11153d0e
...
...
@@ -17,5 +17,10 @@
*/
ok
(
true
,
"true is not true?"
);
ok
(
!
false
,
"!false is not true"
);
ok
(
!
undefined
,
"!undefined is not true"
);
ok
(
!
null
,
"!null is not true"
);
ok
(
!
0
,
"!0 is not true"
);
ok
(
!
0.0
,
"!0.0 is not true"
);
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