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
b13e7ba7
Commit
b13e7ba7
authored
Nov 29, 2023
by
Robert Wilhelm
Committed by
Alexandre Julliard
Nov 30, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vbscript: Sub argument has precedence over global const and local dim.
Wine-Bug:
https://bugs.winehq.org/show_bug.cgi?id=55502
parent
6efee4ba
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
42 additions
and
28 deletions
+42
-28
compile.c
dlls/vbscript/compile.c
+29
-28
lang.vbs
dlls/vbscript/tests/lang.vbs
+13
-0
No files found.
dlls/vbscript/compile.c
View file @
b13e7ba7
...
...
@@ -425,6 +425,30 @@ static expression_t *lookup_const_decls(compile_ctx_t *ctx, const WCHAR *name, B
return
NULL
;
}
static
BOOL
lookup_args_name
(
compile_ctx_t
*
ctx
,
const
WCHAR
*
name
)
{
unsigned
i
;
for
(
i
=
0
;
i
<
ctx
->
func
->
arg_cnt
;
i
++
)
{
if
(
!
wcsicmp
(
ctx
->
func
->
args
[
i
].
name
,
name
))
return
TRUE
;
}
return
FALSE
;
}
static
BOOL
lookup_dim_decls
(
compile_ctx_t
*
ctx
,
const
WCHAR
*
name
)
{
dim_decl_t
*
dim_decl
;
for
(
dim_decl
=
ctx
->
dim_decls
;
dim_decl
;
dim_decl
=
dim_decl
->
next
)
{
if
(
!
wcsicmp
(
dim_decl
->
name
,
name
))
return
TRUE
;
}
return
FALSE
;
}
static
HRESULT
compile_args
(
compile_ctx_t
*
ctx
,
expression_t
*
args
,
unsigned
*
ret
)
{
unsigned
arg_cnt
=
0
;
...
...
@@ -479,10 +503,11 @@ static HRESULT compile_member_expression(compile_ctx_t *ctx, member_expression_t
if
(
expr
->
obj_expr
)
/* FIXME: we should probably have a dedicated opcode as well */
return
compile_member_call_expression
(
ctx
,
expr
,
0
,
TRUE
);
const_expr
=
lookup_const_decls
(
ctx
,
expr
->
identifier
,
TRUE
);
if
(
const_expr
)
return
compile_expression
(
ctx
,
const_expr
);
if
(
!
lookup_dim_decls
(
ctx
,
expr
->
identifier
)
&&
!
lookup_args_name
(
ctx
,
expr
->
identifier
))
{
const_expr
=
lookup_const_decls
(
ctx
,
expr
->
identifier
,
TRUE
);
if
(
const_expr
)
return
compile_expression
(
ctx
,
const_expr
);
}
return
push_instr_bstr
(
ctx
,
OP_ident
,
expr
->
identifier
);
}
...
...
@@ -1104,30 +1129,6 @@ static HRESULT compile_call_statement(compile_ctx_t *ctx, call_statement_t *stat
return
S_OK
;
}
static
BOOL
lookup_dim_decls
(
compile_ctx_t
*
ctx
,
const
WCHAR
*
name
)
{
dim_decl_t
*
dim_decl
;
for
(
dim_decl
=
ctx
->
dim_decls
;
dim_decl
;
dim_decl
=
dim_decl
->
next
)
{
if
(
!
wcsicmp
(
dim_decl
->
name
,
name
))
return
TRUE
;
}
return
FALSE
;
}
static
BOOL
lookup_args_name
(
compile_ctx_t
*
ctx
,
const
WCHAR
*
name
)
{
unsigned
i
;
for
(
i
=
0
;
i
<
ctx
->
func
->
arg_cnt
;
i
++
)
{
if
(
!
wcsicmp
(
ctx
->
func
->
args
[
i
].
name
,
name
))
return
TRUE
;
}
return
FALSE
;
}
static
HRESULT
compile_dim_statement
(
compile_ctx_t
*
ctx
,
dim_statement_t
*
stat
)
{
dim_decl_t
*
dim_decl
=
stat
->
dim_decls
;
...
...
dlls/vbscript/tests/lang.vbs
View file @
b13e7ba7
...
...
@@ -967,6 +967,19 @@ x = false
Call
TestFuncArgVal
(
x
)
Call
ok
(
not
x
,
"x is true after TestFuncArgVal call?"
)
const
c10
=
10
Sub
TestParamvsConst
(
c10
)
Call
ok
(
c10
=
42
,
"precedence between const and parameter wrong!"
)
End
Sub
Call
TestParamvsConst
(
42
)
Sub
TestDimVsConst
dim
c10
c10
=
42
Call
ok
(
c10
=
42
,
"precedence between const and dim is wrong"
)
End
Sub
Call
TestDimVsConst
Function
TestFuncMultiArgs
(
a
,
b
,
c
,
d
,
e
)
Call
ok
(
a
=
1
,
"a = "
&
a
)
Call
ok
(
b
=
2
,
"b = "
&
b
)
...
...
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