https://bugs.freedesktop.org/show_bug.cgi?id=59327
Priority: medium
Bug ID: 59327
Assignee: [email protected]
Summary: BASIC: A missing optional argument is treated as a not
declared variable.
Severity: normal
Classification: Unclassified
OS: Linux (All)
Reporter: [email protected]
Hardware: Other
Whiteboard: BSA
Status: UNCONFIRMED
Version: 3.5.4 release
Component: BASIC
Product: LibreOffice
Created attachment 72968
--> https://bugs.freedesktop.org/attachment.cgi?id=72968&action=edit
A code example to reproduce the bug.
Problem description: A missing optional argument is treated as a not declared
variable.
Steps to reproduce:
See a code example below.
--------------------
Option Explicit
Private Sub Do__Error__Optional_argument_is_not_a_variable__Error(Optional
ByVal anArgument)
Dim aVariable as Single
If False Then Dim anArgument as Boolean
aVariable=anArgument ' This line produces an error 12, if "option
explicit' is used.
aVariable=-456 ' This line is executed only if "option
explicit' is NOT used.
End Sub 'Do__Error__Optional_argument_is_not_a_variable__Error
Private Sub Do__Error__Optional_argument_is_not_a_variable__Success(Optional
ByVal anArgument)
Dim aVariable as Single
'If False Then Dim anArgument as Boolean
aVariable=anArgument
aVariable=-456
End Sub 'Do__Error__Optional_argument_is_not_a_variable__Success
Sub Error__Optional_argument_is_not_a_variable
Do__Error__Optional_argument_is_not_a_variable__Success anArgument:=-123
' This call never produces an error.
MsgBox "1: +"
Do__Error__Optional_argument_is_not_a_variable__Error anArgument:=-123 '
This call produces an error 12, if "option explicit' is used.
MsgBox "2: +"
End Sub 'Error__Optional_argument_is_not_a_variable
--------------------
Current behavior:
An error 12 occurs.
Expected behavior:
No error occurs.
Operating System: Ubuntu
Version: 3.5.4 release
--
You are receiving this mail because:
You are the assignee for the bug.
_______________________________________________
Libreoffice-bugs mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs