Bug 162986 - In VBASupport mode, it's possible to close a PROPERTY SET/LET as SUB or FUNCTION
Summary: In VBASupport mode, it's possible to close a PROPERTY SET/LET as SUB or FUNCTION
Status: ASSIGNED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: BASIC (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: All All
: medium normal
Assignee: Degeratu Razvan Andrei
URL:
Whiteboard: target:25.8.0
Keywords: difficultyBeginner, easyHack, skillCpp, topicDebug
Depends on: 162983
Blocks: Macro-VBA
  Show dependency treegraph
 
Reported: 2024-09-16 08:49 UTC by Mike Kaganski
Modified: 2025-07-04 10:16 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mike Kaganski 2024-09-16 08:49:26 UTC
After bug 162983 is fixed, this bug is about this Basic code:

  Option VBASupport 1

  Property Set foo(x)
  End Function

  Function Let bar(x)
  End Sub

This should be two error; both Property Set and Property Let must be terminated with End Property.

However, this code should work:

  Option VBASupport 1

  Property Get foo
  End Function

  Function Get bar
  End Sub

For some strange reason, VBA allows that. And i#109075 (https://bz.apache.org/ooo/show_bug.cgi?id=109075) implemented the support for these latter cases, see SbiParser::Parse (basic/source/comp/parser.cxx). The existing implementation is too forgiving; it must only allow the closing "End Sub/Function" for the Property Get case.

See SbiParser::DefProc (basic/source/comp/dim.cxx), which handles the Get/Set/Let distinction, and calls SbiProcDef::setPropertyMode to store that distinction in the definition. That stored information should be used in SbiParser::Parse to filter out the invalid cases.
Comment 1 Mike Kaganski 2024-09-16 09:31:04 UTC
(In reply to Mike Kaganski from comment #0)
>   Function Let bar(x)
> ...
>   Function Get bar

Typos here; intended to be

  Property Let bar(x)
and
  Property Get bar
Comment 2 Commit Notification 2025-05-13 10:46:41 UTC
Razvan Degeratu committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/7744d3134b0308ea2f2cb87177022269a55fff00

tdf#162986 Restrict ending of Property Let and Set to only End Property

It will be available in 25.8.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 3 Buovjaga 2025-07-04 10:16:47 UTC
Razvan: if this is done, feel free to mark as fixed.