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
66eb62ad
Commit
66eb62ad
authored
Sep 16, 2008
by
Jacek Caban
Committed by
Alexandre Julliard
Sep 16, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jscript: Added try statement implementation.
parent
147ec1a1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
102 additions
and
4 deletions
+102
-4
engine.c
dlls/jscript/engine.c
+71
-4
lang.js
dlls/jscript/tests/lang.js
+31
-0
No files found.
dlls/jscript/engine.c
View file @
66eb62ad
...
@@ -144,6 +144,15 @@ HRESULT scope_push(scope_chain_t *scope, DispatchEx *obj, scope_chain_t **ret)
...
@@ -144,6 +144,15 @@ HRESULT scope_push(scope_chain_t *scope, DispatchEx *obj, scope_chain_t **ret)
return
S_OK
;
return
S_OK
;
}
}
static
void
scope_pop
(
scope_chain_t
**
scope
)
{
scope_chain_t
*
tmp
;
tmp
=
*
scope
;
*
scope
=
tmp
->
next
;
scope_release
(
tmp
);
}
void
scope_release
(
scope_chain_t
*
scope
)
void
scope_release
(
scope_chain_t
*
scope
)
{
{
if
(
--
scope
->
ref
)
if
(
--
scope
->
ref
)
...
@@ -713,16 +722,74 @@ HRESULT switch_statement_eval(exec_ctx_t *ctx, statement_t *stat, return_type_t
...
@@ -713,16 +722,74 @@ HRESULT switch_statement_eval(exec_ctx_t *ctx, statement_t *stat, return_type_t
return
E_NOTIMPL
;
return
E_NOTIMPL
;
}
}
HRESULT
throw_statement_eval
(
exec_ctx_t
*
ctx
,
statement_t
*
stat
,
return_type_t
*
rt
,
VARIANT
*
ret
)
HRESULT
throw_statement_eval
(
exec_ctx_t
*
ctx
,
statement_t
*
_
stat
,
return_type_t
*
rt
,
VARIANT
*
ret
)
{
{
FIXME
(
"
\n
"
);
FIXME
(
"
\n
"
);
return
E_NOTIMPL
;
return
E_NOTIMPL
;
}
}
HRESULT
try_statement_eval
(
exec_ctx_t
*
ctx
,
statement_t
*
stat
,
return_type_t
*
rt
,
VARIANT
*
ret
)
/* ECMA-262 3rd Edition 12.14 */
static
HRESULT
catch_eval
(
exec_ctx_t
*
ctx
,
catch_block_t
*
block
,
return_type_t
*
rt
,
VARIANT
*
ret
)
{
{
FIXME
(
"
\n
"
);
DispatchEx
*
var_disp
;
return
E_NOTIMPL
;
VARIANT
ex
,
val
;
HRESULT
hres
;
ex
=
rt
->
ei
.
var
;
memset
(
&
rt
->
ei
,
0
,
sizeof
(
jsexcept_t
));
hres
=
create_dispex
(
ctx
->
parser
->
script
,
NULL
,
NULL
,
&
var_disp
);
if
(
SUCCEEDED
(
hres
))
{
hres
=
jsdisp_propput_name
(
var_disp
,
block
->
identifier
,
ctx
->
parser
->
script
->
lcid
,
&
ex
,
&
rt
->
ei
,
NULL
/*FIXME*/
);
if
(
SUCCEEDED
(
hres
))
{
hres
=
scope_push
(
ctx
->
scope_chain
,
var_disp
,
&
ctx
->
scope_chain
);
if
(
SUCCEEDED
(
hres
))
{
hres
=
stat_eval
(
ctx
,
block
->
statement
,
rt
,
&
val
);
scope_pop
(
&
ctx
->
scope_chain
);
}
}
jsdisp_release
(
var_disp
);
}
VariantClear
(
&
ex
);
if
(
FAILED
(
hres
))
return
hres
;
*
ret
=
val
;
return
S_OK
;
}
/* ECMA-262 3rd Edition 12.14 */
HRESULT
try_statement_eval
(
exec_ctx_t
*
ctx
,
statement_t
*
_stat
,
return_type_t
*
rt
,
VARIANT
*
ret
)
{
try_statement_t
*
stat
=
(
try_statement_t
*
)
_stat
;
VARIANT
val
;
HRESULT
hres
;
TRACE
(
"
\n
"
);
hres
=
stat_eval
(
ctx
,
stat
->
try_statement
,
rt
,
&
val
);
if
(
FAILED
(
hres
))
{
TRACE
(
"EXCEPTION
\n
"
);
if
(
!
stat
->
catch_block
)
return
hres
;
hres
=
catch_eval
(
ctx
,
stat
->
catch_block
,
rt
,
&
val
);
if
(
FAILED
(
hres
))
return
hres
;
}
if
(
stat
->
finally_statement
)
{
VariantClear
(
&
val
);
hres
=
stat_eval
(
ctx
,
stat
->
finally_statement
,
rt
,
&
val
);
if
(
FAILED
(
hres
))
return
hres
;
}
*
ret
=
val
;
return
S_OK
;
}
}
static
HRESULT
return_bool
(
exprval_t
*
ret
,
DWORD
b
)
static
HRESULT
return_bool
(
exprval_t
*
ret
,
DWORD
b
)
...
...
dlls/jscript/tests/lang.js
View file @
66eb62ad
...
@@ -236,4 +236,35 @@ ok(tmp === 1, "decremented tmp is not 1");
...
@@ -236,4 +236,35 @@ ok(tmp === 1, "decremented tmp is not 1");
String
.
prototype
.
test
=
true
;
String
.
prototype
.
test
=
true
;
ok
(
""
.
test
===
true
,
"
\"\"
,test is not true"
);
ok
(
""
.
test
===
true
,
"
\"\"
,test is not true"
);
var
state
=
""
;
try
{
ok
(
state
===
""
,
"try: state = "
+
state
);
state
=
"try"
;
}
catch
(
ex
)
{
ok
(
false
,
"unexpected catch"
);
}
ok
(
state
===
"try"
,
"state = "
+
state
+
" expected try"
);
state
=
""
;
try
{
ok
(
state
===
""
,
"try: state = "
+
state
);
state
=
"try"
;
}
finally
{
ok
(
state
===
"try"
,
"funally: state = "
+
state
);
state
=
"finally"
;
}
ok
(
state
===
"finally"
,
"state = "
+
state
+
" expected finally"
);
state
=
""
;
try
{
ok
(
state
===
""
,
"try: state = "
+
state
);
state
=
"try"
;
}
catch
(
ex
)
{
ok
(
false
,
"unexpected catch"
);
}
finally
{
ok
(
state
===
"try"
,
"funally: state = "
+
state
);
state
=
"finally"
;
}
ok
(
state
===
"finally"
,
"state = "
+
state
+
" expected finally"
);
reportSuccess
();
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