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
fdbd5369
Commit
fdbd5369
authored
Sep 13, 2012
by
Jacek Caban
Committed by
Alexandre Julliard
Sep 13, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jscript: Don't leave current scope in return statement before evaluating the expression.
parent
dd8f54a4
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
12 deletions
+28
-12
compile.c
dlls/jscript/compile.c
+21
-12
lang.js
dlls/jscript/tests/lang.js
+7
-0
No files found.
dlls/jscript/compile.c
View file @
fdbd5369
...
...
@@ -1287,25 +1287,30 @@ static HRESULT compile_forin_statement(compiler_ctx_t *ctx, forin_statement_t *s
return
S_OK
;
}
static
HRESULT
pop_to_stat
(
compiler_ctx_t
*
ctx
,
statement_ctx_t
*
stat_ctx
)
static
HRESULT
pop_to_stat
(
compiler_ctx_t
*
ctx
,
BOOL
var_stack
,
BOOL
scope_stack
,
statement_ctx_t
*
stat_ctx
)
{
unsigned
stack_pop
=
0
;
statement_ctx_t
*
iter
;
for
(
iter
=
ctx
->
stat_ctx
;
iter
!=
stat_ctx
;
iter
=
iter
->
next
)
{
if
(
iter
->
using_scope
&&
!
push_instr
(
ctx
,
OP_pop_scope
))
return
E_OUTOFMEMORY
;
if
(
iter
->
using_except
&&
!
push_instr
(
ctx
,
OP_pop_except
))
return
E_OUTOFMEMORY
;
if
(
scope_stack
)
{
if
(
iter
->
using_scope
&&
!
push_instr
(
ctx
,
OP_pop_scope
))
return
E_OUTOFMEMORY
;
if
(
iter
->
using_except
&&
!
push_instr
(
ctx
,
OP_pop_except
))
return
E_OUTOFMEMORY
;
}
stack_pop
+=
iter
->
stack_use
;
}
/* FIXME: optimize */
while
(
stack_pop
--
)
{
if
(
!
push_instr
(
ctx
,
OP_pop
))
return
E_OUTOFMEMORY
;
if
(
var_stack
)
{
/* FIXME: optimize */
while
(
stack_pop
--
)
{
if
(
!
push_instr
(
ctx
,
OP_pop
))
return
E_OUTOFMEMORY
;
}
}
return
S_OK
;
}
...
...
@@ -1353,7 +1358,7 @@ static HRESULT compile_continue_statement(compiler_ctx_t *ctx, branch_statement_
}
}
hres
=
pop_to_stat
(
ctx
,
pop_ctx
);
hres
=
pop_to_stat
(
ctx
,
TRUE
,
TRUE
,
pop_ctx
);
if
(
FAILED
(
hres
))
return
hres
;
...
...
@@ -1393,7 +1398,7 @@ static HRESULT compile_break_statement(compiler_ctx_t *ctx, branch_statement_t *
}
}
hres
=
pop_to_stat
(
ctx
,
pop_ctx
->
next
);
hres
=
pop_to_stat
(
ctx
,
TRUE
,
TRUE
,
pop_ctx
->
next
);
if
(
FAILED
(
hres
))
return
hres
;
...
...
@@ -1408,7 +1413,7 @@ static HRESULT compile_return_statement(compiler_ctx_t *ctx, expression_statemen
{
HRESULT
hres
;
hres
=
pop_to_stat
(
ctx
,
NULL
);
hres
=
pop_to_stat
(
ctx
,
TRUE
,
FALSE
,
NULL
);
if
(
FAILED
(
hres
))
return
hres
;
...
...
@@ -1418,6 +1423,10 @@ static HRESULT compile_return_statement(compiler_ctx_t *ctx, expression_statemen
return
hres
;
}
hres
=
pop_to_stat
(
ctx
,
FALSE
,
TRUE
,
NULL
);
if
(
FAILED
(
hres
))
return
hres
;
return
push_instr
(
ctx
,
OP_ret
)
?
S_OK
:
E_OUTOFMEMORY
;
}
...
...
dlls/jscript/tests/lang.js
View file @
fdbd5369
...
...
@@ -1355,6 +1355,13 @@ ok(name_override_func === 3, "name_override_func = " + name_override_func);
function name_override_func() {};
ok(name_override_func === 3, "
name_override_func
=
" + name_override_func);
tmp = (function() {
var ret = false;
with({ret: true})
return ret;
})();
ok(tmp, "
tmp
=
" + tmp);
/* NoNewline rule parser tests */
while(true) {
if(true) break
...
...
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