17 byval array
as FBSYMBOL
ptr, _
18 byval array_expr
as ASTNODE
ptr, _
19 byref tree
as ASTNODE
ptr _
22 dim as FBSYMBOL
ptr desc =
any
35 tree =
astNewDECL( desc, (symbGetTypeIniTree( desc ) = NULL) )
43 symbSetTypeIniTree( desc, NULL )
52 byval parent as ASTNODE
ptr, _
53 byval n
as ASTNODE
ptr, _
54 byval dtype
as integer, _
55 byval copyback
as integer _
56 )
as AST_TMPSTRLIST_ITEM
ptr
58 dim as AST_TMPSTRLIST_ITEM
ptr t =
any
59 dim as FBSYMBOL
ptr s =
any
64 t->prev =
parent->
call.strtail
83 byval parent as ASTNODE
ptr, _
84 byval n
as ASTNODE
ptr, _
85 byval copyback
as integer _
88 dim as AST_TMPSTRLIST_ITEM
ptr t =
any
107 byval parent as ASTNODE
ptr, _
108 byval n
as ASTNODE
ptr _
111 dim as AST_TMPSTRLIST_ITEM
ptr t =
any
118 astSetType( n, typeAddrOf( FB_DATATYPE_WCHAR ), NULL )
127 byval parent as ASTNODE
ptr, _
128 byval param
as FBSYMBOL
ptr, _
129 byval arg
as ASTNODE
ptr _
132 dim as integer arg_dtype =
any, copyback =
any
136 arg_dtype = astGetDatatype( arg )
139 if(
parent->
call.isrtl )
then
142 if( symbGetParamMode( param ) = FB_PARAMMODE_BYREF )
then
144 select case arg_dtype
147 case FB_DATATYPE_STRING
152 case FB_DATATYPE_WCHAR
166 select case arg_dtype
167 case FB_DATATYPE_STRING
169 if( arg->
class <> AST_NODECLASS_CALL )
then
175 case FB_DATATYPE_WCHAR
195 select case symbGetParamMode( param )
197 case FB_PARAMMODE_BYREF
199 select case arg_dtype
201 case FB_DATATYPE_FIXSTR
208 if( arg->
class <> AST_NODECLASS_CALL )
then
213 case FB_DATATYPE_STRING
215 if( arg->
class <> AST_NODECLASS_CALL )
then
221 case FB_DATATYPE_WCHAR
232 case FB_PARAMMODE_BYVAL
234 select case arg_dtype
236 case FB_DATATYPE_STRING
239 if( arg->
class <> AST_NODECLASS_CALL )
then
245 case FB_DATATYPE_WCHAR
263 byval parent as ASTNODE
ptr, _
264 byval n
as ASTNODE
ptr, _
265 byval checkrtl
as integer _
268 dim as ASTNODE
ptr arg = n->l
269 dim as integer arg_dtype = astGetDatatype( arg )
271 if( checkrtl = FALSE )
then
273 if(
parent->
call.isrtl )
then
279 if( typeGetClass( arg_dtype ) = FB_DATACLASS_STRING )
then
282 if( astIsCALL( arg ) )
then
286 arg_dtype = FB_DATATYPE_STRING
290 if( arg_dtype <> FB_DATATYPE_FIXSTR )
then
295 n->l =
astNewCONV( typeAddrOf( FB_DATATYPE_CHAR ), _
300 astGetFullType( n ) = astGetFullType( astGetLeft( n ) )
304 select case arg_dtype
306 case FB_DATATYPE_CHAR
308 astGetFullType( n ) = astGetFullType( astGetLeft( n ) )
311 case FB_DATATYPE_WCHAR
315 if( astIsCALL( arg ) )
then
324 astGetFullType( n ) = astGetFullType( astGetLeft( n ) )
331 byval param
as FBSYMBOL
ptr, _
332 byval n
as ASTNODE
ptr, _
333 byval arg
as ASTNODE
ptr _
337 arg =
astNewCONV( typeAddrOf( symbGetFullType( param ) ), symbGetSubtype( param ), arg )
341 n->arg.mode = FB_PARAMMODE_BYVAL
347 byval param
as FBSYMBOL
ptr, _
348 byval n
as ASTNODE
ptr _
351 dim as ASTNODE
ptr arg = n->l
354 dim as ASTNODE
ptr t = arg
355 if( arg->
class = AST_NODECLASS_CONV )
then
356 if( arg->
cast.doconv = FALSE )
then
361 select case as const t->
class
363 case AST_NODECLASS_VAR, AST_NODECLASS_IDX, _
364 AST_NODECLASS_FIELD, AST_NODECLASS_DEREF, _
369 select case as const( astGetDataType( arg ) )
370 case FB_DATATYPE_STRING, FB_DATATYPE_FIXSTR, _
371 FB_DATATYPE_CHAR, FB_DATATYPE_WCHAR
375 case FB_DATATYPE_STRUCT
380 arg, AST_OPOPT_DONTCHKPTR )
392 byval parent as ASTNODE
ptr, _
393 byval param
as FBSYMBOL
ptr, _
394 byval n
as ASTNODE
ptr _
397 dim as ASTNODE
ptr arg = n->l, desc_tree =
any
398 dim as integer arg_dtype = astGetDatatype( arg ), sym_dtype =
any
401 if( n->arg.mode = FB_PARAMMODE_BYVAL )
then
405 dim as FBSYMBOL
ptr s =
any, desc =
any
407 s = astGetSymbol( arg )
410 errReport( FB_ERRMSG_PARAMTYPEMISMATCHAT )
414 sym_dtype = symbGetType( param )
417 if( (
parent->
call.isrtl = FALSE)
and (sym_dtype <> FB_DATATYPE_VOID) )
then
418 if( (typeGetClass( arg_dtype ) <> typeGetClass( sym_dtype ))
or _
419 (typeGetSize( arg_dtype ) <> typeGetSize( sym_dtype )) )
then
420 errReport( FB_ERRMSG_PARAMTYPEMISMATCHAT )
426 if( symbGetClass( s ) = FB_SYMBCLASS_FIELD )
then
428 if( symbGetArrayDimensions( s ) = 0 )
then
429 errReport( FB_ERRMSG_PARAMTYPEMISMATCHAT )
438 if( symbIsParamByDesc( s ) )
then
442 n->l =
astNewVAR( s, 0, typeAddrOf( FB_DATATYPE_VOID ) )
448 if( symbIsVar( s ) )
then
450 desc = symbGetArrayDescriptor( s )
451 if( desc = NULL )
then
452 errReport( FB_ERRMSG_PARAMTYPEMISMATCHAT )
456 errReport( FB_ERRMSG_PARAMTYPEMISMATCHAT )
468 astNewCONV( typeAddrOf( FB_DATATYPE_VOID ), NULL, _
479 byval parent as ASTNODE
ptr, _
480 byval param
as FBSYMBOL
ptr, _
481 byval n
as ASTNODE
ptr _
484 dim as ASTNODE
ptr arg = n->l
485 dim as integer arg_dtype = astGetDatatype( arg )
487 select case as const typeGetClass( arg_dtype )
489 case FB_DATACLASS_STRING
492 case FB_DATACLASS_INTEGER
493 select case arg_dtype
495 case FB_DATATYPE_CHAR, FB_DATATYPE_WCHAR
501 if( typeGetSize( arg_dtype ) < 4 )
then
502 n->l =
astNewCONV(
iif( typeIsSigned( arg_dtype ), _
504 FB_DATATYPE_ULONG ), _
509 case FB_DATACLASS_FPOINT
511 if( arg_dtype = FB_DATATYPE_SINGLE )
then
512 n->l =
astNewCONV( FB_DATATYPE_DOUBLE, NULL, arg )
516 errReport( FB_ERRMSG_PARAMTYPEMISMATCHAT )
527 byval parent as ASTNODE
ptr, _
528 byval param
as FBSYMBOL
ptr, _
529 byval n
as ASTNODE
ptr _
532 dim as ASTNODE
ptr arg = n->l
534 if( n->arg.mode = FB_PARAMMODE_BYVAL )
then
541 if( env.clopt.lang <> FB_LANG_QB )
then
542 if( astIsCONST( arg )
or astIsOFFSET( arg ) )
then
554 byval parent as ASTNODE
ptr, _
555 byval param
as FBSYMBOL
ptr, _
556 byval n
as ASTNODE
ptr _
559 dim as ASTNODE
ptr arg = n->l
560 dim as integer arg_dtype = astGetDatatype( arg )
563 select case as const arg_dtype
564 case FB_DATATYPE_STRING, FB_DATATYPE_FIXSTR
567 case FB_DATATYPE_CHAR, FB_DATATYPE_WCHAR
571 errReport( FB_ERRMSG_PARAMTYPEMISMATCHAT )
595 if( symbGetParamMode( param ) = FB_PARAMMODE_BYVAL )
then
597 if( arg_dtype = FB_DATATYPE_STRING )
then
604 if( arg->
class <> AST_NODECLASS_CALL )
then
612 sub hByteByByte(
byval param
as FBSYMBOL
ptr,
byval n
as ASTNODE
ptr )
616 n->arg.lgt = symbGetLen( symbGetSubtype( param ) )
621 byval param
as FBSYMBOL
ptr, _
622 byval n
as ASTNODE
ptr _
625 dim as FBSYMBOL
ptr tmp =
any
626 dim as ASTNODE
ptr arg =
any, callexpr =
any
627 dim as integer is_ctorcall =
any
633 if( astIsCALL( arg ) )
then
639 assert( symbProcReturnsByref( arg->sym ) = FALSE )
641 astSetType( arg, symbGetProcRealType( arg->sym ), _
642 symbGetProcRealSubtype( arg->sym ) )
653 tmp =
symbAddTempVar( symbGetFullType( param ), symbGetSubtype( param ) )
658 if( astIsTYPEINI( arg ) )
then
666 if( is_ctorcall )
then
681 byval param
as FBSYMBOL
ptr, _
682 byval n
as ASTNODE
ptr _
685 static as integer rec_cnt = 0
686 dim as ASTNODE
ptr arg =
any
687 dim as FBSYMBOL
ptr tmp =
any
688 dim as integer is_ctorcall =
any
695 if( rec_cnt <> 0 )
then
704 if( is_ctorcall = FALSE )
then
709 tmp =
symbAddTempVar( symbGetFullType( param ), symbGetSubtype( param ) )
716 if( symbGetParamMode( param ) = FB_PARAMMODE_BYVAL )
then
728 byval param
as FBSYMBOL
ptr, _
729 byval n
as ASTNODE
ptr _
732 dim as FBSYMBOL
ptr tmp =
any
733 dim as ASTNODE
ptr arg = n->l
736 if( astGetDatatype( arg ) <> FB_DATATYPE_STRUCT )
then
738 errReport( FB_ERRMSG_PARAMTYPEMISMATCHAT )
745 if( arg->subtype <> symbGetSubtype( param ) )
then
751 arg =
astNewCONV( symbGetType( param ), symbGetSubtype( param ), arg )
752 if( arg = NULL )
then
753 errReport( FB_ERRMSG_PARAMTYPEMISMATCHAT )
763 arg =
astNewCONV( symbGetType( param ), symbGetSubtype( param ), arg )
768 select case symbGetParamMode( param )
770 case FB_PARAMMODE_BYREF
771 if( astIsCALL( arg ) )
then
773 assert( symbProcReturnsByref( arg->sym ) = FALSE )
784 n->arg.mode = FB_PARAMMODE_BYVAL
792 case FB_PARAMMODE_BYVAL
803 byval parent as ASTNODE
ptr, _
804 byval param
as FBSYMBOL
ptr, _
805 byval n
as ASTNODE
ptr _
808 dim as ASTNODE
ptr arg =
any
809 dim as integer param_dtype =
any, arg_dtype
819 param_dtype = symbGetType( param )
820 arg_dtype = astGetDatatype( arg )
822 select case symbGetParamMode( param )
824 case FB_PARAMMODE_BYDESC
828 case FB_PARAMMODE_VARARG
831 case FB_PARAMMODE_BYREF
833 if( param_dtype = FB_DATATYPE_VOID )
then
839 if( n->arg.mode = FB_PARAMMODE_BYVAL )
then
840 if( (typeGetClass( arg_dtype ) <> FB_DATACLASS_INTEGER)
or _
841 (typeGetSize( arg_dtype ) <> env.pointersize) )
then
842 errReport( FB_ERRMSG_PARAMTYPEMISMATCHAT )
850 if( astGetClass( arg ) = AST_NODECLASS_FIELD )
then
851 if( astGetDataType( astGetLeft( arg ) ) = FB_DATATYPE_BITFIELD )
then
852 errReport( FB_ERRMSG_PARAMTYPEMISMATCHAT )
860 select case arg_dtype
861 case FB_DATATYPE_STRUCT
863 dim as integer err_num =
any
864 dim as FBSYMBOL
ptr proc =
any
867 symbGetSubtype( param ), _
871 if( proc <> NULL )
then
872 static as integer rec_cnt = 0
874 if( rec_cnt = 0 )
then
881 arg_dtype = astGetDatatype( arg )
886 select case param_dtype
888 case FB_DATATYPE_STRING, FB_DATATYPE_FIXSTR
892 case FB_DATATYPE_CHAR, FB_DATATYPE_WCHAR
893 assert( symbGetParamMode( param ) = FB_PARAMMODE_BYREF )
898 select case( arg_dtype )
899 case FB_DATATYPE_STRING, FB_DATATYPE_FIXSTR, _
900 FB_DATATYPE_CHAR, FB_DATATYPE_WCHAR
903 errReport( FB_ERRMSG_PARAMTYPEMISMATCHAT )
908 case FB_DATATYPE_STRUCT
913 select case as const arg_dtype
915 case FB_DATATYPE_STRING, FB_DATATYPE_FIXSTR, _
916 FB_DATATYPE_CHAR, FB_DATATYPE_WCHAR
918 select case param_dtype
920 case typeAddrOf( FB_DATATYPE_CHAR ), FB_DATATYPE_CHAR
922 if( arg_dtype = FB_DATATYPE_WCHAR )
then
927 case typeAddrOf( FB_DATATYPE_WCHAR ), FB_DATATYPE_WCHAR
929 if( arg_dtype <> FB_DATATYPE_WCHAR )
then
934 errReport( FB_ERRMSG_PARAMTYPEMISMATCHAT )
940 if( typeIsPtr( param_dtype ) = FALSE )
then
947 arg_dtype = astGetDatatype( arg )
950 case FB_DATATYPE_STRUCT
951 errReport( FB_ERRMSG_PARAMTYPEMISMATCHAT )
956 if( (param_dtype = FB_DATATYPE_ENUM)
or (arg_dtype = FB_DATATYPE_ENUM) )
then
957 if( typeGetClass( param_dtype ) <> typeGetClass( arg_dtype ) )
then
963 if( typeIsPtr( param_dtype ) )
then
964 if(
astPtrCheck( symbGetFullType( param ), symbGetSubtype( param ), arg ) = FALSE )
then
965 if( typeIsPtr( arg_dtype ) = FALSE )
then
969 if( typeGetDtOnly( param_dtype ) = FB_DATATYPE_STRUCT
and typeGetDtOnly( arg_dtype ) = FB_DATATYPE_STRUCT )
then
981 elseif( typeIsPtr( arg_dtype ) )
then
990 if( (param_dtype <> arg_dtype)
or (param->subtype <> arg->subtype) )
then
993 if( (typeGetSize( param_dtype ) <> typeGetSize( arg_dtype ))
or _
994 (typeGetClass( param_dtype ) <> typeGetClass( arg_dtype )) )
then
995 if( symbGetParamMode( param ) = FB_PARAMMODE_BYREF )
then
997 dim as ASTNODE
ptr t = arg
998 if( arg->
class = AST_NODECLASS_CONV )
then
999 if( arg->
cast.doconv = FALSE )
then
1007 select case as const t->
class
1008 case AST_NODECLASS_VAR, AST_NODECLASS_IDX, _
1009 AST_NODECLASS_FIELD, AST_NODECLASS_DEREF, _
1011 errReport( FB_ERRMSG_PARAMTYPEMISMATCHAT )
1022 arg =
astNewCONV( symbGetFullType( param ), symbGetSubtype( param ), arg )
1023 if( arg = NULL )
then
1027 arg_dtype = astGetDatatype( arg )
1033 if( symbGetParamMode( param ) = FB_PARAMMODE_BYREF )
then
1043 dim as ASTNODE
ptr tree = symbGetParamOptExpr( param )
1045 if( tree = NULL )
then
1052 if( astIsTYPEINI( tree ) )
then
1068 byval parent as ASTNODE
ptr, _
1069 byval arg
as ASTNODE
ptr, _
1070 byval dtype
as integer, _
1071 byval mode
as integer =
INVALID _
1074 dim as ASTNODE
ptr n =
any
1075 dim as FBSYMBOL
ptr sym =
any, param =
any
1079 if(
parent->
call.args >= sym->proc.params )
then
1080 param = symbGetProcTailParam( sym )
1082 param =
parent->
call.currarg
1086 if( arg = NULL )
then
1090 if( dtype = FB_DATATYPE_INVALID )
then
1091 dtype = astGetFullType( arg )
1100 if( ((symbGetIsRTL( sym ) = FALSE)
or symbGetIsRTLConst( param ))
and _
1101 ((
not symbIsParamInstance( param ))
or _
1102 ((
not symbIsConstructor( sym ))
and (
not symbIsDestructor( sym )))) )
then
1103 if(
symbCheckConstAssign( symbGetFullType( param ), dtype, param->subtype, arg->subtype, symbGetParamMode( param ) ) = FALSE )
then
1104 if( symbIsParamInstance( param ) )
then
1114 n =
astNewNode( AST_NODECLASS_ARG, FB_DATATYPE_INVALID )
1123 if( symbGetProcMode( sym ) = FB_FUNCMODE_PASCAL )
then
1125 if(
parent->r = NULL )
then
1128 parent->
call.argtail->r = n
1135 if(
parent->r = NULL )
then
1155 if(
parent->
call.args < sym->proc.params )
then
1156 parent->
call.currarg = symbGetParamNext(
parent->
call.currarg )
1163 byval parent as ASTNODE
ptr, _
1164 byval expr
as ASTNODE
ptr, _
1165 byval mode
as integer _
1168 dim as FBSYMBOL
ptr sym =
any, param =
any
1169 dim as ASTNODE
ptr n =
any
1171 assert( astIsCALL(
parent ) )
1176 if( symbGetProcMode( sym ) = FB_FUNCMODE_PASCAL )
then
1182 param = symbGetProcHeadParam( sym )
1183 assert( symbIsParamInstance( param ) )
1188 assert( n->sym = param )