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
662efe83
Commit
662efe83
authored
Aug 29, 2009
by
Jacek Caban
Committed by
Alexandre Julliard
Aug 29, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jscript: Create arguments object as a seaprated class inheriting from Object.
parent
2a457fb7
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
61 additions
and
19 deletions
+61
-19
function.c
dlls/jscript/function.c
+49
-17
jscript.h
dlls/jscript/jscript.h
+3
-1
object.c
dlls/jscript/object.c
+1
-1
api.js
dlls/jscript/tests/api.js
+2
-0
lang.js
dlls/jscript/tests/lang.js
+6
-0
No files found.
dlls/jscript/function.c
View file @
662efe83
...
...
@@ -85,22 +85,58 @@ static HRESULT init_parameters(DispatchEx *var_disp, FunctionInstance *function,
return
S_OK
;
}
static
HRESULT
init_arguments
(
DispatchEx
*
arg_disp
,
FunctionInstance
*
function
,
LCID
lcid
,
DISPPARAMS
*
dp
,
jsexcept_t
*
ei
,
IServiceProvider
*
caller
)
HRESULT
Arguments_value
(
DispatchEx
*
dispex
,
LCID
lcid
,
WORD
flags
,
DISPPARAMS
*
dp
,
VARIANT
*
retv
,
jsexcept_t
*
ei
,
IServiceProvider
*
caller
)
{
FIXME
(
"
\n
"
);
return
E_NOTIMPL
;
}
static
const
builtin_info_t
Arguments_info
=
{
JSCLASS_ARGUMENTS
,
{
NULL
,
Arguments_value
,
0
},
0
,
NULL
,
NULL
,
NULL
};
static
HRESULT
create_arguments
(
script_ctx_t
*
ctx
,
LCID
lcid
,
DISPPARAMS
*
dp
,
jsexcept_t
*
ei
,
IServiceProvider
*
caller
,
DispatchEx
**
ret
)
{
DispatchEx
*
args
;
VARIANT
var
;
DWORD
i
;
HRESULT
hres
;
for
(
i
=
0
;
i
<
dp
->
cArgs
-
dp
->
cNamedArgs
;
i
++
)
{
hres
=
jsdisp_propput_idx
(
arg_disp
,
i
,
lcid
,
dp
->
rgvarg
+
dp
->
cArgs
-
1
-
i
,
ei
,
caller
);
args
=
heap_alloc_zero
(
sizeof
(
DispatchEx
));
if
(
!
args
)
return
E_OUTOFMEMORY
;
hres
=
init_dispex_from_constr
(
args
,
ctx
,
&
Arguments_info
,
ctx
->
object_constr
);
if
(
FAILED
(
hres
))
{
heap_free
(
args
);
return
hres
;
}
for
(
i
=
0
;
i
<
arg_cnt
(
dp
);
i
++
)
{
hres
=
jsdisp_propput_idx
(
args
,
i
,
lcid
,
get_arg
(
dp
,
i
),
ei
,
caller
);
if
(
FAILED
(
hres
))
return
hres
;
break
;
}
V_VT
(
&
var
)
=
VT_I4
;
V_I4
(
&
var
)
=
dp
->
cArgs
-
dp
->
cNamedArgs
;
return
jsdisp_propput_name
(
arg_disp
,
lengthW
,
lcid
,
&
var
,
ei
,
caller
);
if
(
SUCCEEDED
(
hres
))
{
V_VT
(
&
var
)
=
VT_I4
;
V_I4
(
&
var
)
=
arg_cnt
(
dp
);
hres
=
jsdisp_propput_name
(
args
,
lengthW
,
lcid
,
&
var
,
ei
,
caller
);
}
if
(
FAILED
(
hres
))
{
jsdisp_release
(
args
);
return
hres
;
}
*
ret
=
args
;
return
S_OK
;
}
static
HRESULT
create_var_disp
(
FunctionInstance
*
function
,
LCID
lcid
,
DISPPARAMS
*
dp
,
jsexcept_t
*
ei
,
...
...
@@ -115,17 +151,13 @@ static HRESULT create_var_disp(FunctionInstance *function, LCID lcid, DISPPARAMS
if
(
FAILED
(
hres
))
return
hres
;
hres
=
create_
dispex
(
function
->
dispex
.
ctx
,
NULL
,
NULL
,
&
arg_disp
);
hres
=
create_
arguments
(
function
->
dispex
.
ctx
,
lcid
,
dp
,
ei
,
caller
,
&
arg_disp
);
if
(
SUCCEEDED
(
hres
))
{
hres
=
init_arguments
(
arg_disp
,
function
,
lcid
,
dp
,
ei
,
caller
);
if
(
SUCCEEDED
(
hres
))
{
VARIANT
var
;
V_VT
(
&
var
)
=
VT_DISPATCH
;
V_DISPATCH
(
&
var
)
=
(
IDispatch
*
)
_IDispatchEx_
(
arg_disp
);
hres
=
jsdisp_propput_name
(
var_disp
,
argumentsW
,
lcid
,
&
var
,
ei
,
caller
);
}
VARIANT
var
;
V_VT
(
&
var
)
=
VT_DISPATCH
;
V_DISPATCH
(
&
var
)
=
(
IDispatch
*
)
_IDispatchEx_
(
arg_disp
);
hres
=
jsdisp_propput_name
(
var_disp
,
argumentsW
,
lcid
,
&
var
,
ei
,
caller
);
jsdisp_release
(
arg_disp
);
}
...
...
dlls/jscript/jscript.h
View file @
662efe83
...
...
@@ -69,6 +69,7 @@ extern HINSTANCE jscript_hinstance;
#define PROPF_ENUM 0x0200
#define PROPF_CONSTR 0x0400
/* NOTE: Keep in sync with names in Object.toString implementation */
typedef
enum
{
JSCLASS_NONE
,
JSCLASS_ARRAY
,
...
...
@@ -81,7 +82,8 @@ typedef enum {
JSCLASS_NUMBER
,
JSCLASS_OBJECT
,
JSCLASS_REGEXP
,
JSCLASS_STRING
JSCLASS_STRING
,
JSCLASS_ARGUMENTS
}
jsclass_t
;
typedef
HRESULT
(
*
builtin_invoke_t
)(
DispatchEx
*
,
LCID
,
WORD
,
DISPPARAMS
*
,
VARIANT
*
,
jsexcept_t
*
,
IServiceProvider
*
);
...
...
dlls/jscript/object.c
View file @
662efe83
...
...
@@ -49,7 +49,7 @@ static HRESULT Object_toString(DispatchEx *dispex, LCID lcid, WORD flags, DISPPA
static
const
WCHAR
stringW
[]
=
{
'S'
,
't'
,
'r'
,
'i'
,
'n'
,
'g'
,
0
};
/* Keep in sync with jsclass_t enum */
static
const
WCHAR
*
names
[]
=
{
NULL
,
arrayW
,
booleanW
,
dateW
,
errorW
,
functionW
,
NULL
,
mathW
,
numberW
,
objectW
,
regexpW
,
stringW
};
functionW
,
NULL
,
mathW
,
numberW
,
objectW
,
regexpW
,
stringW
,
objectW
};
TRACE
(
"
\n
"
);
...
...
dlls/jscript/tests/api.js
View file @
662efe83
...
...
@@ -1422,6 +1422,8 @@ testObjectInherit(new Error(), Error, false, true, true);
testObjectInherit
(
testObjectInherit
,
Function
,
false
,
true
,
true
);
testObjectInherit
(
Math
,
Object
,
true
,
true
,
true
);
(
function
()
{
testObjectInherit
(
arguments
,
Object
,
true
,
true
,
true
);
})();
function
testFunctions
(
obj
,
arr
)
{
var
l
;
...
...
dlls/jscript/tests/lang.js
View file @
662efe83
...
...
@@ -811,6 +811,12 @@ ok((1 instanceof Object) === false, "1 is instance of Object");
ok
((
false
instanceof
Boolean
)
===
false
,
"false is instance of Boolean"
);
ok
((
""
instanceof
Object
)
===
false
,
"'' is instance of Object"
);
(
function
()
{
ok
((
arguments
instanceof
Object
)
===
true
,
"argument is not instance of Object"
);
ok
((
arguments
instanceof
Array
)
===
false
,
"argument is not instance of Array"
);
ok
(
arguments
.
toString
()
===
"[object Object]"
,
"arguments.toString() = "
+
arguments
.
toString
());
})(
1
,
2
);
ok
(
isNaN
(
NaN
)
===
true
,
"isNaN(NaN) !== true"
);
ok
(
isNaN
(
0.5
)
===
false
,
"isNaN(0.5) !== false"
);
ok
(
isNaN
(
Infinity
)
===
false
,
"isNaN(Infinity) !== false"
);
...
...
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