I experienced a (for us) serious bug in the macrocompiler. When I call a method with three parameters by reference an error occurs. This causes crashes in several scripts (VOSCRIPT) that run in the production environment of our customers.
Here is an example which shows the problem:
Code: Select all
FUNCTION Start() AS VOID STRICT
PRIVATE oa
PRIVATE ca
PRIVATE cb
PRIVATE cc
LOCAL cCmd AS STRING
TRY
oa := a{}
? "Direct call 2 parameters:"
ca := ""
cb := NULL_DATE
oa:CallByRef2(@ca,@cb,@cc)
? ca
? cb
?
? "Direct call 3 parameters:"
ca := ""
cb := NULL_DATE
cc := NULL_DATE
oa:CallByRef3(@ca,@cb,@cc)
? ca
? cb
? cc
?
? "Indirect call 2 parameters:"
ca := ""
cb := NULL_DATE
cCmd := "oa:CallByRef2(@ca,@cb)"
eval(&("{||"+cCmd+"}"))
? ca
? cb
?
? "Indirect call 3 parameters, third by value:"
ca := ""
cb := NULL_DATE
cc := NULL_DATE
cCmd := "oa:CallByRef3a(@ca,@cb,cc)"
eval(&("{||"+cCmd+"}"))
? ca
? cb
? cc
?
? "Indirect call 3 parameters, third by ref:"
ca := ""
cb := NULL_DATE
cc := NULL_DATE
cCmd := "oa:CallByRef3(@ca,@cb,@cc)"
eval(&("{||"+cCmd+"}"))
? ca
? cb
? cc
?
CATCH e AS exception
? e:Message
END TRY
WAIT
RETURN
CLASS a
METHOD CallByRef2(a REF STRING,b REF DATE) AS LOGIC
LOCAL lOk AS LOGIC
a := "OK"
b := Today()
lOk := TRUE
RETURN lOk
METHOD CallByRef3(a REF STRING,b REF DATE,c REF DATE) AS LOGIC
LOCAL lOk AS LOGIC
a := "OK"
b := Today()
c := Today()+1
lOk := TRUE
RETURN lOk
METHOD CallByRef3a(a REF STRING,b REF DATE,c AS DATE) AS LOGIC
LOCAL lOk AS LOGIC
a := "OK"
b := Today()
c := Today()+1
lOk := TRUE
RETURN lOk
END CLASS
Direct call 2 parameters:
OK
20.03.2024
Direct call 3 parameters:
OK
20.03.2024
21.03.2024
Indirect call 2 parameters:
OK
20.03.2024
Indirect call 3 parameters, third by value:
OK
20.03.2024
. .
Indirect call 3 parameters, third by ref:
Die Liste hatte eine feste Größe.
Press any key to continue...
TIA Karl