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
393f740b
Commit
393f740b
authored
Nov 22, 2022
by
Jason Millard
Committed by
Alexandre Julliard
Nov 22, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vbscript: Add support for redim byref.
parent
1429d211
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
46 additions
and
9 deletions
+46
-9
interp.c
dlls/vbscript/interp.c
+24
-9
lang.vbs
dlls/vbscript/tests/lang.vbs
+22
-0
No files found.
dlls/vbscript/interp.c
View file @
393f740b
...
...
@@ -1283,6 +1283,7 @@ static HRESULT interp_redim(exec_ctx_t *ctx)
{
BSTR
identifier
=
ctx
->
instr
->
arg1
.
bstr
;
const
unsigned
dim_cnt
=
ctx
->
instr
->
arg2
.
uint
;
VARIANT
*
v
;
SAFEARRAYBOUND
*
bounds
;
SAFEARRAY
*
array
;
ref_t
ref
;
...
...
@@ -1312,9 +1313,16 @@ static HRESULT interp_redim(exec_ctx_t *ctx)
/* FIXME: We should check if we're not modifying an existing static array here */
VariantClear
(
ref
.
u
.
v
);
V_VT
(
ref
.
u
.
v
)
=
VT_ARRAY
|
VT_VARIANT
;
V_ARRAY
(
ref
.
u
.
v
)
=
array
;
v
=
ref
.
u
.
v
;
if
(
V_VT
(
v
)
==
(
VT_VARIANT
|
VT_BYREF
))
{
v
=
V_VARIANTREF
(
v
);
}
VariantClear
(
v
);
V_VT
(
v
)
=
VT_ARRAY
|
VT_VARIANT
;
V_ARRAY
(
v
)
=
array
;
return
S_OK
;
}
...
...
@@ -1323,6 +1331,7 @@ static HRESULT interp_redim_preserve(exec_ctx_t *ctx)
BSTR
identifier
=
ctx
->
instr
->
arg1
.
bstr
;
const
unsigned
dim_cnt
=
ctx
->
instr
->
arg2
.
uint
;
unsigned
i
;
VARIANT
*
v
;
SAFEARRAYBOUND
*
bounds
;
SAFEARRAY
*
array
;
ref_t
ref
;
...
...
@@ -1341,12 +1350,18 @@ static HRESULT interp_redim_preserve(exec_ctx_t *ctx)
return
E_FAIL
;
}
if
(
!
(
V_VT
(
ref
.
u
.
v
)
&
VT_ARRAY
))
{
FIXME
(
"ReDim Preserve not valid on type %d
\n
"
,
V_VT
(
ref
.
u
.
v
));
v
=
ref
.
u
.
v
;
if
(
V_VT
(
v
)
==
(
VT_VARIANT
|
VT_BYREF
))
{
v
=
V_VARIANTREF
(
v
);
}
if
(
!
(
V_VT
(
v
)
&
VT_ARRAY
))
{
FIXME
(
"ReDim Preserve not valid on type %d
\n
"
,
V_VT
(
v
));
return
E_FAIL
;
}
array
=
V_ARRAY
(
ref
.
u
.
v
);
array
=
V_ARRAY
(
v
);
hres
=
array_bounds_from_stack
(
ctx
,
dim_cnt
,
&
bounds
);
if
(
FAILED
(
hres
))
...
...
@@ -1355,9 +1370,9 @@ static HRESULT interp_redim_preserve(exec_ctx_t *ctx)
if
(
array
==
NULL
||
array
->
cDims
==
0
)
{
/* can initially allocate the array */
array
=
SafeArrayCreate
(
VT_VARIANT
,
dim_cnt
,
bounds
);
VariantClear
(
ref
.
u
.
v
);
V_VT
(
ref
.
u
.
v
)
=
VT_ARRAY
|
VT_VARIANT
;
V_ARRAY
(
ref
.
u
.
v
)
=
array
;
VariantClear
(
v
);
V_VT
(
v
)
=
VT_ARRAY
|
VT_VARIANT
;
V_ARRAY
(
v
)
=
array
;
return
S_OK
;
}
else
if
(
array
->
cDims
!=
dim_cnt
)
{
/* can't otherwise change the number of dimensions */
...
...
dlls/vbscript/tests/lang.vbs
View file @
393f740b
...
...
@@ -1562,6 +1562,28 @@ sub TestReDimList
end
sub
call
TestReDimList
dim
rx
(
4
)
sub
TestReDimByRef
(
byref
x
)
ok
ubound
(
x
)
=
4
,
"ubound(x) = "
&
ubound
(
x
)
redim
x
(
6
)
ok
ubound
(
x
)
=
6
,
"ubound(x) = "
&
ubound
(
x
)
end
sub
call
TestReDimByRef
(
rx
)
ok
ubound
(
rx
)
=
6
,
"ubound(rx) = "
&
ubound
(
rx
)
redim
rx
(
5
)
rx
(
3
)
=
2
sub
TestReDimPreserveByRef
(
byref
x
)
ok
ubound
(
x
)
=
5
,
"ubound(x) = "
&
ubound
(
x
)
ok
x
(
3
)
=
2
,
"x(3) = "
&
x
(
3
)
redim
preserve
x
(
7
)
ok
ubound
(
x
)
=
7
,
"ubound(x) = "
&
ubound
(
x
)
ok
x
(
3
)
=
2
,
"x(3) = "
&
x
(
3
)
end
sub
call
TestReDimPreserveByRef
(
rx
)
ok
ubound
(
rx
)
=
7
,
"ubound(rx) = "
&
ubound
(
rx
)
ok
rx
(
3
)
=
2
,
"rx(3) = "
&
rx
(
3
)
Class
ArrClass
Dim
classarr
(
3
)
Dim
classnoarr
()
...
...
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