Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fbc: add PROCPTR( UDT.member [, signature] )
- add PROCPTR( UDT.member [, SUB|FUNCTION ...] ) to get a procedure pointer for type member procedures - PROCPTR( UDT.member ) will get the procedure pointer for the first declared member sub, function, constructor, destructor, operator, or property - PROCPTR( UDT.member, signature ) will get the procedure pointer for the member matching the signature For example: type T as single number declare operator cast() as string declare operator cast() as integer end type operator T.cast() as string return str( number ) end operator operator T.cast() as integer return int( number ) end operator dim a as T = (4.5) var tostring = procptr( T.cast ) var tointeger = procptr( T.cast, function() as integer ) print tostring( a ) '' call method through pointer to member print tointeger( a ) '' call method through pointer to member - regardless of the kind of member procedure, the signature must be written as a form of SUB(...) or FUNC(...) AS return_type. - the instance parameter need not be specified since it will be implied from the member. - PROCPTR( UDT.<property>, function(...) ... ) returns a pointer to the get method - PROCPTR( UDT.<property>, sub(...) ) returns a pointer to the set method method
- Loading branch information
Showing
3 changed files
with
811 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.