Skip to content

Commit

Permalink
fbc: PROCPTR( proc [, signature ] )
Browse files Browse the repository at this point in the history
- don't allow anything but procedures throw an error otherwise
- internal: new use of cIdentifierOrUdtMember() may return a variable type
  since it is less restrictive than the previous use of cIdentifier()

Example:
	type T extends object
		as integer n
		declare sub proc()
	end type

	var p1 = procptr( T.proc )  '' OK
	var p2 = procptr( T.n )     '' error: illegal non-static member access
	dim as T a
	var p3 = procptr( a.proc )  '' error: invalid data types before '.'
  • Loading branch information
jayrm committed Apr 4, 2023
1 parent 5ffbc86 commit 3457e4d
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/compiler/parser-expr-unary.bas
Expand Up @@ -686,6 +686,15 @@ function cAddrOfExpression( ) as ASTNODE ptr
return astNewCONSTi( 0 )
end if

select case symbGetClass( sym )
case FB_SYMBCLASS_PROC
case else
errReport( FB_ERRMSG_INVALIDDATATYPES, TRUE )
'' error recovery: skip until ')' and fake a node
hSkipUntil( CHAR_RPRNT, TRUE )
return astNewCONSTi( 0 )
end select

hCheckEmptyProcParens()

'' ',' ?
Expand Down

0 comments on commit 3457e4d

Please sign in to comment.