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
9c18f6ef
Commit
9c18f6ef
authored
Aug 27, 2009
by
Jacek Caban
Committed by
Alexandre Julliard
Aug 27, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jscript: Return "undefined" type for invalid references.
parent
a4acd1b3
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
40 additions
and
21 deletions
+40
-21
engine.c
dlls/jscript/engine.c
+38
-21
lang.js
dlls/jscript/tests/lang.js
+2
-0
No files found.
dlls/jscript/engine.c
View file @
9c18f6ef
...
...
@@ -2228,11 +2228,8 @@ HRESULT void_expression_eval(exec_ctx_t *ctx, expression_t *_expr, DWORD flags,
}
/* ECMA-262 3rd Edition 11.4.3 */
HRESULT
typeof_expression_eval
(
exec_ctx_t
*
ctx
,
expression_t
*
_expr
,
DWORD
flags
,
jsexcept_t
*
ei
,
exprval_t
*
ret
)
static
HRESULT
typeof_exprval
(
exec_ctx_t
*
ctx
,
exprval_t
*
exprval
,
jsexcept_t
*
ei
,
const
WCHAR
*
*
ret
)
{
unary_expression_t
*
expr
=
(
unary_expression_t
*
)
_expr
;
const
WCHAR
*
str
;
exprval_t
exprval
;
VARIANT
val
;
HRESULT
hres
;
...
...
@@ -2243,57 +2240,77 @@ HRESULT typeof_expression_eval(exec_ctx_t *ctx, expression_t *_expr, DWORD flags
static
const
WCHAR
stringW
[]
=
{
's'
,
't'
,
'r'
,
'i'
,
'n'
,
'g'
,
0
};
static
const
WCHAR
undefinedW
[]
=
{
'u'
,
'n'
,
'd'
,
'e'
,
'f'
,
'i'
,
'n'
,
'e'
,
'd'
,
0
};
TRACE
(
"
\n
"
);
hres
=
expr_eval
(
ctx
,
expr
->
expression
,
0
,
ei
,
&
exprval
);
if
(
FAILED
(
hres
))
return
hres
;
if
(
exprval
->
type
==
EXPRVAL_INVALID
)
{
*
ret
=
undefinedW
;
return
S_OK
;
}
hres
=
exprval_to_value
(
ctx
->
parser
->
script
,
&
exprval
,
ei
,
&
val
);
exprval_release
(
&
exprval
);
hres
=
exprval_to_value
(
ctx
->
parser
->
script
,
exprval
,
ei
,
&
val
);
if
(
FAILED
(
hres
))
return
hres
;
switch
(
V_VT
(
&
val
))
{
case
VT_EMPTY
:
str
=
undefinedW
;
*
ret
=
undefinedW
;
break
;
case
VT_NULL
:
str
=
objectW
;
*
ret
=
objectW
;
break
;
case
VT_BOOL
:
str
=
booleanW
;
*
ret
=
booleanW
;
break
;
case
VT_I4
:
case
VT_R8
:
str
=
numberW
;
*
ret
=
numberW
;
break
;
case
VT_BSTR
:
str
=
stringW
;
*
ret
=
stringW
;
break
;
case
VT_DISPATCH
:
{
DispatchEx
*
dispex
;
dispex
=
iface_to_jsdisp
((
IUnknown
*
)
V_DISPATCH
(
&
val
));
if
(
dispex
)
{
str
=
dispex
->
builtin_info
->
class
==
JSCLASS_FUNCTION
?
functionW
:
objectW
;
IDispatchEx_Release
(
_IDispatchEx_
(
dispex
)
);
*
ret
=
is_class
(
dispex
,
JSCLASS_FUNCTION
)
?
functionW
:
objectW
;
jsdisp_release
(
dispex
);
}
else
{
str
=
objectW
;
*
ret
=
objectW
;
}
break
;
}
default:
FIXME
(
"unhandled vt %d
\n
"
,
V_VT
(
&
val
));
VariantClear
(
&
val
);
return
E_NOTIMPL
;
hres
=
E_NOTIMPL
;
}
VariantClear
(
&
val
);
return
S_OK
;
}
HRESULT
typeof_expression_eval
(
exec_ctx_t
*
ctx
,
expression_t
*
_expr
,
DWORD
flags
,
jsexcept_t
*
ei
,
exprval_t
*
ret
)
{
unary_expression_t
*
expr
=
(
unary_expression_t
*
)
_expr
;
const
WCHAR
*
str
=
NULL
;
exprval_t
exprval
;
HRESULT
hres
;
TRACE
(
"
\n
"
);
hres
=
expr_eval
(
ctx
,
expr
->
expression
,
0
,
ei
,
&
exprval
);
if
(
FAILED
(
hres
))
return
hres
;
hres
=
typeof_exprval
(
ctx
,
&
exprval
,
ei
,
&
str
);
exprval_release
(
&
exprval
);
if
(
FAILED
(
hres
))
return
hres
;
ret
->
type
=
EXPRVAL_VARIANT
;
V_VT
(
&
ret
->
u
.
var
)
=
VT_BSTR
;
V_BSTR
(
&
ret
->
u
.
var
)
=
SysAllocString
(
str
);
if
(
!
V_BSTR
(
&
ret
->
u
.
var
))
return
E_OUTOFMEMORY
;
return
S_OK
;
}
...
...
dlls/jscript/tests/lang.js
View file @
9c18f6ef
...
...
@@ -905,4 +905,6 @@ function do_test() {}
function
nosemicolon
()
{}
nosemicolon
();
function
()
{}
nosemicolon
();
ok
(
typeof
(
doesnotexist
)
===
"undefined"
,
"typeof(doesnotexist) = "
+
typeof
(
doesnotexist
));
reportSuccess
();
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