Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
e1970c85
Commit
e1970c85
authored
May 06, 2016
by
Jacek Caban
Committed by
Alexandre Julliard
May 06, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jscript: Properly handle function expressions with identifiers.
Signed-off-by:
Jacek Caban
<
jacek@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
64124815
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
56 additions
and
11 deletions
+56
-11
compile.c
dlls/jscript/compile.c
+4
-11
lang.js
dlls/jscript/tests/lang.js
+52
-0
No files found.
dlls/jscript/compile.c
View file @
e1970c85
...
...
@@ -872,17 +872,11 @@ static HRESULT compile_object_literal(compiler_ctx_t *ctx, property_value_expres
return
S_OK
;
}
static
HRESULT
compile_function_expression
(
compiler_ctx_t
*
ctx
,
function_expression_t
*
expr
)
static
HRESULT
compile_function_expression
(
compiler_ctx_t
*
ctx
,
function_expression_t
*
expr
,
BOOL
emit_ret
)
{
unsigned
func_id
=
ctx
->
func
->
func_cnt
++
;
ctx
->
func_tail
=
ctx
->
func_tail
?
(
ctx
->
func_tail
->
next
=
expr
)
:
(
ctx
->
func_head
=
expr
);
/* FIXME: not exactly right */
if
(
expr
->
identifier
&&
!
expr
->
event_target
)
{
ctx
->
func
->
func_cnt
++
;
return
push_instr_bstr
(
ctx
,
OP_ident
,
expr
->
identifier
);
}
return
push_instr_uint
(
ctx
,
OP_func
,
ctx
->
func
->
func_cnt
++
);
return
emit_ret
?
push_instr_uint
(
ctx
,
OP_func
,
func_id
)
:
S_OK
;
}
static
HRESULT
compile_expression
(
compiler_ctx_t
*
ctx
,
expression_t
*
expr
,
BOOL
emit_ret
)
...
...
@@ -967,8 +961,7 @@ static HRESULT compile_expression(compiler_ctx_t *ctx, expression_t *expr, BOOL
hres
=
compile_binary_expression
(
ctx
,
(
binary_expression_t
*
)
expr
,
OP_eq2
);
break
;
case
EXPR_FUNC
:
hres
=
compile_function_expression
(
ctx
,
(
function_expression_t
*
)
expr
);
break
;
return
compile_function_expression
(
ctx
,
(
function_expression_t
*
)
expr
,
emit_ret
);
case
EXPR_GREATER
:
hres
=
compile_binary_expression
(
ctx
,
(
binary_expression_t
*
)
expr
,
OP_gt
);
break
;
...
...
dlls/jscript/tests/lang.js
View file @
e1970c85
...
...
@@ -232,6 +232,58 @@ testNoRes(), testNoRes();
tmp
=
(
function
(){
return
testNoRes
(),
testRes
();})();
var
f1
,
f2
;
ok
(
funcexpr
()
==
2
,
"funcexpr() = "
+
funcexpr
());
f1
=
function
funcexpr
()
{
return
1
;
}
ok
(
f1
!=
funcexpr
,
"f1 == funcexpr"
);
ok
(
f1
()
===
1
,
"f1() = "
+
f1
());
f2
=
function
funcexpr
()
{
return
2
;
}
ok
(
f2
!=
funcexpr
,
"f2 != funcexpr"
);
ok
(
f2
()
===
2
,
"f2() = "
+
f2
());
f1
=
null
;
for
(
i
=
0
;
i
<
3
;
i
++
)
{
f2
=
function
funcexpr2
()
{};
ok
(
f1
!=
f2
,
"f1 == f2"
);
f1
=
f2
;
}
f1
=
null
;
for
(
i
=
0
;
i
<
3
;
i
++
)
{
f2
=
function
()
{};
ok
(
f1
!=
f2
,
"f1 == f2"
);
f1
=
f2
;
}
(
function
()
{
ok
(
infuncexpr
()
==
2
,
"infuncexpr() = "
+
infuncexpr
());
f1
=
function
infuncexpr
()
{
return
1
;
}
ok
(
f1
!=
funcexpr
,
"f1 == funcexpr"
);
ok
(
f1
()
===
1
,
"f1() = "
+
f1
());
f2
=
function
infuncexpr
()
{
return
2
;
}
ok
(
f2
!=
funcexpr
,
"f2 != funcexpr"
);
ok
(
f2
()
===
2
,
"f2() = "
+
f2
());
f1
=
null
;
for
(
i
=
0
;
i
<
3
;
i
++
)
{
f2
=
function
infuncexpr2
()
{};
ok
(
f1
!=
f2
,
"f1 == f2"
);
f1
=
f2
;
}
f1
=
null
;
for
(
i
=
0
;
i
<
3
;
i
++
)
{
f2
=
function
()
{};
ok
(
f1
!=
f2
,
"f1 == f2"
);
f1
=
f2
;
}
})();
var
obj1
=
new
Object
();
ok
(
typeof
(
obj1
)
===
"object"
,
"typeof(obj1) is not object"
);
ok
(
obj1
.
constructor
===
Object
,
"unexpected obj1.constructor"
);
...
...
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