14 static as zstring * FB_MAXNAMELEN+1 aliasid
23 if(
len( aliasid ) > 0 )
then
36 dim as zstring ptr libname =
any
44 if(
len( *libname ) > 0 )
then
59 byval parent as FBSYMBOL
ptr, _
60 byref attrib
as integer _
64 if(
hMatch( FB_TK_STATIC ) )
then
65 attrib
or= FB_SYMBATTRIB_STATIC
71 if(
hMatch( FB_TK_CONST ) )
then
72 attrib
or= FB_SYMBATTRIB_CONST
78 attrib
or= FB_SYMBATTRIB_VIRTUAL
or FB_SYMBATTRIB_ABSTRACT
83 if( symbGetHasRTTI(
parent ) = FALSE )
then
84 errReport( FB_ERRMSG_ABSTRACTWITHOUTRTTI )
85 attrib
and=
not (FB_SYMBATTRIB_VIRTUAL
or FB_SYMBATTRIB_ABSTRACT)
92 attrib
or= FB_SYMBATTRIB_VIRTUAL
96 if( symbGetHasRTTI(
parent ) = FALSE )
then
98 attrib
and=
not FB_SYMBATTRIB_VIRTUAL
111 byval proc as FBSYMBOL
ptr, _
112 byval argnum
as integer, _
123 byval proto
as FBSYMBOL
ptr, _
124 byval proc as FBSYMBOL
ptr, _
125 byval palias
as zstring ptr, _
126 byval proc_dtype
as integer, _
127 byval proc_subtype
as FBSYMBOL
ptr, _
128 byval mode
as integer _
131 dim as FBSYMBOL
ptr param =
any, proto_param =
any
132 dim as integer params =
any, proto_params =
any, i =
any
137 if( (palias <> NULL)
and ((proto->stats
and FB_SYMBSTATS_HASALIAS) <> 0) )
then
138 if( *palias <> *proto->id.
alias )
then
139 errReportEx( FB_ERRMSG_DIFFERENTALIASTHANPROTO,
"""" + *palias +
"""" )
145 param = symbGetProcHeadParam(
proc )
146 params = symbGetProcParams(
proc )
147 if( symbIsMethod(
proc ) )
then
152 proto_param = symbGetProcHeadParam( proto )
153 proto_params = symbGetProcParams( proto )
154 if( symbIsMethod( proto ) )
then
156 proto_param = proto_param->
next
159 if( proto_params <> params )
then
160 errReport( FB_ERRMSG_ARGCNTMISMATCH, TRUE )
166 if( symbGetFullType( proto ) <> proc_dtype )
then
167 errReport( FB_ERRMSG_TYPEMISMATCH, TRUE )
173 if( symbGetSubtype( proto ) <> proc_subtype )
then
174 errReport( FB_ERRMSG_TYPEMISMATCH, TRUE )
180 if(
proc->
proc.returnMethod <> FB_RETURN_DEFAULT)
and _
181 ( proto->
proc.returnMethod <>
proc->
proc.returnMethod )
then
186 if( symbGetProcMode( proto ) <> mode )
then
187 errReport( FB_ERRMSG_ILLEGALPARAMSPEC, TRUE )
193 dim as integer dtype = symbGetFullType( proto_param )
196 if( typeGet( dtype ) = FB_DATATYPE_VOID )
then
197 proto_param->typ = param->typ
198 proto_param->subtype = param->subtype
202 if( param->typ <> dtype )
then
207 elseif( param->subtype <> symbGetSubtype( proto_param ) )
then
215 if( param->param.mode <> symbGetParamMode( proto_param ) )
then
222 if( param->param.mode <> FB_PARAMMODE_VARARG )
then
228 if( symbIsSuffixed( param ) )
then
229 symbGetAttrib( proto_param )
or= FB_SYMBATTRIB_SUFFIXED
231 symbGetAttrib( proto_param )
and =
not FB_SYMBATTRIB_SUFFIXED
237 if( symbGetIsOptional( proto_param )
and symbGetIsOptional( param ) )
then
245 proto_param = proto_param->
next
256 byval proto
as FBSYMBOL
ptr, _
257 byval attrib
as FB_SYMBATTRIB _
261 if( ((attrib
and FB_SYMBATTRIB_RETURNSBYREF) <> 0) <> symbProcReturnsByref( proto ) )
then
262 errReport( FB_ERRMSG_TYPEMISMATCH, TRUE )
265 if( symbProcReturnsByref( proto ) )
then
266 attrib
or= FB_SYMBATTRIB_RETURNSBYREF
268 attrib
and=
not FB_SYMBATTRIB_RETURNSBYREF
273 if( (attrib
and FB_SYMBATTRIB_STATIC)
and (
not symbIsStatic( proto )) )
then
274 errReport( FB_ERRMSG_PROCPROTOTYPENOTSTATIC )
278 if( (attrib
and FB_SYMBATTRIB_CONST)
and (
not symbIsConstant( proto )) )
then
279 errReport( FB_ERRMSG_PROCPROTOTYPENOTCONST )
283 if( (attrib
and FB_SYMBATTRIB_ABSTRACT)
and (
not symbIsAbstract( proto )) )
then
284 errReport( FB_ERRMSG_PROCPROTOTYPENOTABSTRACT )
286 elseif( (attrib
and FB_SYMBATTRIB_VIRTUAL)
and (
not symbIsVirtual( proto )) )
then
287 errReport( FB_ERRMSG_PROCPROTOTYPENOTVIRTUAL )
290 symbGetAttrib( proto )
or= attrib
298 case FB_TKCLASS_IDENTIFIER
299 if( fbLangOptIsSet( FB_LANG_OPT_PERIODS ) )
then
301 if( symbIsGlobalNamespc( ) = FALSE )
then
302 if( lexGetPeriodPos( ) > 0 )
then
303 errReport( FB_ERRMSG_CANTINCLUDEPERIODS )
308 case FB_TKCLASS_QUIRKWD
309 if( env.clopt.lang <> FB_LANG_QB )
then
311 if( (
not has_parent)
or (parser.
scope > FB_MAINSCOPE) )
then
317 case FB_TKCLASS_KEYWORD, FB_TKCLASS_OPERATOR
318 if( env.clopt.lang <> FB_LANG_QB )
then
324 errReport( FB_ERRMSG_EXPECTEDIDENTIFIER )
333 byval parent as FBSYMBOL
ptr, _
334 byval id
as zstring ptr, _
335 byval dtype
as integer ptr, _
336 byval is_sub
as integer _
339 dim as FBSYMCHAIN
ptr chain_ =
any
340 dim as FBSYMBOL
ptr sym =
any
347 chain_ = lexGetSymChain( )
364 *dtype = FB_DATATYPE_INVALID
370 *dtype = lexGetType( )
374 if( *dtype <> FB_DATATYPE_INVALID )
then
376 *dtype = FB_DATATYPE_INVALID
381 hCheckSuffix( *dtype )
391 byval attrib
as integer, _
392 byval proc as FBSYMBOL
ptr, _
393 byval is_proto
as integer, _
394 byref dtype
as integer, _
395 byref subtype
as FBSYMBOL
ptr _
398 dim as integer options =
any
403 options = FB_SYMBTYPEOPT_DEFAULT
406 if( attrib
and FB_SYMBATTRIB_RETURNSBYREF )
then
409 options
or= FB_SYMBTYPEOPT_ALLOWFORWARD
413 options
and=
not FB_SYMBTYPEOPT_CHECKSTRPTR
416 if(
cSymbolType( dtype, subtype, 0, options ) = FALSE )
then
417 errReport( FB_ERRMSG_EXPECTEDIDENTIFIER )
419 dtype = FB_DATATYPE_INTEGER
423 select case( typeGetDtAndPtrOnly( dtype ) )
424 case FB_DATATYPE_FIXSTR, FB_DATATYPE_CHAR, FB_DATATYPE_WCHAR
426 if( ((attrib
and FB_SYMBATTRIB_RETURNSBYREF) = 0)
or _
427 (typeGetDtAndPtrOnly( dtype ) = FB_DATATYPE_FIXSTR) )
then
428 errReport( FB_ERRMSG_CANNOTRETURNFIXLENFROMFUNCTS )
430 dtype = FB_DATATYPE_STRING
434 case FB_DATATYPE_VOID
440 dtype = typeAddrOf( dtype )
444 if( (attrib
and FB_SYMBATTRIB_RETURNSBYREF) = 0 )
then
456 byref attrib
as FB_SYMBATTRIB, _
457 byval stats
as FB_SYMBSTATS, _
458 byref priority
as integer _
466 if( (stats
and (FB_SYMBSTATS_GLOBALCTOR
or FB_SYMBSTATS_GLOBALDTOR)) = 0 )
then
471 elseif( lexGetType( ) <> FB_DATATYPE_INTEGER )
then
477 if priority < 101
or priority > 65535
then
491 attrib
or= FB_SYMBATTRIB_STATICLOCALS
497 if( (stats
and (FB_SYMBSTATS_GLOBALCTOR
or FB_SYMBSTATS_GLOBALDTOR)) <> 0 )
then
505 if( (attrib
and FB_SYMBATTRIB_PRIVATE) > 0 )
then
508 attrib
and=
not FB_SYMBATTRIB_PRIVATE
517 attrib
or= FB_SYMBATTRIB_EXPORT
or FB_SYMBATTRIB_PUBLIC
524 dim as string returnMethod
526 function = FB_RETURN_DEFAULT
529 if( typeGetClass( dtype ) <> FB_DATACLASS_FPOINT )
then exit function
537 returnMethod =
trim(
ucase( *
lexGetText( ) ) )
538 if( returnMethod =
"SSE" )
then
539 function = FB_RETURN_SSE
540 elseif( returnMethod =
"FPU" )
then
541 function = FB_RETURN_FPU
551 if( default = FB_FUNCMODE_FBCALL )
then
552 default = env.target.fbcall
558 function = FB_FUNCMODE_CDECL
564 function = env.target.
stdcall
568 function = FB_FUNCMODE_PASCAL
572 select case as const parser.mangling
573 case FB_MANGLING_BASIC
576 case FB_MANGLING_CDECL, FB_MANGLING_CPP
577 function = FB_FUNCMODE_CDECL
579 case FB_MANGLING_STDCALL
582 function = env.target.
stdcall
584 case FB_MANGLING_STDCALL_MS
585 function = FB_FUNCMODE_STDCALL_MS
593 attrib
or= FB_SYMBATTRIB_NAKED
608 if(
ucase( *
lexGetText( ) ) =
"OVERRIDE" )
then
619 if( is_func = FALSE )
then
623 attrib
or= FB_SYMBATTRIB_RETURNSBYREF
629 byref attrib
as integer, _
630 byval attr
as integer, _
631 byval errmsg
as integer _
634 if( attrib
and attr )
then
643 byval parent as FBSYMBOL
ptr, _
644 byval op as integer, _
645 byval proc as FBSYMBOL
ptr _
648 dim as integer found_mismatch =
any
649 dim as integer is_method = symbIsMethod(
proc )
653 if( symbGetParamMode( param ) = FB_PARAMMODE_VARARG )
then
659 if( symbGetIsOptional( param ) )
then
668 dim as integer min_params =
any, max_params =
any
669 select case as const astGetOpClass(
op )
670 case AST_NODECLASS_UOP, AST_NODECLASS_ADDROF
671 min_params =
iif( astGetOpIsSelf(
op ), 0, 1 )
672 max_params = min_params
674 case AST_NODECLASS_CONV
676 max_params = min_params
678 case AST_NODECLASS_ASSIGN, AST_NODECLASS_MEM
680 max_params = min_params
682 case AST_NODECLASS_COMP
684 if( astGetOpIsSelf(
op ) )
then
688 if(
op = AST_OP_NEXT )
then
694 max_params = min_params
699 min_params =
iif( astGetOpIsSelf(
op ), 1, 2 )
700 max_params = min_params
703 dim as integer params = symbGetProcParams(
proc )
704 dim as integer real_params = params -
iif( is_method, 1, 0 )
705 if( (real_params < min_params)
or (real_params > max_params) )
then
706 errReport( FB_ERRMSG_ARGCNTMISMATCH, TRUE )
710 if( params > 0 )
then
712 dim as FBSYMBOL
ptr param = symbGetProcHeadParam(
proc )
716 select case as const astGetOpClass(
op )
718 case AST_NODECLASS_UOP, AST_NODECLASS_CONV, AST_NODECLASS_ADDROF
720 select case symbGetType( param )
721 case FB_DATATYPE_STRUCT, FB_DATATYPE_ENUM
729 case AST_NODECLASS_BOP
730 if( params > 1 )
then
731 dim as FBSYMBOL
ptr nxtparam = param->
next
736 select case symbGetType( param )
737 case FB_DATATYPE_STRUCT, FB_DATATYPE_ENUM
741 select case symbGetType( nxtparam )
742 case FB_DATATYPE_STRUCT, FB_DATATYPE_ENUM
752 case AST_NODECLASS_MEM
754 case AST_OP_NEW_SELF, AST_OP_NEW_VEC_SELF
756 if( typeGetClass( symbGetType( param ) ) = FB_DATACLASS_INTEGER )
then
757 dim as integer is_integer = TRUE
758 if( typeIsPtr( symbGetType( param ) ) )
then
761 select case symbGetType( param )
762 case FB_DATATYPE_CHAR, FB_DATATYPE_WCHAR
765 if( is_integer = FALSE )
then
776 if( typeGetClass( symbGetType( param ) ) = FB_DATACLASS_INTEGER )
then
777 if( typeIsPtr( symbGetType( param ) ) = FALSE )
then
789 case AST_NODECLASS_COMP
790 select case as const op
792 case AST_OP_EQ, AST_OP_NE, AST_OP_GT, AST_OP_LT, AST_OP_GE, AST_OP_LE
793 if( params > 1 )
then
794 dim as FBSYMBOL
ptr nxtparam = param->
next
799 select case symbGetType( param )
800 case FB_DATATYPE_STRUCT, FB_DATATYPE_ENUM
804 select case symbGetType( nxtparam )
805 case FB_DATATYPE_STRUCT, FB_DATATYPE_ENUM
815 case AST_OP_FOR, AST_OP_STEP, AST_OP_NEXT
816 if( astGetOpIsSelf(
op ) )
then
817 if( params > 1 )
then
824 if( (param = NULL)
or (
parent = NULL) )
then
832 if( (symbGetType( param ) <> symbGetType(
parent ))
or _
833 (symbGetSubtype( param ) <>
parent) )
then
846 found_mismatch = FALSE
848 select case astGetOpClass(
op )
849 case AST_NODECLASS_CONV
852 errReport( FB_ERRMSG_SAMEPARAMANDRESULTTYPES, TRUE )
857 found_mismatch = (symbGetType(
proc ) = FB_DATATYPE_VOID)
860 case AST_NODECLASS_UOP
862 found_mismatch = (symbGetType(
proc ) = FB_DATATYPE_VOID)
865 case AST_NODECLASS_ASSIGN
867 found_mismatch = (symbGetType(
proc ) <> FB_DATATYPE_VOID)
870 case AST_NODECLASS_ADDROF
874 found_mismatch =
not typeIsPtr( symbGetType(
proc ) )
878 found_mismatch = (symbGetType(
proc ) <> FB_DATATYPE_STRUCT)
881 assert(
op = AST_OP_DEREF )
883 found_mismatch = (symbGetType(
proc ) = FB_DATATYPE_VOID)
888 case AST_NODECLASS_MEM
890 case AST_OP_NEW_SELF, AST_OP_NEW_VEC_SELF
892 found_mismatch =
not typeIsPtr( symbGetType(
proc ) )
896 found_mismatch = (symbGetType(
proc ) <> FB_DATATYPE_VOID)
900 case AST_NODECLASS_BOP
901 select case as const op
903 case AST_OP_EQ, AST_OP_NE, AST_OP_GT, AST_OP_LT, AST_OP_GE, AST_OP_LE
904 found_mismatch = (symbGetType(
proc ) <> FB_DATATYPE_INTEGER)
907 found_mismatch = (symbGetType(
proc ) = FB_DATATYPE_VOID)
910 if( astGetOpIsSelf(
op ) )
then
911 found_mismatch = (symbGetType(
proc ) <> FB_DATATYPE_VOID)
914 found_mismatch = (symbGetType(
proc ) = FB_DATATYPE_VOID)
918 case AST_NODECLASS_COMP
920 if( astGetOpIsSelf(
op ) )
then
922 if(
op = AST_OP_NEXT )
then
923 found_mismatch = (symbGetType(
proc ) <> FB_DATATYPE_INTEGER)
925 found_mismatch = (symbGetType(
proc ) <> FB_DATATYPE_VOID)
929 found_mismatch = (symbGetType(
proc ) = FB_DATATYPE_VOID)
934 if( found_mismatch )
then
935 errReport( FB_ERRMSG_INVALIDRESULTTYPEFORTHISOP, TRUE )
944 byval parent as FBSYMBOL
ptr, _
945 byval proc as FBSYMBOL
ptr, _
946 byval options
as integer _
951 dim as FBSYMBOL
ptr param = symbGetProcHeadParam(
proc )
954 if( options
and FB_PROCOPT_ISPROTO )
then
958 if( param = NULL )
then
963 if( symbGetType( param ) <> FB_DATATYPE_STRUCT )
then
968 if( symbGetSubtype( param ) <>
parent )
then
973 if( symbGetParamMode( param ) <> FB_PARAMMODE_BYVAL )
then
978 if( typeGetClass( symbGetType( param ) ) = FB_DATACLASS_INTEGER )
then
979 if( typeIsPtr( symbGetType( param ) ) )
then
986 while( param <> NULL )
987 if( symbGetIsOptional( param ) = FALSE )
then
999 byval proc as FBSYMBOL
ptr, _
1000 byval is_get
as integer _
1003 dim as integer min_params =
any, max_params =
any, i =
any
1004 dim as FBSYMBOL
ptr param =
any
1014 if ((symbGetProcParams(
proc ) < 1 + min_params)
or _
1015 (symbGetProcParams(
proc ) > 1 + max_params))
then
1017 FB_ERRMSG_PARAMCNTFORPROPGET, _
1018 FB_ERRMSG_PARAMCNTFORPROPSET ), TRUE )
1022 param = symbGetProcHeadParam(
proc )
1025 if( symbGetIsOptional( param ) )
then
1036 byval parent as FBSYMBOL
ptr, _
1037 byval is_indexed
as integer, _
1038 byval is_get
as integer _
1041 if( is_indexed )
then
1042 if( is_get = FALSE )
then
1043 symbSetUDTHasIdxSetProp(
parent )
1045 symbSetUDTHasIdxGetProp(
parent )
1048 if( is_get = FALSE )
then
1049 symbSetUDTHasSetProp(
parent )
1051 symbSetUDTHasGetProp(
parent )
1063 byval attrib
as FB_SYMBATTRIB, _
1064 byref is_nested
as integer, _
1065 byval options
as FB_PROCOPT, _
1066 byval tk
as integer _
1069 #define CREATEFAKE( ) _
1071 attrib, mode, FB_SYMBOPT_DECLARING )
1073 static as zstring * FB_MAXNAMELEN+1 id
1074 dim as zstring ptr palias =
any
1075 dim as FBSYMBOL
ptr head_proc =
any,
proc =
any,
parent =
any, subtype =
any
1076 dim as FBSYMBOL
ptr param =
any
1077 dim as integer dtype =
any, is_outside =
any, is_memberproc =
any
1078 dim as integer mode =
any, stats =
any,
op =
any, is_get =
any, is_indexed =
any
1079 dim as integer priority =
any, idopt =
any
1083 is_memberproc = FALSE
1086 dtype = FB_DATATYPE_INVALID
1091 case FB_TK_CONSTRUCTOR, FB_TK_DESTRUCTOR
1093 attrib
or= FB_SYMBATTRIB_METHOD
1097 if( tk = FB_TK_CONSTRUCTOR )
then
1098 attrib
or= FB_SYMBATTRIB_CONSTRUCTOR
or FB_SYMBATTRIB_OVERLOADED
1100 attrib
or= FB_SYMBATTRIB_DESTRUCTOR
1105 attrib
or= FB_SYMBATTRIB_OPERATOR
or FB_SYMBATTRIB_OVERLOADED
1109 attrib
or= FB_SYMBATTRIB_PROPERTY
or FB_SYMBATTRIB_METHOD
or _
1110 FB_SYMBATTRIB_OVERLOADED
1116 if( options
and FB_PROCOPT_HASPARENT )
then
1121 idopt = FB_IDOPT_ISDECL
or FB_IDOPT_SHOWERROR
or FB_IDOPT_ALLOWSTRUCT
1124 idopt
or= FB_IDOPT_ISOPERATOR
1125 case FB_TK_CONSTRUCTOR, FB_TK_DESTRUCTOR
1126 idopt
or= FB_IDOPT_DONTCHKPERIOD
1136 if( options
and FB_PROCOPT_ISPROTO )
then
1150 if( symbGetCurrentNamespc( ) <> @symbGetGlobalNamespc( ) )
then
1151 parent = symbGetCurrentNamespc( )
1157 is_memberproc = symbIsStruct(
parent )
1160 if( is_memberproc )
then
1164 if( ((options
and FB_PROCOPT_ISPROTO) <> 0)
and _
1165 ((attrib
and FB_SYMBATTRIB_STATIC) = 0) )
then
1166 attrib
or= FB_SYMBATTRIB_METHOD
1171 case FB_TK_CONSTRUCTOR, FB_TK_DESTRUCTOR, FB_TK_PROPERTY
1174 elseif( symbIsStruct(
parent ) = FALSE )
then
1175 errReport( FB_ERRMSG_PARENTISNOTACLASS )
1178 if( options
and FB_PROCOPT_ISPROTO )
then
1188 hCheckAttrib( attrib, FB_SYMBATTRIB_STATIC , FB_ERRMSG_STATICNONMEMBERPROC )
1189 hCheckAttrib( attrib, FB_SYMBATTRIB_CONST , FB_ERRMSG_CONSTNONMEMBERPROC )
1190 hCheckAttrib( attrib, FB_SYMBATTRIB_ABSTRACT, FB_ERRMSG_ABSTRACTNONMEMBERPROC )
1191 hCheckAttrib( attrib, FB_SYMBATTRIB_VIRTUAL , FB_ERRMSG_VIRTUALNONMEMBERPROC )
1195 case FB_TK_CONSTRUCTOR, FB_TK_DESTRUCTOR
1204 AST_OP_ANDALSO, AST_OP_ANDALSO_SELF, _
1205 AST_OP_ORELSE, AST_OP_ORELSE_SELF
1212 if( astGetOpIsSelf(
op ) )
then
1214 if( is_memberproc = FALSE )
then
1215 errReport( FB_ERRMSG_OPMUSTBEAMETHOD, TRUE )
1221 if( is_memberproc )
then
1222 errReport( FB_ERRMSG_OPCANNOTBEAMETHOD, TRUE,
" (TODO)" )
1226 select case as const(
op )
1227 case AST_OP_NEW_SELF, AST_OP_NEW_VEC_SELF, _
1228 AST_OP_DEL_SELF, AST_OP_DEL_VEC_SELF
1230 attrib
or= FB_SYMBATTRIB_STATIC
1231 attrib
and=
not FB_SYMBATTRIB_METHOD
1234 if( is_memberproc )
then
1235 if( attrib
and FB_SYMBATTRIB_STATIC )
then
1236 errReport( FB_ERRMSG_OPERATORCANTBESTATIC, TRUE )
1237 attrib
and=
not FB_SYMBATTRIB_STATIC
1240 attrib
or= FB_SYMBATTRIB_METHOD
1249 (tk = FB_TK_SUB)
or (tk = FB_TK_PROPERTY) )
1259 case FB_TK_CONSTRUCTOR, FB_TK_DESTRUCTOR
1262 mode = FB_FUNCMODE_CDECL
1264 mode = FB_FUNCMODE_FBCALL
1270 if( fbLangOptIsSet( FB_LANG_OPT_FUNCOVL ) = FALSE )
then
1273 attrib
or= FB_SYMBATTRIB_OVERLOADED
1278 if( options
and FB_PROCOPT_ISPROTO )
then
1299 if( ((options
and FB_PROCOPT_ISPROTO) = 0)
and (
parent <> NULL) )
then
1300 if(
parent <> symbGetCurrentNamespc( ) )
then
1306 symbGetAttrib(
proc ) = attrib
1312 case FB_TK_DESTRUCTOR
1313 if( symbGetProcParams(
proc ) > 1 )
then
1314 errReport( FB_ERRMSG_DTORCANTCONTAINPARAMS )
1317 dtype = FB_DATATYPE_VOID
1320 case FB_TK_CONSTRUCTOR
1323 errReport( FB_ERRMSG_CLONECANTTAKESELFBYVAL, TRUE )
1328 if( symbGetParamMode( symbGetProcTailParam(
proc ) ) = FB_PARAMMODE_VARARG )
then
1331 param = symbGetProcTailParam(
proc )
1332 symbGetProcTailParam(
proc ) = param->prev
1333 if( param->prev <> NULL )
then
1334 param->prev->
next = NULL
1336 symbGetProcParams(
proc ) -= 1
1340 dtype = FB_DATATYPE_VOID
1347 if( symbGetProcParams(
proc ) = 1 )
then
1352 if( symbGetProcParams(
proc ) = 1 )
then
1358 if( symbGetProcParams(
proc ) = 1 )
then
1365 if( astGetOpNoResult(
op ) )
then
1366 dtype = FB_DATATYPE_VOID
1378 dtype = FB_DATATYPE_INTEGER
1382 symbGetFullType(
proc ) = dtype
1383 symbGetSubtype(
proc ) = subtype
1385 symbSetProcOpOvl(
proc,
op )
1388 if(
op = AST_OP_ASSIGN )
then
1390 errReport( FB_ERRMSG_CLONECANTTAKESELFBYVAL, TRUE )
1406 is_indexed = (symbGetProcParams(
proc ) = 1+1)
1410 if( attrib
and FB_SYMBATTRIB_RETURNSBYREF )
then
1413 attrib
and=
not FB_SYMBATTRIB_RETURNSBYREF
1415 dtype = FB_DATATYPE_VOID
1416 is_indexed = (symbGetProcParams(
proc ) = 1+2)
1419 symbGetFullType(
proc ) = dtype
1420 symbGetSubType(
proc ) = subtype
1425 if( is_memberproc )
then
1426 if( (symbGetProcParams(
proc ) <= 0)
orelse _
1427 (symbGetProcTailParam(
proc )->param.mode <> FB_PARAMMODE_VARARG) )
then
1428 attrib
or= FB_SYMBATTRIB_OVERLOADED
1437 if( (dtype <> FB_DATATYPE_INVALID)
or (tk = FB_TK_SUB) )
then
1443 if( tk = FB_TK_FUNCTION )
then
1444 if( fbLangOptIsSet( FB_LANG_OPT_DEFTYPE ) )
then
1446 if( dtype = FB_DATATYPE_INVALID )
then
1453 dtype = FB_DATATYPE_INTEGER
1457 dtype = FB_DATATYPE_VOID
1463 case FB_TK_CONSTRUCTOR, FB_TK_DESTRUCTOR
1467 if( ((attrib
and FB_SYMBATTRIB_METHOD) <> 0)
or _
1468 (tk = FB_TK_FUNCTION) )
then
1469 errReport( FB_ERRMSG_SYNTAXERROR, TRUE )
1470 elseif( symbGetProcParams(
proc ) <> 0 )
then
1471 errReport( FB_ERRMSG_ARGCNTMISMATCH, TRUE )
1474 stats
or= FB_SYMBSTATS_GLOBALCTOR
1476 stats
or= FB_SYMBSTATS_GLOBALDTOR
1486 if( options
and FB_PROCOPT_ISPROTO )
then
1488 case FB_TK_CONSTRUCTOR, FB_TK_DESTRUCTOR
1496 if(
proc = NULL )
then
1506 if( ((options
and FB_PROCOPT_HASPARENT) <> 0)
and _
1507 (tk <> FB_TK_CONSTRUCTOR) )
then
1511 if( tk = FB_TK_PROPERTY )
then
1522 case FB_TK_CONSTRUCTOR
1524 case FB_TK_DESTRUCTOR
1532 if( head_proc = NULL )
then
1534 if( is_outside )
then
1540 case FB_TK_CONSTRUCTOR, FB_TK_DESTRUCTOR
1541 head_proc =
symbAddCtor(
proc, palias, attrib, mode, FB_SYMBOPT_DECLARING )
1544 attrib, mode, FB_SYMBOPT_DECLARING )
1547 attrib, mode, FB_SYMBOPT_DECLARING )
1550 if( head_proc = NULL )
then
1551 errReport( FB_ERRMSG_DUPDEFINITION, TRUE )
1552 proc = CREATEFAKE( )
1561 if( symbIsProperty( head_proc ) <> (tk = FB_TK_PROPERTY) )
then
1562 errReport( FB_ERRMSG_DUPDEFINITION, TRUE )
1563 return CREATEFAKE( )
1567 if( symbGetProcIsOverloaded( head_proc ) )
then
1570 case FB_TK_CONSTRUCTOR
1576 iif( is_get, FB_SYMBLOOKUPOPT_PROPGET, FB_SYMBLOOKUPOPT_NONE ) )
1578 attrib
or= FB_SYMBATTRIB_OVERLOADED
1582 if( head_proc = NULL )
then
1583 if( is_outside )
then
1589 case FB_TK_CONSTRUCTOR, FB_TK_DESTRUCTOR
1590 head_proc =
symbAddCtor(
proc, palias, attrib, mode, FB_SYMBOPT_DECLARING )
1593 attrib, mode, FB_SYMBOPT_DECLARING )
1596 attrib, mode, FB_SYMBOPT_DECLARING )
1600 if( head_proc = NULL )
then
1601 errReport( FB_ERRMSG_DUPDEFINITION, TRUE )
1602 return CREATEFAKE( )
1608 if( symbGetIsDeclared( head_proc ) )
then
1609 errReport( FB_ERRMSG_DUPDEFINITION, TRUE )
1610 return CREATEFAKE( )
1616 return CREATEFAKE( )
1624 symbSetIsDeclared(
proc )
1629 if( stats
and FB_SYMBSTATS_GLOBALCTOR )
then
1631 symbSetProcPriority(
proc, priority )
1632 elseif( stats
and FB_SYMBSTATS_GLOBALDTOR )
then
1634 symbSetProcPriority(
proc, priority )
1637 if( tk = FB_TK_PROPERTY )
then
1645 if( (attrib
and FB_SYMBATTRIB_STATIC) <> 0 )
then
1646 errReport( FB_ERRMSG_MEMBERCANTBESTATIC )
1647 attrib
and=
not FB_SYMBATTRIB_STATIC
1654 if( attrib
and (FB_SYMBATTRIB_ABSTRACT
or FB_SYMBATTRIB_VIRTUAL) )
then
1655 if( attrib
and FB_SYMBATTRIB_ABSTRACT )
then
1660 attrib
and=
not (FB_SYMBATTRIB_ABSTRACT
or FB_ERRMSG_VIRTUALCTOR)
1667 if( attrib
and FB_SYMBATTRIB_ABSTRACT )
then
1669 attrib
and=
not FB_SYMBATTRIB_ABSTRACT
1679 if( attrib
and FB_SYMBATTRIB_CONST )
then
1680 errReport(
iif( tk = FB_TK_CONSTRUCTOR, _
1681 FB_ERRMSG_CONSTCTOR, FB_ERRMSG_CONSTDTOR ) )
1682 attrib
and=
not FB_SYMBATTRIB_CONST
1689 dim as integer tkn =
any, is_nested =
any
1690 dim as FBSYMBOL
ptr proc =
any
1691 dim as FB_CMPSTMTSTK
ptr stk =
any
1693 if( (attrib
and (FB_SYMBATTRIB_PUBLIC
or FB_SYMBATTRIB_PRIVATE)) = 0 )
then
1694 if( env.opt.procpublic )
then
1695 attrib
or= FB_SYMBATTRIB_PUBLIC
1697 attrib
or= FB_SYMBATTRIB_PRIVATE
1705 select case as const tkn
1706 case FB_TK_SUB, FB_TK_FUNCTION
1708 case FB_TK_CONSTRUCTOR
1709 if( fbLangOptIsSet( FB_LANG_OPT_CLASS ) = FALSE )
then
1712 attrib
or= FB_SYMBATTRIB_CONSTRUCTOR
1719 case FB_TK_DESTRUCTOR
1720 if( fbLangOptIsSet( FB_LANG_OPT_CLASS ) = FALSE )
then
1723 attrib
or= FB_SYMBATTRIB_DESTRUCTOR
1731 if( fbLangOptIsSet( FB_LANG_OPT_OPEROVL ) = FALSE )
then
1736 if( fbLangOptIsSet( FB_LANG_OPT_CLASS ) = FALSE )
then
1758 if(
proc = NULL )
then
1763 if( symbIsAbstract(
proc ) )
then
1771 stk =
cCompStmtPush( FB_TK_FUNCTION, FB_CMPSTMT_MASK_DEFAULT
or FB_CMPSTMT_MASK_DATA )
1773 stk->
proc.is_nested = is_nested
1774 stk->
proc.endlabel = astGetProcExitlabel( ast.
proc.curr )
1779 dim as FB_CMPSTMTSTK
ptr stk =
any
1780 dim as FBSYMBOL
ptr proc_res =
any
1783 if( stk = NULL )
then
1793 select case stk->
proc.tkn
1797 errReport( FB_ERRMSG_EXPECTEDENDFUNCTION )
1798 case FB_TK_CONSTRUCTOR
1800 case FB_TK_DESTRUCTOR
1803 errReport( FB_ERRMSG_EXPECTEDENDOPERATOR )
1805 errReport( FB_ERRMSG_EXPECTEDENDPROPERTY )
1811 if( proc_res <> NULL )
then
1812 if( symbGetIsAccessed( proc_res ) = FALSE )
then
1813 if( symbIsNaked( parser.currproc ) = FALSE )
then
1823 if( stk->
proc.is_nested )
then