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
f08fcff4
Commit
f08fcff4
authored
Dec 29, 2011
by
Jacek Caban
Committed by
Alexandre Julliard
Dec 29, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jscript: Moved exec_source to the bottom of the file.
parent
2dcb8d41
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
81 additions
and
81 deletions
+81
-81
engine.c
dlls/jscript/engine.c
+81
-81
No files found.
dlls/jscript/engine.c
View file @
f08fcff4
...
...
@@ -499,87 +499,6 @@ static BOOL lookup_global_members(script_ctx_t *ctx, BSTR identifier, exprval_t
return
FALSE
;
}
HRESULT
exec_source
(
exec_ctx_t
*
ctx
,
parser_ctx_t
*
parser
,
source_elements_t
*
source
,
BOOL
from_eval
,
jsexcept_t
*
ei
,
VARIANT
*
retv
)
{
script_ctx_t
*
script
=
parser
->
script
;
function_declaration_t
*
func
;
parser_ctx_t
*
prev_parser
;
var_list_t
*
var
;
VARIANT
val
;
exec_ctx_t
*
prev_ctx
;
return_type_t
rt
;
HRESULT
hres
=
S_OK
;
for
(
func
=
source
->
functions
;
func
;
func
=
func
->
next
)
{
jsdisp_t
*
func_obj
;
VARIANT
var
;
hres
=
create_source_function
(
parser
,
func
->
expr
->
parameter_list
,
func
->
expr
->
source_elements
,
ctx
->
scope_chain
,
func
->
expr
->
src_str
,
func
->
expr
->
src_len
,
&
func_obj
);
if
(
FAILED
(
hres
))
return
hres
;
var_set_jsdisp
(
&
var
,
func_obj
);
hres
=
jsdisp_propput_name
(
ctx
->
var_disp
,
func
->
expr
->
identifier
,
&
var
,
ei
,
NULL
);
jsdisp_release
(
func_obj
);
if
(
FAILED
(
hres
))
return
hres
;
}
for
(
var
=
source
->
variables
;
var
;
var
=
var
->
next
)
{
DISPID
id
=
0
;
BSTR
name
;
name
=
SysAllocString
(
var
->
identifier
);
if
(
!
name
)
return
E_OUTOFMEMORY
;
if
(
!
ctx
->
is_global
||
!
lookup_global_members
(
parser
->
script
,
name
,
NULL
))
hres
=
jsdisp_get_id
(
ctx
->
var_disp
,
var
->
identifier
,
fdexNameEnsure
,
&
id
);
SysFreeString
(
name
);
if
(
FAILED
(
hres
))
return
hres
;
}
prev_ctx
=
script
->
exec_ctx
;
script
->
exec_ctx
=
ctx
;
prev_parser
=
ctx
->
parser
;
ctx
->
parser
=
parser
;
V_VT
(
&
val
)
=
VT_EMPTY
;
memset
(
&
rt
,
0
,
sizeof
(
rt
));
rt
.
type
=
RT_NORMAL
;
if
(
source
->
statement
)
{
if
(
source
->
statement
->
instr_off
==
-
1
)
hres
=
compile_subscript_stat
(
ctx
->
parser
,
source
->
statement
,
TRUE
,
&
source
->
statement
->
instr_off
);
if
(
SUCCEEDED
(
hres
))
hres
=
compiled_statement_eval
(
script
,
source
->
statement
,
&
rt
,
&
val
);
}
script
->
exec_ctx
=
prev_ctx
;
ctx
->
parser
=
prev_parser
;
if
(
rt
.
type
!=
RT_NORMAL
&&
rt
.
type
!=
RT_RETURN
)
{
FIXME
(
"wrong rt %d
\n
"
,
rt
.
type
);
hres
=
E_FAIL
;
}
*
ei
=
rt
.
ei
;
if
(
FAILED
(
hres
))
{
VariantClear
(
&
val
);
return
hres
;
}
if
(
!
retv
||
(
!
from_eval
&&
rt
.
type
!=
RT_RETURN
))
VariantClear
(
&
val
);
if
(
retv
)
*
retv
=
val
;
return
S_OK
;
}
/* ECMA-262 3rd Edition 10.1.4 */
static
HRESULT
identifier_eval
(
script_ctx_t
*
ctx
,
BSTR
identifier
,
DWORD
flags
,
jsexcept_t
*
ei
,
exprval_t
*
ret
)
{
...
...
@@ -2787,3 +2706,84 @@ static HRESULT expr_eval(script_ctx_t *ctx, expression_t *expr, jsexcept_t *ei,
*
ret
=
*
stack_pop
(
exec_ctx
);
return
S_OK
;
}
HRESULT
exec_source
(
exec_ctx_t
*
ctx
,
parser_ctx_t
*
parser
,
source_elements_t
*
source
,
BOOL
from_eval
,
jsexcept_t
*
ei
,
VARIANT
*
retv
)
{
script_ctx_t
*
script
=
parser
->
script
;
function_declaration_t
*
func
;
parser_ctx_t
*
prev_parser
;
var_list_t
*
var
;
VARIANT
val
;
exec_ctx_t
*
prev_ctx
;
return_type_t
rt
;
HRESULT
hres
=
S_OK
;
for
(
func
=
source
->
functions
;
func
;
func
=
func
->
next
)
{
jsdisp_t
*
func_obj
;
VARIANT
var
;
hres
=
create_source_function
(
parser
,
func
->
expr
->
parameter_list
,
func
->
expr
->
source_elements
,
ctx
->
scope_chain
,
func
->
expr
->
src_str
,
func
->
expr
->
src_len
,
&
func_obj
);
if
(
FAILED
(
hres
))
return
hres
;
var_set_jsdisp
(
&
var
,
func_obj
);
hres
=
jsdisp_propput_name
(
ctx
->
var_disp
,
func
->
expr
->
identifier
,
&
var
,
ei
,
NULL
);
jsdisp_release
(
func_obj
);
if
(
FAILED
(
hres
))
return
hres
;
}
for
(
var
=
source
->
variables
;
var
;
var
=
var
->
next
)
{
DISPID
id
=
0
;
BSTR
name
;
name
=
SysAllocString
(
var
->
identifier
);
if
(
!
name
)
return
E_OUTOFMEMORY
;
if
(
!
ctx
->
is_global
||
!
lookup_global_members
(
parser
->
script
,
name
,
NULL
))
hres
=
jsdisp_get_id
(
ctx
->
var_disp
,
var
->
identifier
,
fdexNameEnsure
,
&
id
);
SysFreeString
(
name
);
if
(
FAILED
(
hres
))
return
hres
;
}
prev_ctx
=
script
->
exec_ctx
;
script
->
exec_ctx
=
ctx
;
prev_parser
=
ctx
->
parser
;
ctx
->
parser
=
parser
;
V_VT
(
&
val
)
=
VT_EMPTY
;
memset
(
&
rt
,
0
,
sizeof
(
rt
));
rt
.
type
=
RT_NORMAL
;
if
(
source
->
statement
)
{
if
(
source
->
statement
->
instr_off
==
-
1
)
hres
=
compile_subscript_stat
(
ctx
->
parser
,
source
->
statement
,
TRUE
,
&
source
->
statement
->
instr_off
);
if
(
SUCCEEDED
(
hres
))
hres
=
compiled_statement_eval
(
script
,
source
->
statement
,
&
rt
,
&
val
);
}
script
->
exec_ctx
=
prev_ctx
;
ctx
->
parser
=
prev_parser
;
if
(
rt
.
type
!=
RT_NORMAL
&&
rt
.
type
!=
RT_RETURN
)
{
FIXME
(
"wrong rt %d
\n
"
,
rt
.
type
);
hres
=
E_FAIL
;
}
*
ei
=
rt
.
ei
;
if
(
FAILED
(
hres
))
{
VariantClear
(
&
val
);
return
hres
;
}
if
(
!
retv
||
(
!
from_eval
&&
rt
.
type
!=
RT_RETURN
))
VariantClear
(
&
val
);
if
(
retv
)
*
retv
=
val
;
return
S_OK
;
}
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