13 byval ldtype
as integer, _
14 byval lsubtype
as FBSYMBOL
ptr, _
15 byval rdtype
as integer, _
16 byval rsubtype
as FBSYMBOL
ptr, _
17 byref dtype
as integer, _
18 byref subtype
as FBSYMBOL
ptr _
21 dim as integer lmatch =
any, rmatch =
any, otherdtype =
any
26 lmatch = typeIsPtr( ldtype )
27 rmatch = typeIsPtr( rdtype )
28 if( lmatch
or rmatch )
then
33 if( lmatch
and rmatch )
then
34 if( (typeGetDtAndPtrOnly( ldtype ) <> typeGetDtAndPtrOnly( rdtype ))
or _
35 (lsubtype <> rsubtype) )
then
57 if( typeGetClass( otherdtype ) <> FB_DATACLASS_INTEGER )
then
63 select case( typeGetDtOnly( otherdtype ) )
64 case FB_DATATYPE_CHAR, FB_DATATYPE_WCHAR
75 lmatch = (typeGetDtOnly( ldtype ) = FB_DATATYPE_STRING)
or _
76 (typeGetDtOnly( ldtype ) = FB_DATATYPE_FIXSTR)
or _
77 (typeGetDtOnly( ldtype ) = FB_DATATYPE_CHAR )
78 rmatch = (typeGetDtOnly( rdtype ) = FB_DATATYPE_STRING)
or _
79 (typeGetDtOnly( rdtype ) = FB_DATATYPE_FIXSTR)
or _
80 (typeGetDtOnly( rdtype ) = FB_DATATYPE_CHAR )
81 if( lmatch
or rmatch )
then
83 if( lmatch <> rmatch )
then
86 dtype = FB_DATATYPE_STRING
92 lmatch = (typeGetDtOnly( ldtype ) = FB_DATATYPE_WCHAR)
93 rmatch = (typeGetDtOnly( rdtype ) = FB_DATATYPE_WCHAR)
94 if( lmatch
or rmatch )
then
96 if( lmatch <> rmatch )
then
99 dtype = FB_DATATYPE_WCHAR
105 lmatch = (typeGetDtOnly( ldtype ) = FB_DATATYPE_STRUCT)
106 rmatch = (typeGetDtOnly( rdtype ) = FB_DATATYPE_STRUCT)
107 if( lmatch
or rmatch )
then
109 if( lmatch <> rmatch )
then
114 if( lsubtype <> rsubtype )
then
118 dtype = FB_DATATYPE_STRUCT
124 lmatch = (typeGetDtOnly( ldtype ) = FB_DATATYPE_ENUM)
125 rmatch = (typeGetDtOnly( rdtype ) = FB_DATATYPE_ENUM)
126 if( lmatch
or rmatch )
then
128 if( lmatch
and rmatch )
then
129 if( lsubtype = rsubtype )
then
131 dtype = FB_DATATYPE_ENUM
136 dtype = FB_DATATYPE_INTEGER
145 ldtype = FB_DATATYPE_INTEGER
148 rdtype = FB_DATATYPE_INTEGER
154 typeMax( ldtype, lsubtype, rdtype, rsubtype, dtype, subtype )
160 byval condexpr
as ASTNODE
ptr, _
161 byval truexpr
as ASTNODE
ptr, _
162 byval truecookie
as integer, _
163 byval falsexpr
as ASTNODE
ptr, _
164 byval falsecookie
as integer _
167 dim as ASTNODE
ptr n =
any, varexpr =
any
168 dim as integer dtype =
any
169 dim as integer is_true_ctorcall =
any, is_false_ctorcall =
any
170 dim as integer call_true_defctor =
any, call_false_defctor =
any
171 dim as FBSYMBOL
ptr falselabel =
any, subtype =
any, temp =
any
175 if( condexpr = NULL )
then
180 if( astIsCONST( condexpr ) )
then
199 dtype = FB_DATATYPE_INVALID
203 if(
hCheckTypes( truexpr->dtype, truexpr->subtype, _
204 falsexpr->dtype, falsexpr->subtype, _
205 dtype, subtype ) = FALSE )
then
211 dtype
or= typeGetConstMask( truexpr->dtype )
or _
212 typeGetConstMask( falsexpr->dtype )
217 if( condexpr = NULL )
then
222 select case( typeGetDtAndPtrOnly( dtype ) )
223 case FB_DATATYPE_FIXSTR, FB_DATATYPE_CHAR
224 dtype = FB_DATATYPE_STRING
234 if( typeGetDtAndPtrOnly( dtype ) = FB_DATATYPE_WCHAR )
then
244 symbSetIsWstring( temp )
269 is_true_ctorcall = FALSE
270 is_false_ctorcall = FALSE
271 call_true_defctor = FALSE
272 call_false_defctor = FALSE
290 if( is_true_ctorcall
or is_false_ctorcall )
then
291 if( is_true_ctorcall )
then
297 call_true_defctor = TRUE
300 if( is_false_ctorcall )
then
306 call_false_defctor = TRUE
315 if( (is_true_ctorcall = FALSE)
or (is_false_ctorcall = FALSE) )
then
324 if( is_true_ctorcall = FALSE )
then
327 if( call_true_defctor )
then
333 if( is_false_ctorcall = FALSE )
then
336 if( call_false_defctor )
then
362 if( truecookie )
then
365 if( falsecookie )
then
369 n =
astNewNode( AST_NODECLASS_IIF, dtype, subtype )
374 n->
iif.falselabel = falselabel
380 dim as ASTNODE
ptr condexpr =
any, truexpr =
any, falsexpr =
any
381 dim as FBSYMBOL
ptr exitlabel =
any
383 assert( n->r->
class = AST_NODECLASS_LINK )
384 assert( n->r->r->
class = AST_NODECLASS_LINK )
388 falsexpr = n->r->r->r
390 if( ast.doemit )
then
410 if( ast.doemit )
then
411 irEmitBRANCH( AST_OP_JMP, exitlabel )
415 if( ast.doemit )
then
416 irEmitLABELNF( n->
iif.falselabel )
419 if( ast.doemit )
then
429 if( ast.doemit )
then
431 irEmitLABELNF( exitlabel )