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
67684c48
Commit
67684c48
authored
Sep 10, 2008
by
Jacek Caban
Committed by
Alexandre Julliard
Sep 10, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jscript: Added typeof expression implementation.
parent
083c9544
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
80 additions
and
3 deletions
+80
-3
engine.c
dlls/jscript/engine.c
+67
-3
lang.js
dlls/jscript/tests/lang.js
+13
-0
No files found.
dlls/jscript/engine.c
View file @
67684c48
...
...
@@ -959,10 +959,74 @@ HRESULT void_expression_eval(exec_ctx_t *ctx, expression_t *expr, DWORD flags, j
return
E_NOTIMPL
;
}
HRESULT
typeof_expression_eval
(
exec_ctx_t
*
ctx
,
expression_t
*
expr
,
DWORD
flags
,
jsexcept_t
*
ei
,
exprval_t
*
ret
)
HRESULT
typeof_expression_eval
(
exec_ctx_t
*
ctx
,
expression_t
*
_
expr
,
DWORD
flags
,
jsexcept_t
*
ei
,
exprval_t
*
ret
)
{
FIXME
(
"
\n
"
);
return
E_NOTIMPL
;
unary_expression_t
*
expr
=
(
unary_expression_t
*
)
_expr
;
const
WCHAR
*
str
;
exprval_t
exprval
;
VARIANT
val
;
HRESULT
hres
;
static
const
WCHAR
booleanW
[]
=
{
'b'
,
'o'
,
'o'
,
'l'
,
'e'
,
'a'
,
'n'
,
0
};
static
const
WCHAR
functionW
[]
=
{
'f'
,
'u'
,
'n'
,
'c'
,
't'
,
'i'
,
'o'
,
'n'
,
0
};
static
const
WCHAR
numberW
[]
=
{
'n'
,
'u'
,
'm'
,
'b'
,
'e'
,
'r'
,
0
};
static
const
WCHAR
objectW
[]
=
{
'o'
,
'b'
,
'j'
,
'e'
,
'c'
,
't'
,
0
};
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
;
hres
=
exprval_to_value
(
ctx
->
parser
->
script
,
&
exprval
,
ei
,
&
val
);
exprval_release
(
&
exprval
);
if
(
FAILED
(
hres
))
return
hres
;
switch
(
V_VT
(
&
val
))
{
case
VT_EMPTY
:
str
=
undefinedW
;
break
;
case
VT_NULL
:
str
=
objectW
;
break
;
case
VT_BOOL
:
str
=
booleanW
;
break
;
case
VT_I4
:
case
VT_R8
:
str
=
numberW
;
break
;
case
VT_BSTR
:
str
=
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
));
}
else
{
str
=
objectW
;
}
break
;
}
default:
FIXME
(
"unhandled vt %d
\n
"
,
V_VT
(
&
val
));
hres
=
E_NOTIMPL
;
}
VariantClear
(
&
val
);
if
(
FAILED
(
hres
))
return
hres
;
ret
->
type
=
EXPRVAL_VARIANT
;
V_VT
(
&
ret
->
u
.
var
)
=
VT_BSTR
;
V_BSTR
(
&
ret
->
u
.
var
)
=
SysAllocString
(
str
);
return
S_OK
;
}
HRESULT
minus_expression_eval
(
exec_ctx_t
*
ctx
,
expression_t
*
expr
,
DWORD
flags
,
jsexcept_t
*
ei
,
exprval_t
*
ret
)
...
...
dlls/jscript/tests/lang.js
View file @
67684c48
...
...
@@ -56,4 +56,17 @@ ok(RegExp.prototype !== undefined, "RegExp.prototype is undefined");
ok
(
Math
!==
undefined
,
"Math is undefined"
);
ok
(
Math
.
prototype
===
undefined
,
"Math.prototype is not undefined"
);
ok
(
typeof
(
0
)
===
"number"
,
"typeof(0) is not number"
);
ok
(
typeof
(
1.5
)
===
"number"
,
"typeof(1.5) is not number"
);
ok
(
typeof
(
"abc"
)
===
"string"
,
"typeof(
\"
abc
\"
) is not string"
);
ok
(
typeof
(
""
)
===
"string"
,
"typeof(
\"\"
) is not string"
);
ok
(
typeof
(
true
)
===
"boolean"
,
"typeof(true) is not boolean"
);
ok
(
typeof
(
null
)
===
"object"
,
"typeof(null) is not object"
);
ok
(
typeof
(
undefined
)
===
"undefined"
,
"typeof(undefined) is not undefined"
);
ok
(
typeof
(
Math
)
===
"object"
,
"typeof(Math) is not object"
);
ok
(
typeof
(
String
.
prototype
)
===
"object"
,
"typeof(String.prototype) is not object"
);
ok
(
typeof
(
testFunc1
)
===
"function"
,
"typeof(testFunc1) is not function"
);
ok
(
typeof
(
String
)
===
"function"
,
"typeof(String) is not function"
);
ok
(
typeof
(
ScriptEngine
)
===
"function"
,
"typeof(ScriptEngine) is not function"
);
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