Issue 109070 - optional param declareda as object: invalid use of an object
Summary: optional param declareda as object: invalid use of an object
Status: ACCEPTED
Alias: None
Product: App Dev
Classification: Unclassified
Component: scripting (show other issues)
Version: 3.3.0 or older (OOo)
Hardware: Unknown All
: P3 Trivial
Target Milestone: ---
Assignee: AOO issues mailing list
QA Contact:
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-02-09 10:24 UTC by Oliver Brinzing
Modified: 2017-05-20 11:27 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Oliver Brinzing 2010-02-09 10:24:00 UTC
declaring an optional param as "object" will cause an error:
"invalid use of an object" - seems the param is not  declared ...

is it a bug or a feature ?

OPTION EXPLICIT

Sub TestCase()

	' ok ...
	MsgBox "1 " & TestParam1(ThisComponent).getName()
	MsgBox "2 " & TestParam2(ThisComponent).getName()
	MsgBox "3 " & TestParam3(ThisComponent).getName()

	' will fail ...
	MsgBox "4 " & TestParam4(ThisComponent).getName()
		
End Sub

Function TestParam1(oDoc as Object, Optional oOptional) as Object
	If IsMissing(oOptional) then
		oOptional = oDoc.getSheets().GetByIndex(0)
	End If
	TestParam1 = oOptional
End Function

Function TestParam2(oDoc as Object, Optional oOptional as Variant) as Object
	If IsMissing(oOptional) then
		oOptional = oDoc.getSheets().GetByIndex(0)
	End If
	TestParam2 = oOptional
End Function

Function TestParam3(oDoc as Object, Optional oOptional as Object) as Object
	If IsMissing(oOptional) then
		Dim oOptional
		oOptional = oDoc.getSheets().GetByIndex(0)
	End If
	TestParam3 = oOptional
End Function

Function TestParam4(oDoc as Object, Optional oOptional as Object) as Object
	If IsMissing(oOptional) then
		oOptional = oDoc.getSheets().GetByIndex(0)
	End If
	TestParam4 = oOptional
End Function
Comment 1 kay.ramme 2010-05-04 07:19:38 UTC
Andreas, please have a look.
Comment 2 ab 2010-05-28 14:04:01 UTC
I tried, but I didn't find anything about this
that could be declared as feature... ;-)

STARTED, 3.x
Comment 3 Marcus 2017-05-20 11:27:36 UTC
Reset assigne to the default "issues@openoffice.apache.org".