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
45053135
Commit
45053135
authored
Nov 10, 2022
by
Nikolay Sivov
Committed by
Alexandre Julliard
Nov 11, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vbscript: Add support for argument list in ReDim.
Wine-Bug:
https://bugs.winehq.org/show_bug.cgi?id=53782
parent
82182a11
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
82 additions
and
10 deletions
+82
-10
compile.c
dlls/vbscript/compile.c
+9
-2
parse.h
dlls/vbscript/parse.h
+7
-2
parser.y
dlls/vbscript/parser.y
+28
-6
lang.vbs
dlls/vbscript/tests/lang.vbs
+38
-0
No files found.
dlls/vbscript/compile.c
View file @
45053135
...
...
@@ -1165,20 +1165,27 @@ static HRESULT compile_dim_statement(compile_ctx_t *ctx, dim_statement_t *stat)
static
HRESULT
compile_redim_statement
(
compile_ctx_t
*
ctx
,
redim_statement_t
*
stat
)
{
redim_decl_t
*
decl
=
stat
->
redim_decls
;
unsigned
arg_cnt
;
HRESULT
hres
;
hres
=
compile_args
(
ctx
,
stat
->
dims
,
&
arg_cnt
);
while
(
1
)
{
hres
=
compile_args
(
ctx
,
decl
->
dims
,
&
arg_cnt
);
if
(
FAILED
(
hres
))
return
hres
;
hres
=
push_instr_bstr_uint
(
ctx
,
stat
->
preserve
?
OP_redim_preserve
:
OP_redim
,
stat
->
identifier
,
arg_cnt
);
hres
=
push_instr_bstr_uint
(
ctx
,
stat
->
preserve
?
OP_redim_preserve
:
OP_redim
,
decl
->
identifier
,
arg_cnt
);
if
(
FAILED
(
hres
))
return
hres
;
if
(
!
emit_catch
(
ctx
,
0
))
return
E_OUTOFMEMORY
;
if
(
!
decl
->
next
)
break
;
decl
=
decl
->
next
;
}
return
S_OK
;
}
...
...
dlls/vbscript/parse.h
View file @
45053135
...
...
@@ -172,11 +172,16 @@ typedef struct _dim_statement_t {
dim_decl_t
*
dim_decls
;
}
dim_statement_t
;
typedef
struct
_redim_decl_t
{
const
WCHAR
*
identifier
;
expression_t
*
dims
;
struct
_redim_decl_t
*
next
;
}
redim_decl_t
;
typedef
struct
{
statement_t
stat
;
const
WCHAR
*
identifier
;
BOOL
preserve
;
expression_t
*
dim
s
;
redim_decl_t
*
redim_decl
s
;
}
redim_statement_t
;
typedef
struct
_arg_decl_t
{
...
...
dlls/vbscript/parser.y
View file @
45053135
...
...
@@ -51,7 +51,7 @@ static statement_t *new_call_statement(parser_ctx_t*,unsigned,expression_t*);
static statement_t *new_assign_statement(parser_ctx_t*,unsigned,expression_t*,expression_t*);
static statement_t *new_set_statement(parser_ctx_t*,unsigned,expression_t*,expression_t*);
static statement_t *new_dim_statement(parser_ctx_t*,unsigned,dim_decl_t*);
static statement_t *new_redim_statement(parser_ctx_t*,unsigned,
const WCHAR*,BOOL,expression
_t*);
static statement_t *new_redim_statement(parser_ctx_t*,unsigned,
BOOL,redim_decl
_t*);
static statement_t *new_while_statement(parser_ctx_t*,unsigned,statement_type_t,expression_t*,statement_t*);
static statement_t *new_forto_statement(parser_ctx_t*,unsigned,const WCHAR*,expression_t*,expression_t*,expression_t*,statement_t*);
static statement_t *new_foreach_statement(parser_ctx_t*,unsigned,const WCHAR*,expression_t*,statement_t*);
...
...
@@ -64,6 +64,7 @@ static statement_t *new_with_statement(parser_ctx_t*,unsigned,expression_t*,stat
static dim_decl_t *new_dim_decl(parser_ctx_t*,const WCHAR*,BOOL,dim_list_t*);
static dim_list_t *new_dim(parser_ctx_t*,unsigned,dim_list_t*);
static redim_decl_t *new_redim_decl(parser_ctx_t*,const WCHAR*,expression_t*);
static elseif_decl_t *new_elseif_decl(parser_ctx_t*,unsigned,expression_t*,statement_t*);
static function_decl_t *new_function_decl(parser_ctx_t*,const WCHAR*,function_type_t,unsigned,arg_decl_t*,statement_t*);
static arg_decl_t *new_argument_decl(parser_ctx_t*,const WCHAR*,BOOL);
...
...
@@ -100,6 +101,7 @@ static statement_t *link_statements(statement_t*,statement_t*);
elseif_decl_t *elseif;
dim_decl_t *dim_decl;
dim_list_t *dim_list;
redim_decl_t *redim_decl;
function_decl_t *func_decl;
arg_decl_t *arg_decl;
class_decl_t *class_decl;
...
...
@@ -150,6 +152,7 @@ static statement_t *link_statements(statement_t*,statement_t*);
%type <uint> Storage Storage_opt IntegerValue
%type <dim_decl> DimDeclList DimDecl
%type <dim_list> DimList
%type <redim_decl> ReDimDeclList ReDimDecl
%type <const_decl> ConstDecl ConstDeclList
%type <string> Identifier
%type <case_clausule> CaseClausules
...
...
@@ -209,8 +212,7 @@ SimpleStatement
| CallExpression '=' Expression
{ $$ = new_assign_statement(ctx, @$, $1, $3); CHECK_ERROR; }
| tDIM DimDeclList { $$ = new_dim_statement(ctx, @$, $2); CHECK_ERROR; }
| tREDIM Preserve_opt tIdentifier '(' ArgumentList ')'
{ $$ = new_redim_statement(ctx, @$, $3, $2, $5); CHECK_ERROR; }
| tREDIM Preserve_opt ReDimDeclList { $$ = new_redim_statement(ctx, @$, $2, $3); CHECK_ERROR; }
| IfStatement { $$ = $1; }
| tWHILE Expression StSep StatementsNl_opt tWEND
{ $$ = new_while_statement(ctx, @$, STAT_WHILE, $2, $4); CHECK_ERROR; }
...
...
@@ -251,6 +253,13 @@ Preserve_opt
: /* empty */ { $$ = FALSE; }
| tPRESERVE { $$ = TRUE; }
ReDimDecl
: tIdentifier '(' ArgumentList ')' { $$ = new_redim_decl(ctx, $1, $3); CHECK_ERROR; }
ReDimDeclList
: ReDimDecl { $$ = $1; }
| ReDimDecl ',' ReDimDeclList { $1->next = $3; $$ = $1; }
DimDeclList
: DimDecl { $$ = $1; }
| DimDecl ',' DimDeclList { $1->next = $3; $$ = $1; }
...
...
@@ -846,7 +855,21 @@ static statement_t *new_dim_statement(parser_ctx_t *ctx, unsigned loc, dim_decl_
return &stat->stat;
}
static statement_t *new_redim_statement(parser_ctx_t *ctx, unsigned loc, const WCHAR *identifier, BOOL preserve, expression_t *dims)
static redim_decl_t *new_redim_decl(parser_ctx_t *ctx, const WCHAR *identifier, expression_t *dims)
{
redim_decl_t *decl;
decl = parser_alloc(ctx, sizeof(*decl));
if(!decl)
return NULL;
decl->identifier = identifier;
decl->dims = dims;
decl->next = NULL;
return decl;
}
static statement_t *new_redim_statement(parser_ctx_t *ctx, unsigned loc, BOOL preserve, redim_decl_t *decls)
{
redim_statement_t *stat;
...
...
@@ -854,9 +877,8 @@ static statement_t *new_redim_statement(parser_ctx_t *ctx, unsigned loc, const W
if(!stat)
return NULL;
stat->identifier = identifier;
stat->preserve = preserve;
stat->
dims = dim
s;
stat->
redim_decls = decl
s;
return &stat->stat;
}
...
...
dlls/vbscript/tests/lang.vbs
View file @
45053135
...
...
@@ -1503,6 +1503,44 @@ e = err.number
on
error
goto
0
todo_wine_ok
e
=
10
,
"e = "
&
e
sub
TestReDimList
dim
x
,
y
x
=
Array
(
1
)
y
=
Array
(
1
)
redim
x
(
1
,
3
),
y
(
2
)
ok
ubound
(
x
,
1
)
=
1
,
"ubound(x, 1) = "
&
ubound
(
x
,
1
)
ok
ubound
(
x
,
2
)
=
3
,
"ubound(x, 2) = "
&
ubound
(
x
,
2
)
ok
ubound
(
y
,
1
)
=
2
,
"ubound(y, 1) = "
&
ubound
(
y
,
1
)
x
(
0
,
0
)
=
1.1
x
(
0
,
1
)
=
1.2
x
(
0
,
2
)
=
1.3
x
(
0
,
3
)
=
1.4
x
(
1
,
0
)
=
2.1
x
(
1
,
1
)
=
2.2
x
(
1
,
2
)
=
2.3
x
(
1
,
3
)
=
2.4
y
(
0
)
=
2.1
y
(
1
)
=
2.2
y
(
2
)
=
2.3
redim
preserve
x
(
1
,
1
),
y
(
3
)
ok
ubound
(
x
,
1
)
=
1
,
"ubound(x, 1) = "
&
ubound
(
x
,
1
)
ok
ubound
(
x
,
2
)
=
1
,
"ubound(x, 2) = "
&
ubound
(
x
,
2
)
ok
x
(
0
,
0
)
=
1.1
,
"x(0,0) = "
&
x
(
0
,
0
)
ok
x
(
0
,
1
)
=
1.2
,
"x(0,1) = "
&
x
(
0
,
1
)
ok
x
(
1
,
0
)
=
2.1
,
"x(1,0) = "
&
x
(
1
,
0
)
ok
x
(
1
,
1
)
=
2.2
,
"x(1,1) = "
&
x
(
1
,
1
)
ok
ubound
(
y
,
1
)
=
3
,
"ubound(y, 1) = "
&
ubound
(
y
,
1
)
ok
y
(
0
)
=
2.1
,
"y(0) = "
&
y
(
0
)
ok
y
(
1
)
=
2.2
,
"y(1) = "
&
y
(
1
)
ok
y
(
2
)
=
2.3
,
"y(2) = "
&
y
(
2
)
ok
y
(
3
)
=
vbEmpty
,
"y(3) = "
&
y
(
3
)
end
sub
call
TestReDimList
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