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
64a3f507
Commit
64a3f507
authored
Apr 25, 2012
by
Jacek Caban
Committed by
Alexandre Julliard
Apr 25, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jscript: Store variable names in function_code_t.
parent
e2b59a87
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
23 additions
and
13 deletions
+23
-13
compile.c
dlls/jscript/compile.c
+15
-1
engine.c
dlls/jscript/engine.c
+4
-10
engine.h
dlls/jscript/engine.h
+3
-1
function.c
dlls/jscript/function.c
+1
-1
No files found.
dlls/jscript/compile.c
View file @
64a3f507
...
...
@@ -1775,6 +1775,7 @@ static HRESULT compile_function(compiler_ctx_t *ctx, source_elements_t *source,
BOOL
from_eval
,
function_code_t
*
func
)
{
function_declaration_t
*
iter
;
var_list_t
*
var_iter
;
unsigned
off
,
i
;
HRESULT
hres
;
...
...
@@ -1809,7 +1810,6 @@ static HRESULT compile_function(compiler_ctx_t *ctx, source_elements_t *source,
func
->
source_len
=
func_expr
->
src_len
;
}
func
->
source_elements
=
source
;
func
->
expr
=
func_expr
;
func
->
funcs
=
heap_alloc_zero
(
func
->
func_cnt
*
sizeof
(
*
func
->
funcs
));
...
...
@@ -1823,6 +1823,20 @@ static HRESULT compile_function(compiler_ctx_t *ctx, source_elements_t *source,
}
assert
(
i
==
func
->
func_cnt
);
for
(
var_iter
=
source
->
variables
;
var_iter
;
var_iter
=
var_iter
->
next
)
func
->
var_cnt
++
;
func
->
variables
=
compiler_alloc
(
ctx
->
code
,
func
->
var_cnt
*
sizeof
(
*
func
->
variables
));
if
(
!
func
->
variables
)
return
E_OUTOFMEMORY
;
for
(
var_iter
=
source
->
variables
,
i
=
0
;
var_iter
;
var_iter
=
var_iter
->
next
,
i
++
)
{
func
->
variables
[
i
]
=
compiler_alloc_bstr
(
ctx
,
var_iter
->
identifier
);
if
(
!
func
->
variables
[
i
])
return
E_OUTOFMEMORY
;
}
return
S_OK
;
}
...
...
dlls/jscript/engine.c
View file @
64a3f507
...
...
@@ -2614,7 +2614,6 @@ HRESULT exec_source(exec_ctx_t *ctx, bytecode_t *code, function_code_t *func, BO
jsexcept_t
*
ei
,
VARIANT
*
retv
)
{
exec_ctx_t
*
prev_ctx
;
var_list_t
*
var
;
VARIANT
val
;
unsigned
i
;
HRESULT
hres
=
S_OK
;
...
...
@@ -2640,20 +2639,15 @@ HRESULT exec_source(exec_ctx_t *ctx, bytecode_t *code, function_code_t *func, BO
return
hres
;
}
for
(
var
=
func
->
source_elements
->
variables
;
var
;
var
=
var
->
next
)
{
for
(
i
=
0
;
i
<
func
->
var_cnt
;
i
++
)
{
if
(
!
ctx
->
is_global
||
!
lookup_global_members
(
ctx
->
script
,
func
->
variables
[
i
],
NULL
))
{
DISPID
id
=
0
;
BSTR
name
;
name
=
SysAllocString
(
var
->
identifier
);
if
(
!
name
)
return
E_OUTOFMEMORY
;
if
(
!
ctx
->
is_global
||
!
lookup_global_members
(
ctx
->
script
,
name
,
NULL
))
hres
=
jsdisp_get_id
(
ctx
->
var_disp
,
var
->
identifier
,
fdexNameEnsure
,
&
id
);
SysFreeString
(
name
);
hres
=
jsdisp_get_id
(
ctx
->
var_disp
,
func
->
variables
[
i
],
fdexNameEnsure
,
&
id
);
if
(
FAILED
(
hres
))
return
hres
;
}
}
prev_ctx
=
ctx
->
script
->
exec_ctx
;
ctx
->
script
->
exec_ctx
=
ctx
;
...
...
dlls/jscript/engine.h
View file @
64a3f507
...
...
@@ -171,13 +171,15 @@ typedef struct _function_code_t {
unsigned
instr_off
;
function_expression_t
*
expr
;
/* FIXME */
source_elements_t
*
source_elements
;
/* FIXME */
const
WCHAR
*
source
;
unsigned
source_len
;
unsigned
func_cnt
;
struct
_function_code_t
*
funcs
;
unsigned
var_cnt
;
BSTR
*
variables
;
}
function_code_t
;
typedef
struct
_bytecode_t
{
...
...
dlls/jscript/function.c
View file @
64a3f507
...
...
@@ -774,7 +774,7 @@ static HRESULT construct_function(script_ctx_t *ctx, DISPPARAMS *dp, jsexcept_t
if
(
FAILED
(
hres
))
return
hres
;
if
(
code
->
global_code
.
func_cnt
!=
1
||
code
->
parser
->
source
->
variables
)
{
if
(
code
->
global_code
.
func_cnt
!=
1
||
code
->
global_code
.
var_cnt
)
{
ERR
(
"Invalid parser result!
\n
"
);
release_bytecode
(
code
);
return
E_UNEXPECTED
;
...
...
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