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
8e162404
Commit
8e162404
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 for..in statement implementation.
parent
4731f174
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
131 additions
and
4 deletions
+131
-4
dispex.c
dlls/jscript/dispex.c
+2
-0
engine.c
dlls/jscript/engine.c
+96
-4
lang.js
dlls/jscript/tests/lang.js
+33
-0
No files found.
dlls/jscript/dispex.c
View file @
8e162404
...
...
@@ -381,6 +381,8 @@ static HRESULT fill_protrefs(DispatchEx *This)
fill_protrefs
(
This
->
prototype
);
for
(
iter
=
This
->
prototype
->
props
;
iter
<
This
->
prototype
->
props
+
This
->
prototype
->
prop_cnt
;
iter
++
)
{
if
(
!
iter
->
name
)
continue
;
hres
=
find_prop_name
(
This
,
iter
->
name
,
&
prop
);
if
(
FAILED
(
hres
))
return
hres
;
...
...
dlls/jscript/engine.c
View file @
8e162404
...
...
@@ -764,10 +764,102 @@ HRESULT for_statement_eval(exec_ctx_t *ctx, statement_t *_stat, return_type_t *r
return
S_OK
;
}
HRESULT
forin_statement_eval
(
exec_ctx_t
*
ctx
,
statement_t
*
stat
,
return_type_t
*
rt
,
VARIANT
*
ret
)
{
FIXME
(
"
\n
"
);
return
E_NOTIMPL
;
/* ECMA-262 3rd Edition 12.6.4 */
HRESULT
forin_statement_eval
(
exec_ctx_t
*
ctx
,
statement_t
*
_stat
,
return_type_t
*
rt
,
VARIANT
*
ret
)
{
forin_statement_t
*
stat
=
(
forin_statement_t
*
)
_stat
;
VARIANT
val
,
name
,
retv
,
tmp
;
DISPID
id
=
DISPID_STARTENUM
;
BSTR
str
,
identifier
=
NULL
;
IDispatchEx
*
in_obj
;
exprval_t
exprval
;
HRESULT
hres
;
TRACE
(
"
\n
"
);
if
(
stat
->
variable
)
{
hres
=
variable_list_eval
(
ctx
,
stat
->
variable
,
&
rt
->
ei
);
if
(
FAILED
(
hres
))
return
hres
;
}
hres
=
expr_eval
(
ctx
,
stat
->
in_expr
,
EXPR_NEWREF
,
&
rt
->
ei
,
&
exprval
);
if
(
FAILED
(
hres
))
return
hres
;
hres
=
exprval_to_value
(
ctx
->
parser
->
script
,
&
exprval
,
&
rt
->
ei
,
&
val
);
exprval_release
(
&
exprval
);
if
(
FAILED
(
hres
))
return
hres
;
if
(
V_VT
(
&
val
)
!=
VT_DISPATCH
)
{
FIXME
(
"in vt %d
\n
"
,
V_VT
(
&
val
));
VariantClear
(
&
val
);
return
E_NOTIMPL
;
}
hres
=
IDispatch_QueryInterface
(
V_DISPATCH
(
&
val
),
&
IID_IDispatchEx
,
(
void
**
)
&
in_obj
);
IDispatch_Release
(
V_DISPATCH
(
&
val
));
if
(
FAILED
(
hres
))
{
FIXME
(
"Object doesn't support IDispatchEx
\n
"
);
return
E_NOTIMPL
;
}
V_VT
(
&
retv
)
=
VT_EMPTY
;
if
(
stat
->
variable
)
identifier
=
SysAllocString
(
stat
->
variable
->
identifier
);
while
(
1
)
{
hres
=
IDispatchEx_GetNextDispID
(
in_obj
,
fdexEnumDefault
,
id
,
&
id
);
if
(
FAILED
(
hres
)
||
hres
==
S_FALSE
)
break
;
hres
=
IDispatchEx_GetMemberName
(
in_obj
,
id
,
&
str
);
if
(
FAILED
(
hres
))
break
;
TRACE
(
"iter %s
\n
"
,
debugstr_w
(
str
));
if
(
stat
->
variable
)
hres
=
identifier_eval
(
ctx
,
identifier
,
0
,
&
exprval
);
else
hres
=
expr_eval
(
ctx
,
stat
->
expr
,
EXPR_NEWREF
,
&
rt
->
ei
,
&
exprval
);
if
(
SUCCEEDED
(
hres
))
{
V_VT
(
&
name
)
=
VT_BSTR
;
V_BSTR
(
&
name
)
=
str
;
hres
=
put_value
(
ctx
->
parser
->
script
,
&
exprval
,
&
name
,
&
rt
->
ei
);
exprval_release
(
&
exprval
);
}
SysFreeString
(
str
);
if
(
FAILED
(
hres
))
break
;
hres
=
stat_eval
(
ctx
,
stat
->
statement
,
rt
,
&
tmp
);
if
(
FAILED
(
hres
))
break
;
VariantClear
(
&
retv
);
retv
=
tmp
;
if
(
rt
->
type
==
RT_CONTINUE
)
rt
->
type
=
RT_NORMAL
;
else
if
(
rt
->
type
!=
RT_NORMAL
)
break
;
}
SysFreeString
(
identifier
);
IDispatchEx_Release
(
in_obj
);
if
(
FAILED
(
hres
))
{
VariantClear
(
&
retv
);
return
hres
;
}
if
(
rt
->
type
==
RT_BREAK
)
rt
->
type
=
RT_NORMAL
;
*
ret
=
retv
;
return
S_OK
;
}
/* ECMA-262 3rd Edition 12.7 */
...
...
dlls/jscript/tests/lang.js
View file @
8e162404
...
...
@@ -617,4 +617,37 @@ ok(fi === 4, "fi !== 4");
ok
((
void
1
)
===
undefined
,
"(void 1) !== undefined"
);
var
inobj
=
new
Object
();
for
(
var
iter
in
inobj
)
ok
(
false
,
"unexpected iter = "
+
iter
);
inobj
.
test
=
true
;
tmp
=
0
;
for
(
iter
in
inobj
)
{
ok
(
iter
==
"test"
,
"unexpected iter = "
+
iter
);
tmp
++
;
}
ok
(
tmp
===
1
,
"for..in tmp = "
+
tmp
);
function
forinTestObj
()
{}
forinTestObj
.
prototype
.
test3
=
true
;
var
arr
=
new
Array
();
inobj
=
new
forinTestObj
();
inobj
.
test1
=
true
;
inobj
.
test2
=
true
;
tmp
=
0
;
for
(
iter
in
inobj
)
{
arr
[
iter
]
=
true
;
tmp
++
;
}
ok
(
tmp
===
3
,
"for..in tmp = "
+
tmp
);
ok
(
arr
[
"test1"
]
===
true
,
"arr[test1] !== true"
);
ok
(
arr
[
"test2"
]
===
true
,
"arr[test2] !== true"
);
ok
(
arr
[
"test3"
]
===
true
,
"arr[test3] !== 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