[Patch] XML node dump improvements on subroutines
Original Reporter info from Mantis: CuriousKit @CuriousKit
-
Reporter name: J. Gareth Moreton
Original Reporter info from Mantis: CuriousKit @CuriousKit
- Reporter name: J. Gareth Moreton
Description:
The attached patch "node_subs.patch" seeks to address some shortcomings with the current node dumps when it comes to procedure definitions:
- The tag "&LtPos;procedure>" is now "&LtPos;subroutine>" for reasons of clarity (it's not always a procedure).
- If the subroutine is a method, a 'struct' attribute will now be present, listing the relevant class name.
- A 'type' attribute is now present if the subroutine is not a regular procedure or function (appears for constructors, destructors, class constructors, class destructors, class methods, static class methods, unit initialization and finalization blocks and a few other miscellaneous cases that are converted to subroutines during compilation)
- Hidden parameters are now listed (e.g. 'Self').
- If the subroutine returns a value (e.g. because it's a function), an explicit "&LtPos;returndef>" element now appears in the XML file dictating what it is (it is omitted if the subroutine is a procedure or the returndef is otherwise void).
- Additional options are printed for "reintroduce", "virtual", "final", "override" and "overload" directives.
- The &LtPos;code> element is now printed as &LtPos;code /> if the subroutine has no code (e.g. an empty unit inltialization block).
For example, the header "constructor TTestClass.Create(I: Integer)" is dumped as:
&LtPos;subroutine struct="TTestClass" type="constructor" name="constructor Create(&LtPos;TTestClass>;&LtPos;Class Of TTestClass>;LongInt);">
(the angled brackets are written as "<" and ">" inside the string - currently there is no means to remove the word 'constructor' from the start of the method name without modifying the "tprocdef.customprocname" method, which is potentially possible)
Steps to reproduce:
Apply patch and confirm successful compilation and correct output of XML files with -dDEBUG_NODE_XML option.
Additional information:
The "node_static.patch" file adds the 'static' modifier to a couple of internal class methods used for the node printing. This is for reasons of efficiency because while "SanitiseXMLString" and "WritePointer" are class methods for TNode, they don't actually use anything related to the class and are otherwise regular functions. In other words, there's no point in setting up and passing the class-type parameter
Mantis conversion info:
- Mantis ID: 35787
- OS: Microsoft Windows
- OS Build: 10 Professional
- Build: r42309
- Platform: Cross-platform
- Version: 3.3.1
- Fixed in revision: 42318 (#67cf6304)