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
9e68bade
Commit
9e68bade
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 for statement implementation.
parent
99335680
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
99 additions
and
3 deletions
+99
-3
engine.c
dlls/jscript/engine.c
+77
-3
lang.js
dlls/jscript/tests/lang.js
+22
-0
No files found.
dlls/jscript/engine.c
View file @
9e68bade
...
...
@@ -695,10 +695,84 @@ HRESULT while_statement_eval(exec_ctx_t *ctx, statement_t *_stat, return_type_t
return
S_OK
;
}
HRESULT
for_statement_eval
(
exec_ctx_t
*
ctx
,
statement_t
*
stat
,
return_type_t
*
rt
,
VARIANT
*
ret
)
/* ECMA-262 3rd Edition 12.6.3 */
HRESULT
for_statement_eval
(
exec_ctx_t
*
ctx
,
statement_t
*
_stat
,
return_type_t
*
rt
,
VARIANT
*
ret
)
{
FIXME
(
"
\n
"
);
return
E_NOTIMPL
;
for_statement_t
*
stat
=
(
for_statement_t
*
)
_stat
;
VARIANT
val
,
tmp
,
retv
;
exprval_t
exprval
;
VARIANT_BOOL
b
;
HRESULT
hres
;
TRACE
(
"
\n
"
);
if
(
stat
->
variable_list
)
{
hres
=
variable_list_eval
(
ctx
,
stat
->
variable_list
,
&
rt
->
ei
);
if
(
FAILED
(
hres
))
return
hres
;
}
else
if
(
stat
->
begin_expr
)
{
hres
=
expr_eval
(
ctx
,
stat
->
begin_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
;
VariantClear
(
&
val
);
}
V_VT
(
&
retv
)
=
VT_EMPTY
;
while
(
1
)
{
if
(
stat
->
expr
)
{
hres
=
expr_eval
(
ctx
,
stat
->
expr
,
0
,
&
rt
->
ei
,
&
exprval
);
if
(
FAILED
(
hres
))
break
;
hres
=
exprval_to_boolean
(
ctx
->
parser
->
script
,
&
exprval
,
&
rt
->
ei
,
&
b
);
exprval_release
(
&
exprval
);
if
(
FAILED
(
hres
)
||
!
b
)
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
;
if
(
stat
->
end_expr
)
{
hres
=
expr_eval
(
ctx
,
stat
->
end_expr
,
0
,
&
rt
->
ei
,
&
exprval
);
if
(
FAILED
(
hres
))
break
;
hres
=
exprval_to_value
(
ctx
->
parser
->
script
,
&
exprval
,
&
rt
->
ei
,
&
val
);
exprval_release
(
&
exprval
);
if
(
FAILED
(
hres
))
break
;
VariantClear
(
&
val
);
}
}
if
(
FAILED
(
hres
))
{
VariantClear
(
&
retv
);
return
hres
;
}
if
(
rt
->
type
==
RT_BREAK
)
rt
->
type
=
RT_NORMAL
;
*
ret
=
retv
;
return
S_OK
;
}
HRESULT
forin_statement_eval
(
exec_ctx_t
*
ctx
,
statement_t
*
stat
,
return_type_t
*
rt
,
VARIANT
*
ret
)
...
...
dlls/jscript/tests/lang.js
View file @
9e68bade
...
...
@@ -593,4 +593,26 @@ while(tmp < 4) {
}
ok
(
tmp
===
4
,
"tmp !== 4"
);
for
(
tmp
=
0
;
tmp
<
4
;
tmp
++
)
ok
(
tmp
<
4
,
"tmp = "
+
tmp
);
ok
(
tmp
===
4
,
"tmp !== 4"
);
for
(
tmp
=
0
;
tmp
<
4
;
tmp
++
)
{
if
(
tmp
===
2
)
break
;
ok
(
tmp
<
2
,
"tmp = "
+
tmp
);
}
ok
(
tmp
===
2
,
"tmp !== 2"
);
for
(
tmp
=
0
;
tmp
<
4
;
tmp
++
)
{
if
(
tmp
===
2
)
continue
;
ok
(
tmp
<
4
&&
tmp
!=
2
,
"tmp = "
+
tmp
);
}
ok
(
tmp
===
4
,
"tmp !== 4"
);
for
(
var
fi
=
0
;
fi
<
4
;
fi
++
)
ok
(
fi
<
4
,
"fi = "
+
fi
);
ok
(
fi
===
4
,
"fi !== 4"
);
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