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
5c158f1d
Commit
5c158f1d
authored
Dec 20, 2011
by
Jacek Caban
Committed by
Alexandre Julliard
Dec 20, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jscript: Use compiler to handle variable statement.
parent
2a59f016
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
35 additions
and
11 deletions
+35
-11
compile.c
dlls/jscript/compile.c
+25
-0
engine.c
dlls/jscript/engine.c
+8
-9
engine.h
dlls/jscript/engine.h
+1
-1
parser.y
dlls/jscript/parser.y
+1
-1
No files found.
dlls/jscript/compile.c
View file @
5c158f1d
...
...
@@ -841,6 +841,7 @@ static HRESULT compile_expression(compiler_ctx_t *ctx, expression_t *expr)
return
compile_expression_noret
(
ctx
,
expr
,
NULL
);
}
/* ECMA-262 3rd Edition 12.1 */
static
HRESULT
compile_block_statement
(
compiler_ctx_t
*
ctx
,
statement_t
*
iter
)
{
HRESULT
hres
;
...
...
@@ -865,6 +866,28 @@ static HRESULT compile_block_statement(compiler_ctx_t *ctx, statement_t *iter)
return
S_OK
;
}
/* ECMA-262 3rd Edition 12.2 */
static
HRESULT
compile_var_statement
(
compiler_ctx_t
*
ctx
,
var_statement_t
*
stat
)
{
variable_declaration_t
*
iter
;
HRESULT
hres
;
for
(
iter
=
stat
->
variable_list
;
iter
;
iter
=
iter
->
next
)
{
if
(
!
iter
->
expr
)
continue
;
hres
=
compile_expression
(
ctx
,
iter
->
expr
);
if
(
FAILED
(
hres
))
return
hres
;
hres
=
push_instr_bstr
(
ctx
,
OP_var_set
,
iter
->
identifier
);
if
(
FAILED
(
hres
))
return
hres
;
}
return
push_instr
(
ctx
,
OP_undefined
)
==
-
1
?
E_OUTOFMEMORY
:
S_OK
;
}
/* ECMA-262 3rd Edition 12.4 */
static
HRESULT
compile_expression_statement
(
compiler_ctx_t
*
ctx
,
expression_statement_t
*
stat
)
{
...
...
@@ -934,6 +957,8 @@ static HRESULT compile_statement(compiler_ctx_t *ctx, statement_t *stat)
return
compile_expression_statement
(
ctx
,
(
expression_statement_t
*
)
stat
);
case
STAT_IF
:
return
compile_if_statement
(
ctx
,
(
if_statement_t
*
)
stat
);
case
STAT_VAR
:
return
compile_var_statement
(
ctx
,
(
var_statement_t
*
)
stat
);
default:
return
compile_interp_fallback
(
ctx
,
stat
);
}
...
...
dlls/jscript/engine.c
View file @
5c158f1d
...
...
@@ -688,19 +688,18 @@ static HRESULT variable_list_eval(script_ctx_t *ctx, variable_declaration_t *var
}
/* ECMA-262 3rd Edition 12.2 */
HRESULT
var_statement_eval
(
script_ctx_t
*
ctx
,
statement_t
*
_stat
,
return_type_t
*
rt
,
VARIANT
*
ret
)
static
HRESULT
interp_var_set
(
exec_ctx_t
*
ctx
)
{
var_statement_t
*
stat
=
(
var_statement_t
*
)
_stat
;
const
BSTR
name
=
ctx
->
parser
->
code
->
instrs
[
ctx
->
ip
].
arg1
.
bstr
;
VARIANT
*
v
;
HRESULT
hres
;
TRACE
(
"
\n
"
);
hres
=
variable_list_eval
(
ctx
,
stat
->
variable_list
,
&
rt
->
ei
);
if
(
FAILED
(
hres
))
return
hres
;
TRACE
(
"%s
\n
"
,
debugstr_w
(
name
));
V_VT
(
ret
)
=
VT_EMPTY
;
return
S_OK
;
v
=
stack_pop
(
ctx
);
hres
=
jsdisp_propput_name
(
ctx
->
var_disp
,
name
,
v
,
ctx
->
ei
,
NULL
/*FIXME*/
);
VariantClear
(
v
);
return
hres
;
}
/* ECMA-262 3rd Edition 12.6.2 */
...
...
dlls/jscript/engine.h
View file @
5c158f1d
...
...
@@ -104,6 +104,7 @@ typedef struct _func_stack {
X(ret, 0, 0,0) \
X(sub, 1, 0,0) \
X(undefined, 1, 0,0) \
X(var_set, 1, ARG_BSTR, 0) \
X(void, 1, 0,0) \
X(xor, 1, 0,0)
...
...
@@ -398,7 +399,6 @@ typedef struct {
}
try_statement_t
;
HRESULT
compiled_statement_eval
(
script_ctx_t
*
,
statement_t
*
,
return_type_t
*
,
VARIANT
*
)
DECLSPEC_HIDDEN
;
HRESULT
var_statement_eval
(
script_ctx_t
*
,
statement_t
*
,
return_type_t
*
,
VARIANT
*
)
DECLSPEC_HIDDEN
;
HRESULT
while_statement_eval
(
script_ctx_t
*
,
statement_t
*
,
return_type_t
*
,
VARIANT
*
)
DECLSPEC_HIDDEN
;
HRESULT
for_statement_eval
(
script_ctx_t
*
,
statement_t
*
,
return_type_t
*
,
VARIANT
*
)
DECLSPEC_HIDDEN
;
HRESULT
forin_statement_eval
(
script_ctx_t
*
,
statement_t
*
,
return_type_t
*
,
VARIANT
*
)
DECLSPEC_HIDDEN
;
...
...
dlls/jscript/parser.y
View file @
5c158f1d
...
...
@@ -849,7 +849,7 @@ static const statement_eval_t stat_eval_table[] = {
switch_statement_eval,
throw_statement_eval,
try_statement_eval,
var
_statement_eval,
compiled
_statement_eval,
while_statement_eval,
with_statement_eval
};
...
...
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