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
8ef7038b
Commit
8ef7038b
authored
Sep 10, 2008
by
Jacek Caban
Committed by
Alexandre Julliard
Sep 11, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jscript: Added array expression implementation.
parent
68d4f489
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
72 additions
and
3 deletions
+72
-3
engine.c
dlls/jscript/engine.c
+54
-3
jscript.h
dlls/jscript/jscript.h
+1
-0
jsutils.c
dlls/jscript/jsutils.c
+15
-0
lang.js
dlls/jscript/tests/lang.js
+2
-0
No files found.
dlls/jscript/engine.c
View file @
8ef7038b
...
...
@@ -715,10 +715,61 @@ HRESULT conditional_expression_eval(exec_ctx_t *ctx, expression_t *expr, DWORD f
return
E_NOTIMPL
;
}
HRESULT
array_expression_eval
(
exec_ctx_t
*
ctx
,
expression_t
*
expr
,
DWORD
flags
,
jsexcept_t
*
ei
,
exprval_t
*
ret
)
/* ECMA-262 3rd Edition 11.2.1 */
HRESULT
array_expression_eval
(
exec_ctx_t
*
ctx
,
expression_t
*
_expr
,
DWORD
flags
,
jsexcept_t
*
ei
,
exprval_t
*
ret
)
{
FIXME
(
"
\n
"
);
return
E_NOTIMPL
;
array_expression_t
*
expr
=
(
array_expression_t
*
)
_expr
;
exprval_t
exprval
;
VARIANT
member
,
val
;
DISPID
id
;
BSTR
str
;
IDispatch
*
obj
=
NULL
;
HRESULT
hres
;
TRACE
(
"
\n
"
);
hres
=
expr_eval
(
ctx
,
expr
->
member_expr
,
EXPR_NEWREF
,
ei
,
&
exprval
);
if
(
FAILED
(
hres
))
return
hres
;
hres
=
exprval_to_value
(
ctx
->
parser
->
script
,
&
exprval
,
ei
,
&
member
);
exprval_release
(
&
exprval
);
if
(
FAILED
(
hres
))
return
hres
;
hres
=
expr_eval
(
ctx
,
expr
->
expression
,
EXPR_NEWREF
,
ei
,
&
exprval
);
if
(
SUCCEEDED
(
hres
))
{
hres
=
exprval_to_value
(
ctx
->
parser
->
script
,
&
exprval
,
ei
,
&
val
);
exprval_release
(
&
exprval
);
}
if
(
SUCCEEDED
(
hres
))
hres
=
to_object
(
ctx
,
&
member
,
&
obj
);
VariantClear
(
&
member
);
if
(
SUCCEEDED
(
hres
))
{
hres
=
to_string
(
ctx
->
parser
->
script
,
&
val
,
ei
,
&
str
);
if
(
SUCCEEDED
(
hres
))
{
if
(
flags
&
EXPR_STRREF
)
{
ret
->
type
=
EXPRVAL_NAMEREF
;
ret
->
u
.
nameref
.
disp
=
obj
;
ret
->
u
.
nameref
.
name
=
str
;
return
S_OK
;
}
hres
=
disp_get_id
(
obj
,
str
,
flags
&
EXPR_NEWREF
?
fdexNameEnsure
:
0
,
&
id
);
}
if
(
SUCCEEDED
(
hres
))
{
exprval_set_idref
(
ret
,
obj
,
id
);
}
else
if
(
!
(
flags
&
EXPR_NEWREF
)
&&
hres
==
DISP_E_UNKNOWNNAME
)
{
exprval_init
(
ret
);
hres
=
S_OK
;
}
IDispatch_Release
(
obj
);
}
return
hres
;
}
/* ECMA-262 3rd Edition 11.2.1 */
...
...
dlls/jscript/jscript.h
View file @
8ef7038b
...
...
@@ -116,6 +116,7 @@ HRESULT create_builtin_function(script_ctx_t*,builtin_invoke_t,DWORD,DispatchEx*
HRESULT
create_math
(
script_ctx_t
*
,
DispatchEx
**
);
HRESULT
to_boolean
(
VARIANT
*
,
VARIANT_BOOL
*
);
HRESULT
to_string
(
script_ctx_t
*
,
VARIANT
*
,
jsexcept_t
*
,
BSTR
*
);
HRESULT
to_object
(
exec_ctx_t
*
,
VARIANT
*
,
IDispatch
**
);
typedef
struct
named_item_t
{
...
...
dlls/jscript/jsutils.c
View file @
8ef7038b
...
...
@@ -164,6 +164,21 @@ HRESULT to_boolean(VARIANT *v, VARIANT_BOOL *b)
return
S_OK
;
}
/* ECMA-262 3rd Edition 9.8 */
HRESULT
to_string
(
script_ctx_t
*
ctx
,
VARIANT
*
v
,
jsexcept_t
*
ei
,
BSTR
*
str
)
{
switch
(
V_VT
(
v
))
{
case
VT_BSTR
:
*
str
=
SysAllocString
(
V_BSTR
(
v
));
return
S_OK
;
default:
FIXME
(
"unsupported vt %d
\n
"
,
V_VT
(
v
));
}
return
E_NOTIMPL
;
}
/* ECMA-262 3rd Edition 9.9 */
HRESULT
to_object
(
exec_ctx_t
*
ctx
,
VARIANT
*
v
,
IDispatch
**
disp
)
{
...
...
dlls/jscript/tests/lang.js
View file @
8ef7038b
...
...
@@ -45,6 +45,8 @@ function testFunc1(x, y) {
ok
(
x
===
true
,
"x is not 1"
);
ok
(
y
===
"test"
,
"y is not
\"
test
\"
"
);
ok
(
arguments
.
length
===
2
,
"arguments.length is not 2"
);
ok
(
arguments
[
"0"
]
===
true
,
"arguments[0] is not true"
);
ok
(
arguments
[
"1"
]
===
"test"
,
"arguments[1] is not
\"
test
\"
"
);
return
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