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
5e07e0cf
Commit
5e07e0cf
authored
Sep 19, 2008
by
Jacek Caban
Committed by
Alexandre Julliard
Sep 19, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jscript: Added function constructor object.
parent
4778c069
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
57 additions
and
6 deletions
+57
-6
function.c
dlls/jscript/function.c
+42
-4
global.c
dlls/jscript/global.c
+7
-2
jscript.h
dlls/jscript/jscript.h
+2
-0
lang.js
dlls/jscript/tests/lang.js
+6
-0
No files found.
dlls/jscript/function.c
View file @
5e07e0cf
...
...
@@ -369,7 +369,21 @@ static const builtin_info_t Function_info = {
NULL
};
static
HRESULT
create_function
(
script_ctx_t
*
ctx
,
DWORD
flags
,
DispatchEx
*
prototype
,
FunctionInstance
**
ret
)
static
HRESULT
FunctionConstr_value
(
DispatchEx
*
dispex
,
LCID
lcid
,
WORD
flags
,
DISPPARAMS
*
dp
,
VARIANT
*
retv
,
jsexcept_t
*
ei
,
IServiceProvider
*
sp
)
{
FIXME
(
"
\n
"
);
return
E_NOTIMPL
;
}
static
HRESULT
FunctionProt_value
(
DispatchEx
*
dispex
,
LCID
lcid
,
WORD
flags
,
DISPPARAMS
*
dp
,
VARIANT
*
retv
,
jsexcept_t
*
ei
,
IServiceProvider
*
sp
)
{
FIXME
(
"
\n
"
);
return
E_NOTIMPL
;
}
static
HRESULT
create_function
(
script_ctx_t
*
ctx
,
DWORD
flags
,
BOOL
funcprot
,
DispatchEx
*
prototype
,
FunctionInstance
**
ret
)
{
FunctionInstance
*
function
;
HRESULT
hres
;
...
...
@@ -378,7 +392,10 @@ static HRESULT create_function(script_ctx_t *ctx, DWORD flags, DispatchEx *proto
if
(
!
function
)
return
E_OUTOFMEMORY
;
hres
=
init_dispex
(
&
function
->
dispex
,
ctx
,
&
Function_info
,
NULL
);
if
(
funcprot
)
hres
=
init_dispex
(
&
function
->
dispex
,
ctx
,
&
Function_info
,
prototype
);
else
hres
=
init_dispex_from_constr
(
&
function
->
dispex
,
ctx
,
&
Function_info
,
ctx
->
function_constr
);
if
(
FAILED
(
hres
))
return
hres
;
...
...
@@ -410,7 +427,7 @@ HRESULT create_builtin_function(script_ctx_t *ctx, builtin_invoke_t value_proc,
FunctionInstance
*
function
;
HRESULT
hres
;
hres
=
create_function
(
ctx
,
flags
,
prototype
,
&
function
);
hres
=
create_function
(
ctx
,
flags
,
FALSE
,
prototype
,
&
function
);
if
(
FAILED
(
hres
))
return
hres
;
...
...
@@ -433,7 +450,7 @@ HRESULT create_source_function(parser_ctx_t *ctx, parameter_t *parameters, sourc
if
(
FAILED
(
hres
))
return
hres
;
hres
=
create_function
(
ctx
->
script
,
PROPF_CONSTR
,
prototype
,
&
function
);
hres
=
create_function
(
ctx
->
script
,
PROPF_CONSTR
,
FALSE
,
prototype
,
&
function
);
jsdisp_release
(
prototype
);
if
(
FAILED
(
hres
))
return
hres
;
...
...
@@ -456,3 +473,24 @@ HRESULT create_source_function(parser_ctx_t *ctx, parameter_t *parameters, sourc
*
ret
=
&
function
->
dispex
;
return
S_OK
;
}
HRESULT
init_function_constr
(
script_ctx_t
*
ctx
)
{
FunctionInstance
*
prot
,
*
constr
;
HRESULT
hres
;
hres
=
create_function
(
ctx
,
PROPF_CONSTR
,
TRUE
,
NULL
,
&
prot
);
if
(
FAILED
(
hres
))
return
hres
;
prot
->
value_proc
=
FunctionProt_value
;
hres
=
create_function
(
ctx
,
PROPF_CONSTR
,
TRUE
,
&
prot
->
dispex
,
&
constr
);
jsdisp_release
(
&
prot
->
dispex
);
if
(
FAILED
(
hres
))
return
hres
;
constr
->
value_proc
=
FunctionConstr_value
;
ctx
->
function_constr
=
&
constr
->
dispex
;
return
hres
;
}
dlls/jscript/global.c
View file @
5e07e0cf
...
...
@@ -106,8 +106,9 @@ static HRESULT JSGlobal_Date(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARA
static
HRESULT
JSGlobal_Function
(
DispatchEx
*
dispex
,
LCID
lcid
,
WORD
flags
,
DISPPARAMS
*
dp
,
VARIANT
*
retv
,
jsexcept_t
*
ei
,
IServiceProvider
*
sp
)
{
FIXME
(
"
\n
"
);
return
E_NOTIMPL
;
TRACE
(
"
\n
"
);
return
constructor_call
(
dispex
->
ctx
->
function_constr
,
lcid
,
flags
,
dp
,
retv
,
ei
,
sp
);
}
static
HRESULT
JSGlobal_Number
(
DispatchEx
*
dispex
,
LCID
lcid
,
WORD
flags
,
DISPPARAMS
*
dp
,
...
...
@@ -332,6 +333,10 @@ static HRESULT init_constructors(script_ctx_t *ctx)
{
HRESULT
hres
;
hres
=
init_function_constr
(
ctx
);
if
(
FAILED
(
hres
))
return
hres
;
hres
=
create_array_constr
(
ctx
,
&
ctx
->
array_constr
);
if
(
FAILED
(
hres
))
return
hres
;
...
...
dlls/jscript/jscript.h
View file @
5e07e0cf
...
...
@@ -165,6 +165,7 @@ struct _script_ctx_t {
DispatchEx
*
script_disp
;
DispatchEx
*
global
;
DispatchEx
*
function_constr
;
DispatchEx
*
array_constr
;
DispatchEx
*
bool_constr
;
DispatchEx
*
number_constr
;
...
...
@@ -181,6 +182,7 @@ static inline void script_addref(script_ctx_t *ctx)
}
HRESULT
init_global
(
script_ctx_t
*
);
HRESULT
init_function_constr
(
script_ctx_t
*
);
HRESULT
create_array_constr
(
script_ctx_t
*
,
DispatchEx
**
);
HRESULT
create_bool_constr
(
script_ctx_t
*
,
DispatchEx
**
);
...
...
dlls/jscript/tests/lang.js
View file @
5e07e0cf
...
...
@@ -79,6 +79,12 @@ ok(Number.prototype !== undefined, "Number.prototype is undefined");
ok
(
RegExp
.
prototype
!==
undefined
,
"RegExp.prototype is undefined"
);
ok
(
Math
!==
undefined
,
"Math is undefined"
);
ok
(
Math
.
prototype
===
undefined
,
"Math.prototype is not undefined"
);
ok
(
Function
.
prototype
!==
undefined
,
"Function.prototype is undefined"
);
ok
(
Function
.
prototype
.
prototype
===
undefined
,
"Function.prototype is not undefined"
);
Function
.
prototype
.
test
=
true
;
ok
(
testFunc1
.
test
===
true
,
"testFunc1.test !== true"
);
ok
(
Function
.
test
===
true
,
"Function.test !== true"
);
ok
(
typeof
(
0
)
===
"number"
,
"typeof(0) is not number"
);
ok
(
typeof
(
1.5
)
===
"number"
,
"typeof(1.5) is not number"
);
...
...
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