@@ -1885,9 +1885,6 @@ function symbCheckConstAssignTopLevel _
18851885 dim as integer i = any, lcount = any, rcount = any, rmatches = any
18861886 dim as integer lconst = any, rconst = any
18871887
1888- errmsg = 0
1889- wrnmsg = 0
1890-
18911888 ''
18921889 '' Toplevel const:
18931890 ''
@@ -1925,14 +1922,9 @@ function symbCheckConstAssignTopLevel _
19251922 function = FALSE
19261923 matches = 0
19271924
1928- '' neither is a function pointer?
1929- if ( ( typeGetDtOnly( ldType ) <> FB_DATATYPE_FUNCTION ) and ( typeGetDtOnly( rdType ) <> FB_DATATYPE_FUNCTION ) ) then
1930-
1931- '' no consts? short-circuit
1932- if ( (typeGetConstMask( ldtype ) or typeGetConstMask( rdtype )) = 0 ) then
1933- return TRUE
1934- end if
1935-
1925+ '' no consts? short-circuit
1926+ if ( (typeGetConstMask( ldtype ) or typeGetConstMask( rdtype )) = 0 ) then
1927+ return TRUE
19361928 end if
19371929
19381930 '' vararg? they aren't type safe anyway
@@ -1987,7 +1979,7 @@ function symbCheckConstAssignTopLevel _
19871979 function = TRUE
19881980end function
19891981
1990- function symbCheckConstAssignFuncPtr _
1982+ function hSymbCheckConstAssignFuncPtr _
19911983 ( _
19921984 byval ldtype as FB_DATATYPE, _
19931985 byval rdtype as FB_DATATYPE, _
@@ -2005,19 +1997,12 @@ function symbCheckConstAssignFuncPtr _
20051997
20061998 function = FALSE
20071999
2008- errmsg = FB_ERRMSG_OK '' FB_ERRMSG
2009- wrnmsg = 0 '' FB_WARNINGMSG
20102000
20112001 assert( typeGetDtOnly( ldType ) = FB_DATATYPE_FUNCTION )
20122002 assert( typeGetDtOnly( rdType ) = FB_DATATYPE_FUNCTION )
20132003 assert( symbIsProc( lsubtype ) )
20142004 assert( symbIsProc( rsubtype ) )
20152005
2016- '' not a function pointer?
2017- if ( ( typeGetDtOnly( ldType ) <> FB_DATATYPE_FUNCTION ) or ( typeGetDtOnly( rdType ) <> FB_DATATYPE_FUNCTION ) ) then
2018- exit function
2019- end if
2020-
20212006 '' Return warnings even though some checks are not CONSTness releated. We could
20222007 '' promote them to errors, but that will cause many tests to break, and really, we are
20232008 '' not specifically checking the assignment, but rather the function pointer compatibility.
@@ -2052,11 +2037,6 @@ function symbCheckConstAssignFuncPtr _
20522037 exit function
20532038 end if
20542039
2055- '' check top level
2056- if ( symbCheckConstAssignTopLevel( ldtype, rdtype, lsubtype, rsubtype, mode, matches, errmsg, wrnmsg ) = FALSE ) then
2057- exit function
2058- end if
2059-
20602040 '' Check each parameter
20612041 var lparam = symbGetProcHeadParam( lsubtype )
20622042 var rparam = symbGetProcHeadParam( rsubtype )
@@ -2096,13 +2076,23 @@ function symbCheckConstAssign _
20962076 byref wrnmsg as FB_WARNINGMSG = 0 _
20972077 ) as integer
20982078
2099- '' both types function pointer?
2100- if ( ( typeGetDtOnly( ldType ) = FB_DATATYPE_FUNCTION ) and ( typeGetDtOnly( rdType ) = FB_DATATYPE_FUNCTION ) ) then
2101- return symbCheckConstAssignFuncPtr( ldtype, rdtype, lsubtype, rsubtype, mode, matches, errmsg, wrnmsg )
2102- else
2103- return symbCheckConstAssignTopLevel( ldtype, rdtype, lsubtype, rsubtype, mode, matches, errmsg, wrnmsg )
2079+ dim ret as integer = any
2080+
2081+ errmsg = FB_ERRMSG_OK '' FB_ERRMSG
2082+ wrnmsg = 0 '' FB_WARNINGMSG
2083+
2084+ '' check top-level const
2085+ ret = symbCheckConstAssignTopLevel( ldtype, rdtype, lsubtype, rsubtype, mode, matches, errmsg, wrnmsg )
2086+
2087+ if ( ret ) then
2088+ '' both types function pointer?
2089+ if ( ( typeGetDtOnly( ldType ) = FB_DATATYPE_FUNCTION ) and ( typeGetDtOnly( rdType ) = FB_DATATYPE_FUNCTION ) ) then
2090+ ret and = hSymbCheckConstAssignFuncPtr( ldtype, rdtype, lsubtype, rsubtype, mode, matches, errmsg, wrnmsg )
2091+ end if
21042092 end if
21052093
2094+ function = ret
2095+
21062096end function
21072097
21082098private sub hForEachGlobal _
0 commit comments