defcmp.pas 56 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372
  1. {
  2. $Id$
  3. Copyright (c) 1998-2002 by Florian Klaempfl
  4. Compare definitions and parameter lists
  5. This program is free software; you can redistribute it and/or modify
  6. it under the terms of the GNU General Public License as published by
  7. the Free Software Foundation; either version 2 of the License, or
  8. (at your option) any later version.
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with this program; if not, write to the Free Software
  15. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  16. ****************************************************************************
  17. }
  18. unit defcmp;
  19. {$i fpcdefs.inc}
  20. interface
  21. uses
  22. cclasses,
  23. globtype,globals,
  24. node,
  25. symconst,symtype,symdef;
  26. type
  27. { if acp is cp_all the var const or nothing are considered equal }
  28. tcompare_paras_type = ( cp_none, cp_value_equal_const, cp_all,cp_procvar);
  29. tcompare_paras_option = (cpo_allowdefaults,cpo_ignorehidden,cpo_allowconvert,cpo_comparedefaultvalue);
  30. tcompare_paras_options = set of tcompare_paras_option;
  31. tcompare_defs_option = (cdo_internal,cdo_explicit,cdo_check_operator,cdo_allow_variant);
  32. tcompare_defs_options = set of tcompare_defs_option;
  33. tconverttype = (tc_none,
  34. tc_equal,
  35. tc_not_possible,
  36. tc_string_2_string,
  37. tc_char_2_string,
  38. tc_char_2_chararray,
  39. tc_pchar_2_string,
  40. tc_cchar_2_pchar,
  41. tc_cstring_2_pchar,
  42. tc_ansistring_2_pchar,
  43. tc_string_2_chararray,
  44. tc_chararray_2_string,
  45. tc_array_2_pointer,
  46. tc_pointer_2_array,
  47. tc_int_2_int,
  48. tc_int_2_bool,
  49. tc_bool_2_bool,
  50. tc_bool_2_int,
  51. tc_real_2_real,
  52. tc_int_2_real,
  53. tc_real_2_currency,
  54. tc_proc_2_procvar,
  55. tc_arrayconstructor_2_set,
  56. tc_load_smallset,
  57. tc_cord_2_pointer,
  58. tc_intf_2_string,
  59. tc_intf_2_guid,
  60. tc_class_2_intf,
  61. tc_char_2_char,
  62. tc_normal_2_smallset,
  63. tc_dynarray_2_openarray,
  64. tc_pwchar_2_string,
  65. tc_variant_2_dynarray,
  66. tc_dynarray_2_variant,
  67. tc_variant_2_enum,
  68. tc_enum_2_variant
  69. );
  70. function compare_defs_ext(def_from,def_to : tdef;
  71. fromtreetype : tnodetype;
  72. var doconv : tconverttype;
  73. var operatorpd : tprocdef;
  74. cdoptions:tcompare_defs_options):tequaltype;
  75. { Returns if the type def_from can be converted to def_to or if both types are equal }
  76. function compare_defs(def_from,def_to:tdef;fromtreetype:tnodetype):tequaltype;
  77. { Returns true, if def1 and def2 are semantically the same }
  78. function equal_defs(def_from,def_to:tdef):boolean;
  79. { Checks for type compatibility (subgroups of type)
  80. used for case statements... probably missing stuff
  81. to use on other types }
  82. function is_subequal(def1, def2: tdef): boolean;
  83. {# true, if two parameter lists are equal
  84. if acp is cp_none, all have to match exactly
  85. if acp is cp_value_equal_const call by value
  86. and call by const parameter are assumed as
  87. equal
  88. allowdefaults indicates if default value parameters
  89. are allowed (in this case, the search order will first
  90. search for a routine with default parameters, before
  91. searching for the same definition with no parameters)
  92. }
  93. function compare_paras(para1,para2 : tlist; acp : tcompare_paras_type; cpoptions: tcompare_paras_options):tequaltype;
  94. { True if a function can be assigned to a procvar }
  95. { changed first argument type to pabstractprocdef so that it can also be }
  96. { used to test compatibility between two pprocvardefs (JM) }
  97. function proc_to_procvar_equal(def1:tabstractprocdef;def2:tprocvardef;methoderr:boolean):tequaltype;
  98. implementation
  99. uses
  100. verbose,systems,
  101. symtable,symsym,
  102. defutil,symutil;
  103. function compare_defs_ext(def_from,def_to : tdef;
  104. fromtreetype : tnodetype;
  105. var doconv : tconverttype;
  106. var operatorpd : tprocdef;
  107. cdoptions:tcompare_defs_options):tequaltype;
  108. { Tbasetype:
  109. uvoid,
  110. u8bit,u16bit,u32bit,u64bit,
  111. s8bit,s16bit,s32bit,s64bit,
  112. bool8bit,bool16bit,bool32bit,
  113. uchar,uwidechar }
  114. type
  115. tbasedef=(bvoid,bchar,bint,bbool);
  116. const
  117. basedeftbl:array[tbasetype] of tbasedef =
  118. (bvoid,
  119. bint,bint,bint,bint,
  120. bint,bint,bint,bint,
  121. bbool,bbool,bbool,
  122. bchar,bchar,bint);
  123. basedefconvertsimplicit : array[tbasedef,tbasedef] of tconverttype =
  124. { void, char, int, bool }
  125. ((tc_not_possible,tc_not_possible,tc_not_possible,tc_not_possible),
  126. (tc_not_possible,tc_char_2_char,tc_not_possible,tc_not_possible),
  127. (tc_not_possible,tc_not_possible,tc_int_2_int,tc_not_possible),
  128. (tc_not_possible,tc_not_possible,tc_not_possible,tc_bool_2_bool));
  129. basedefconvertsexplicit : array[tbasedef,tbasedef] of tconverttype =
  130. { void, char, int, bool }
  131. ((tc_not_possible,tc_not_possible,tc_not_possible,tc_not_possible),
  132. (tc_not_possible,tc_char_2_char,tc_int_2_int,tc_int_2_bool),
  133. (tc_not_possible,tc_int_2_int,tc_int_2_int,tc_int_2_bool),
  134. (tc_not_possible,tc_bool_2_int,tc_bool_2_int,tc_bool_2_bool));
  135. var
  136. subeq,eq : tequaltype;
  137. hd1,hd2 : tdef;
  138. hct : tconverttype;
  139. hd3 : tobjectdef;
  140. hpd : tprocdef;
  141. begin
  142. eq:=te_incompatible;
  143. doconv:=tc_not_possible;
  144. { safety check }
  145. if not(assigned(def_from) and assigned(def_to)) then
  146. begin
  147. compare_defs_ext:=te_incompatible;
  148. exit;
  149. end;
  150. { same def? then we've an exact match }
  151. if def_from=def_to then
  152. begin
  153. doconv:=tc_equal;
  154. compare_defs_ext:=te_exact;
  155. exit;
  156. end;
  157. { we walk the wanted (def_to) types and check then the def_from
  158. types if there is a conversion possible }
  159. case def_to.deftype of
  160. orddef :
  161. begin
  162. case def_from.deftype of
  163. orddef :
  164. begin
  165. if (torddef(def_from).typ=torddef(def_to).typ) then
  166. begin
  167. case torddef(def_from).typ of
  168. uchar,uwidechar,
  169. u8bit,u16bit,u32bit,u64bit,
  170. s8bit,s16bit,s32bit,s64bit:
  171. begin
  172. if (torddef(def_from).low=torddef(def_to).low) and
  173. (torddef(def_from).high=torddef(def_to).high) then
  174. eq:=te_equal
  175. else
  176. begin
  177. doconv:=tc_int_2_int;
  178. eq:=te_convert_l1;
  179. end;
  180. end;
  181. uvoid,
  182. bool8bit,bool16bit,bool32bit:
  183. eq:=te_equal;
  184. else
  185. internalerror(200210061);
  186. end;
  187. end
  188. else
  189. begin
  190. if cdo_explicit in cdoptions then
  191. doconv:=basedefconvertsexplicit[basedeftbl[torddef(def_from).typ],basedeftbl[torddef(def_to).typ]]
  192. else
  193. doconv:=basedefconvertsimplicit[basedeftbl[torddef(def_from).typ],basedeftbl[torddef(def_to).typ]];
  194. if (doconv=tc_not_possible) then
  195. eq:=te_incompatible
  196. else
  197. { "punish" bad type conversions :) (JM) }
  198. if (not is_in_limit(def_from,def_to)) and
  199. (def_from.size > def_to.size) then
  200. eq:=te_convert_l3
  201. else
  202. eq:=te_convert_l1;
  203. end;
  204. end;
  205. enumdef :
  206. begin
  207. { needed for char(enum) }
  208. if cdo_explicit in cdoptions then
  209. begin
  210. doconv:=tc_int_2_int;
  211. eq:=te_convert_l1;
  212. end;
  213. end;
  214. floatdef :
  215. begin
  216. if is_currency(def_to) then
  217. begin
  218. doconv:=tc_real_2_currency;
  219. eq:=te_convert_l2;
  220. end;
  221. end;
  222. classrefdef,
  223. procvardef,
  224. pointerdef :
  225. begin
  226. if cdo_explicit in cdoptions then
  227. begin
  228. eq:=te_convert_l1;
  229. if (fromtreetype=niln) then
  230. begin
  231. { will be handled by the constant folding }
  232. doconv:=tc_equal;
  233. end
  234. else
  235. doconv:=tc_int_2_int;
  236. end;
  237. end;
  238. end;
  239. end;
  240. stringdef :
  241. begin
  242. case def_from.deftype of
  243. stringdef :
  244. begin
  245. { Constant string }
  246. if (fromtreetype=stringconstn) then
  247. begin
  248. if (tstringdef(def_from).string_typ=tstringdef(def_to).string_typ) then
  249. eq:=te_equal
  250. else
  251. begin
  252. doconv:=tc_string_2_string;
  253. { Don't prefer conversions from widestring to a
  254. normal string as we can loose information }
  255. if tstringdef(def_from).string_typ=st_widestring then
  256. eq:=te_convert_l1
  257. else
  258. begin
  259. if tstringdef(def_to).string_typ=st_widestring then
  260. eq:=te_convert_l1
  261. else
  262. eq:=te_equal; { we can change the stringconst node }
  263. end;
  264. end;
  265. end
  266. else
  267. { Same string type, for shortstrings also the length must match }
  268. if (tstringdef(def_from).string_typ=tstringdef(def_to).string_typ) and
  269. ((tstringdef(def_from).string_typ<>st_shortstring) or
  270. (tstringdef(def_from).len=tstringdef(def_to).len)) then
  271. eq:=te_equal
  272. else
  273. begin
  274. doconv:=tc_string_2_string;
  275. { Prefer conversions to shortstring over other
  276. conversions. This is compatible with Delphi (PFV) }
  277. if tstringdef(def_to).string_typ=st_shortstring then
  278. eq:=te_convert_l2
  279. else
  280. eq:=te_convert_l3;
  281. end;
  282. end;
  283. orddef :
  284. begin
  285. { char to string}
  286. if is_char(def_from) or
  287. is_widechar(def_from) then
  288. begin
  289. doconv:=tc_char_2_string;
  290. eq:=te_convert_l1;
  291. end;
  292. end;
  293. arraydef :
  294. begin
  295. { array of char to string, the length check is done by the firstpass of this node }
  296. if is_chararray(def_from) or
  297. (is_char(tarraydef(def_from).elementtype.def) and
  298. is_open_array(def_from)) then
  299. begin
  300. doconv:=tc_chararray_2_string;
  301. if is_open_array(def_from) or
  302. (is_shortstring(def_to) and
  303. (def_from.size <= 255)) or
  304. (is_ansistring(def_to) and
  305. (def_from.size > 255)) then
  306. eq:=te_convert_l1
  307. else
  308. eq:=te_convert_l2;
  309. end;
  310. end;
  311. pointerdef :
  312. begin
  313. { pchar can be assigned to short/ansistrings,
  314. but not in tp7 compatible mode }
  315. if not(m_tp7 in aktmodeswitches) then
  316. begin
  317. if is_pchar(def_from) then
  318. begin
  319. doconv:=tc_pchar_2_string;
  320. { prefer ansistrings because pchars can overflow shortstrings, }
  321. { but only if ansistrings are the default (JM) }
  322. if (is_shortstring(def_to) and
  323. not(cs_ansistrings in aktlocalswitches)) or
  324. (is_ansistring(def_to) and
  325. (cs_ansistrings in aktlocalswitches)) then
  326. eq:=te_convert_l1
  327. else
  328. eq:=te_convert_l2;
  329. end
  330. else if is_pwidechar(def_from) then
  331. begin
  332. doconv:=tc_pwchar_2_string;
  333. { prefer ansistrings because pchars can overflow shortstrings, }
  334. { but only if ansistrings are the default (JM) }
  335. if is_widestring(def_to) then
  336. eq:=te_convert_l1
  337. else
  338. eq:=te_convert_l3;
  339. end;
  340. end;
  341. end;
  342. end;
  343. end;
  344. floatdef :
  345. begin
  346. case def_from.deftype of
  347. orddef :
  348. begin { ordinal to real }
  349. if is_integer(def_from) or
  350. (is_currency(def_from) and
  351. (s64currencytype.def.deftype = floatdef)) then
  352. begin
  353. doconv:=tc_int_2_real;
  354. eq:=te_convert_l1;
  355. end
  356. else if is_currency(def_from)
  357. { and (s64currencytype.def.deftype = orddef)) } then
  358. begin
  359. { prefer conversion to orddef in this case, unless }
  360. { the orddef < currency (then it will get convert l3, }
  361. { and conversion to float is favoured) }
  362. doconv:=tc_int_2_real;
  363. eq:=te_convert_l2;
  364. end;
  365. end;
  366. floatdef :
  367. begin
  368. if tfloatdef(def_from).typ=tfloatdef(def_to).typ then
  369. eq:=te_equal
  370. else
  371. begin
  372. if (fromtreetype=realconstn) or
  373. not((cdo_explicit in cdoptions) and
  374. (m_delphi in aktmodeswitches)) then
  375. begin
  376. doconv:=tc_real_2_real;
  377. { do we loose precision? }
  378. if def_to.size<def_from.size then
  379. eq:=te_convert_l2
  380. else
  381. eq:=te_convert_l1;
  382. end;
  383. end;
  384. end;
  385. end;
  386. end;
  387. enumdef :
  388. begin
  389. case def_from.deftype of
  390. enumdef :
  391. begin
  392. if cdo_explicit in cdoptions then
  393. begin
  394. eq:=te_convert_l1;
  395. doconv:=tc_int_2_int;
  396. end
  397. else
  398. begin
  399. hd1:=def_from;
  400. while assigned(tenumdef(hd1).basedef) do
  401. hd1:=tenumdef(hd1).basedef;
  402. hd2:=def_to;
  403. while assigned(tenumdef(hd2).basedef) do
  404. hd2:=tenumdef(hd2).basedef;
  405. if (hd1=hd2) then
  406. begin
  407. eq:=te_convert_l1;
  408. { because of packenum they can have different sizes! (JM) }
  409. doconv:=tc_int_2_int;
  410. end;
  411. end;
  412. end;
  413. orddef :
  414. begin
  415. if cdo_explicit in cdoptions then
  416. begin
  417. eq:=te_convert_l1;
  418. doconv:=tc_int_2_int;
  419. end;
  420. end;
  421. variantdef :
  422. begin
  423. eq:=te_convert_l1;
  424. doconv:=tc_variant_2_enum;
  425. end;
  426. end;
  427. end;
  428. arraydef :
  429. begin
  430. { open array is also compatible with a single element of its base type }
  431. if is_open_array(def_to) and
  432. equal_defs(def_from,tarraydef(def_to).elementtype.def) then
  433. begin
  434. doconv:=tc_equal;
  435. eq:=te_convert_l1;
  436. end
  437. else
  438. begin
  439. case def_from.deftype of
  440. arraydef :
  441. begin
  442. { to dynamic array }
  443. if is_dynamic_array(def_to) then
  444. begin
  445. { dynamic array -> dynamic array }
  446. if is_dynamic_array(def_from) and
  447. equal_defs(tarraydef(def_from).elementtype.def,tarraydef(def_to).elementtype.def) then
  448. eq:=te_equal;
  449. end
  450. else
  451. { to open array }
  452. if is_open_array(def_to) then
  453. begin
  454. { array constructor -> open array }
  455. if is_array_constructor(def_from) then
  456. begin
  457. if is_void(tarraydef(def_from).elementtype.def) then
  458. begin
  459. doconv:=tc_equal;
  460. eq:=te_convert_l1;
  461. end
  462. else
  463. begin
  464. subeq:=compare_defs_ext(tarraydef(def_from).elementtype.def,
  465. tarraydef(def_to).elementtype.def,
  466. arrayconstructorn,hct,hpd,[cdo_check_operator]);
  467. if (subeq>=te_equal) then
  468. begin
  469. doconv:=tc_equal;
  470. eq:=te_convert_l1;
  471. end
  472. else
  473. if (subeq>te_incompatible) then
  474. begin
  475. doconv:=hct;
  476. eq:=te_convert_l2;
  477. end;
  478. end;
  479. end
  480. else
  481. { dynamic array -> open array }
  482. if is_dynamic_array(def_from) and
  483. equal_defs(tarraydef(def_from).elementtype.def,tarraydef(def_to).elementtype.def) then
  484. begin
  485. doconv:=tc_dynarray_2_openarray;
  486. eq:=te_convert_l2;
  487. end
  488. else
  489. { array -> open array }
  490. if equal_defs(tarraydef(def_from).elementtype.def,tarraydef(def_to).elementtype.def) then
  491. eq:=te_equal;
  492. end
  493. else
  494. { to array of const }
  495. if is_array_of_const(def_to) then
  496. begin
  497. if is_array_of_const(def_from) or
  498. is_array_constructor(def_from) then
  499. begin
  500. eq:=te_equal;
  501. end
  502. else
  503. { array of tvarrec -> array of const }
  504. if equal_defs(tarraydef(def_to).elementtype.def,tarraydef(def_from).elementtype.def) then
  505. begin
  506. doconv:=tc_equal;
  507. eq:=te_convert_l1;
  508. end;
  509. end
  510. else
  511. { other arrays }
  512. begin
  513. { open array -> array }
  514. if is_open_array(def_from) and
  515. equal_defs(tarraydef(def_from).elementtype.def,tarraydef(def_to).elementtype.def) then
  516. begin
  517. eq:=te_equal
  518. end
  519. else
  520. { array -> array }
  521. if not(m_tp7 in aktmodeswitches) and
  522. not(m_delphi in aktmodeswitches) and
  523. (tarraydef(def_from).lowrange=tarraydef(def_to).lowrange) and
  524. (tarraydef(def_from).highrange=tarraydef(def_to).highrange) and
  525. equal_defs(tarraydef(def_from).elementtype.def,tarraydef(def_to).elementtype.def) and
  526. equal_defs(tarraydef(def_from).rangetype.def,tarraydef(def_to).rangetype.def) then
  527. begin
  528. eq:=te_equal
  529. end;
  530. end;
  531. end;
  532. pointerdef :
  533. begin
  534. { nil and voidpointers are compatible with dyn. arrays }
  535. if is_dynamic_array(def_to) and
  536. ((fromtreetype=niln) or
  537. is_voidpointer(def_from)) then
  538. begin
  539. doconv:=tc_equal;
  540. eq:=te_convert_l1;
  541. end
  542. else
  543. if is_zero_based_array(def_to) and
  544. equal_defs(tpointerdef(def_from).pointertype.def,tarraydef(def_to).elementtype.def) then
  545. begin
  546. doconv:=tc_pointer_2_array;
  547. eq:=te_convert_l1;
  548. end;
  549. end;
  550. stringdef :
  551. begin
  552. { string to char array }
  553. if (not is_special_array(def_to)) and
  554. is_char(tarraydef(def_to).elementtype.def) then
  555. begin
  556. doconv:=tc_string_2_chararray;
  557. eq:=te_convert_l1;
  558. end;
  559. end;
  560. orddef:
  561. begin
  562. if is_chararray(def_to) and
  563. is_char(def_from) then
  564. begin
  565. doconv:=tc_char_2_chararray;
  566. eq:=te_convert_l2;
  567. end;
  568. end;
  569. recorddef :
  570. begin
  571. { tvarrec -> array of const }
  572. if is_array_of_const(def_to) and
  573. equal_defs(def_from,tarraydef(def_to).elementtype.def) then
  574. begin
  575. doconv:=tc_equal;
  576. eq:=te_convert_l1;
  577. end;
  578. end;
  579. variantdef :
  580. begin
  581. if is_dynamic_array(def_to) then
  582. begin
  583. doconv:=tc_variant_2_dynarray;
  584. eq:=te_convert_l1;
  585. end;
  586. end;
  587. end;
  588. end;
  589. end;
  590. variantdef :
  591. begin
  592. if (cdo_allow_variant in cdoptions) then
  593. begin
  594. case def_from.deftype of
  595. enumdef :
  596. begin
  597. doconv:=tc_enum_2_variant;
  598. eq:=te_convert_l1;
  599. end;
  600. arraydef :
  601. begin
  602. if is_dynamic_array(def_from) then
  603. begin
  604. doconv:=tc_dynarray_2_variant;
  605. eq:=te_convert_l1;
  606. end;
  607. end;
  608. end;
  609. end;
  610. end;
  611. pointerdef :
  612. begin
  613. case def_from.deftype of
  614. stringdef :
  615. begin
  616. { string constant (which can be part of array constructor)
  617. to zero terminated string constant }
  618. if (fromtreetype in [arrayconstructorn,stringconstn]) and
  619. (is_pchar(def_to) or is_pwidechar(def_to)) then
  620. begin
  621. doconv:=tc_cstring_2_pchar;
  622. eq:=te_convert_l1;
  623. end
  624. else
  625. if cdo_explicit in cdoptions then
  626. begin
  627. { pchar(ansistring) }
  628. if is_pchar(def_to) and
  629. is_ansistring(def_from) then
  630. begin
  631. doconv:=tc_ansistring_2_pchar;
  632. eq:=te_convert_l1;
  633. end
  634. else
  635. { pwidechar(ansistring) }
  636. if is_pwidechar(def_to) and
  637. is_widestring(def_from) then
  638. begin
  639. doconv:=tc_ansistring_2_pchar;
  640. eq:=te_convert_l1;
  641. end;
  642. end;
  643. end;
  644. orddef :
  645. begin
  646. { char constant to zero terminated string constant }
  647. if (fromtreetype=ordconstn) then
  648. begin
  649. if is_char(def_from) and
  650. is_pchar(def_to) then
  651. begin
  652. doconv:=tc_cchar_2_pchar;
  653. eq:=te_convert_l1;
  654. end
  655. else
  656. if (m_delphi in aktmodeswitches) and is_integer(def_from) then
  657. begin
  658. doconv:=tc_cord_2_pointer;
  659. eq:=te_convert_l1;
  660. end;
  661. end;
  662. { delphi compatible, allow explicit typecasts from
  663. ordinals to pointer.
  664. It is also used by the compiler internally for inc(pointer,ordinal) }
  665. if (eq=te_incompatible) and
  666. not is_void(def_from) and
  667. (
  668. (
  669. (m_delphi in aktmodeswitches) and
  670. (cdo_explicit in cdoptions)
  671. ) or
  672. (cdo_internal in cdoptions)
  673. ) then
  674. begin
  675. doconv:=tc_int_2_int;
  676. eq:=te_convert_l1;
  677. end;
  678. end;
  679. arraydef :
  680. begin
  681. { chararray to pointer }
  682. if is_zero_based_array(def_from) and
  683. equal_defs(tarraydef(def_from).elementtype.def,tpointerdef(def_to).pointertype.def) then
  684. begin
  685. doconv:=tc_array_2_pointer;
  686. eq:=te_convert_l1;
  687. end
  688. else
  689. { dynamic array to pointer, delphi only }
  690. if (m_delphi in aktmodeswitches) and
  691. is_dynamic_array(def_from) then
  692. begin
  693. eq:=te_equal;
  694. end;
  695. end;
  696. pointerdef :
  697. begin
  698. { check for far pointers }
  699. if (tpointerdef(def_from).is_far<>tpointerdef(def_to).is_far) then
  700. begin
  701. eq:=te_incompatible;
  702. end
  703. else
  704. { the types can be forward type, handle before normal type check !! }
  705. if assigned(def_to.typesym) and
  706. (tpointerdef(def_to).pointertype.def.deftype=forwarddef) then
  707. begin
  708. if (def_from.typesym=def_to.typesym) then
  709. eq:=te_equal
  710. end
  711. else
  712. { same types }
  713. if equal_defs(tpointerdef(def_from).pointertype.def,tpointerdef(def_to).pointertype.def) then
  714. begin
  715. eq:=te_equal
  716. end
  717. else
  718. { child class pointer can be assigned to anchestor pointers }
  719. if (
  720. (tpointerdef(def_from).pointertype.def.deftype=objectdef) and
  721. (tpointerdef(def_to).pointertype.def.deftype=objectdef) and
  722. tobjectdef(tpointerdef(def_from).pointertype.def).is_related(
  723. tobjectdef(tpointerdef(def_to).pointertype.def))
  724. ) then
  725. begin
  726. doconv:=tc_equal;
  727. eq:=te_convert_l1;
  728. end
  729. else
  730. { all pointers can be assigned to void-pointer }
  731. if is_void(tpointerdef(def_to).pointertype.def) then
  732. begin
  733. doconv:=tc_equal;
  734. { give pwidechar,pchar a penalty so it prefers
  735. conversion to ansistring }
  736. if is_pchar(def_from) or
  737. is_pwidechar(def_from) then
  738. eq:=te_convert_l2
  739. else
  740. eq:=te_convert_l1;
  741. end
  742. else
  743. { all pointers can be assigned from void-pointer }
  744. if is_void(tpointerdef(def_from).pointertype.def) then
  745. begin
  746. doconv:=tc_equal;
  747. { give pwidechar a penalty so it prefers
  748. conversion to pchar }
  749. if is_pwidechar(def_to) then
  750. eq:=te_convert_l2
  751. else
  752. eq:=te_convert_l1;
  753. end;
  754. end;
  755. procvardef :
  756. begin
  757. { procedure variable can be assigned to an void pointer,
  758. this not allowed for methodpointers }
  759. if is_void(tpointerdef(def_to).pointertype.def) and
  760. tprocvardef(def_from).is_addressonly then
  761. begin
  762. doconv:=tc_equal;
  763. eq:=te_convert_l1;
  764. end;
  765. end;
  766. classrefdef,
  767. objectdef :
  768. begin
  769. { class types and class reference type
  770. can be assigned to void pointers, but it is less
  771. preferred than assigning to a related objectdef }
  772. if (
  773. is_class_or_interface(def_from) or
  774. (def_from.deftype=classrefdef)
  775. ) and
  776. (tpointerdef(def_to).pointertype.def.deftype=orddef) and
  777. (torddef(tpointerdef(def_to).pointertype.def).typ=uvoid) then
  778. begin
  779. doconv:=tc_equal;
  780. eq:=te_convert_l2;
  781. end;
  782. end;
  783. end;
  784. end;
  785. setdef :
  786. begin
  787. case def_from.deftype of
  788. setdef :
  789. begin
  790. if assigned(tsetdef(def_from).elementtype.def) and
  791. assigned(tsetdef(def_to).elementtype.def) then
  792. begin
  793. { sets with the same element base type are equal }
  794. if is_subequal(tsetdef(def_from).elementtype.def,tsetdef(def_to).elementtype.def) then
  795. eq:=te_equal;
  796. end
  797. else
  798. { empty set is compatible with everything }
  799. eq:=te_equal;
  800. end;
  801. arraydef :
  802. begin
  803. { automatic arrayconstructor -> set conversion }
  804. if is_array_constructor(def_from) then
  805. begin
  806. doconv:=tc_arrayconstructor_2_set;
  807. eq:=te_convert_l1;
  808. end;
  809. end;
  810. end;
  811. end;
  812. procvardef :
  813. begin
  814. case def_from.deftype of
  815. procdef :
  816. begin
  817. { proc -> procvar }
  818. if (m_tp_procvar in aktmodeswitches) then
  819. begin
  820. subeq:=proc_to_procvar_equal(tprocdef(def_from),tprocvardef(def_to),true);
  821. if subeq>te_incompatible then
  822. begin
  823. doconv:=tc_proc_2_procvar;
  824. eq:=te_convert_l1;
  825. end;
  826. end;
  827. end;
  828. procvardef :
  829. begin
  830. { procvar -> procvar }
  831. eq:=proc_to_procvar_equal(tprocvardef(def_from),tprocvardef(def_to),false);
  832. end;
  833. pointerdef :
  834. begin
  835. { nil is compatible with procvars }
  836. if (fromtreetype=niln) then
  837. begin
  838. doconv:=tc_equal;
  839. eq:=te_convert_l1;
  840. end
  841. else
  842. { for example delphi allows the assignement from pointers }
  843. { to procedure variables }
  844. if (m_pointer_2_procedure in aktmodeswitches) and
  845. is_void(tpointerdef(def_from).pointertype.def) and
  846. tprocvardef(def_to).is_addressonly then
  847. begin
  848. doconv:=tc_equal;
  849. eq:=te_convert_l1;
  850. end;
  851. end;
  852. end;
  853. end;
  854. objectdef :
  855. begin
  856. { object pascal objects }
  857. if (def_from.deftype=objectdef) and
  858. (tobjectdef(def_from).is_related(tobjectdef(def_to))) then
  859. begin
  860. doconv:=tc_equal;
  861. eq:=te_convert_l1;
  862. end
  863. else
  864. { Class/interface specific }
  865. if is_class_or_interface(def_to) then
  866. begin
  867. { void pointer also for delphi mode }
  868. if (m_delphi in aktmodeswitches) and
  869. is_voidpointer(def_from) then
  870. begin
  871. doconv:=tc_equal;
  872. { prefer pointer-pointer assignments }
  873. eq:=te_convert_l2;
  874. end
  875. else
  876. { nil is compatible with class instances and interfaces }
  877. if (fromtreetype=niln) then
  878. begin
  879. doconv:=tc_equal;
  880. eq:=te_convert_l1;
  881. end
  882. { classes can be assigned to interfaces }
  883. else if is_interface(def_to) and
  884. is_class(def_from) and
  885. assigned(tobjectdef(def_from).implementedinterfaces) then
  886. begin
  887. { we've to search in parent classes as well }
  888. hd3:=tobjectdef(def_from);
  889. while assigned(hd3) do
  890. begin
  891. if hd3.implementedinterfaces.searchintf(def_to)<>-1 then
  892. begin
  893. doconv:=tc_class_2_intf;
  894. eq:=te_convert_l1;
  895. break;
  896. end;
  897. hd3:=hd3.childof;
  898. end;
  899. end
  900. { Interface 2 GUID handling }
  901. else if (def_to=tdef(rec_tguid)) and
  902. (fromtreetype=typen) and
  903. is_interface(def_from) and
  904. assigned(tobjectdef(def_from).iidguid) then
  905. begin
  906. eq:=te_convert_l1;
  907. doconv:=tc_equal;
  908. end;
  909. end;
  910. end;
  911. classrefdef :
  912. begin
  913. { similar to pointerdef wrt forwards }
  914. if assigned(def_to.typesym) and
  915. (tclassrefdef(def_to).pointertype.def.deftype=forwarddef) then
  916. begin
  917. if (def_from.typesym=def_to.typesym) then
  918. eq:=te_equal;
  919. end
  920. else
  921. { class reference types }
  922. if (def_from.deftype=classrefdef) then
  923. begin
  924. if equal_defs(tclassrefdef(def_from).pointertype.def,tclassrefdef(def_to).pointertype.def) then
  925. begin
  926. eq:=te_equal;
  927. end
  928. else
  929. begin
  930. doconv:=tc_equal;
  931. if (cdo_explicit in cdoptions) or
  932. tobjectdef(tclassrefdef(def_from).pointertype.def).is_related(
  933. tobjectdef(tclassrefdef(def_to).pointertype.def)) then
  934. eq:=te_convert_l1;
  935. end;
  936. end
  937. else
  938. { nil is compatible with class references }
  939. if (fromtreetype=niln) then
  940. begin
  941. doconv:=tc_equal;
  942. eq:=te_convert_l1;
  943. end;
  944. end;
  945. filedef :
  946. begin
  947. { typed files are all equal to the abstract file type
  948. name TYPEDFILE in system.pp in is_equal in types.pas
  949. the problem is that it sholud be also compatible to FILE
  950. but this would leed to a problem for ASSIGN RESET and REWRITE
  951. when trying to find the good overloaded function !!
  952. so all file function are doubled in system.pp
  953. this is not very beautiful !!}
  954. if (def_from.deftype=filedef) then
  955. begin
  956. if (tfiledef(def_from).filetyp=tfiledef(def_to).filetyp) then
  957. begin
  958. if
  959. (
  960. (tfiledef(def_from).typedfiletype.def=nil) and
  961. (tfiledef(def_to).typedfiletype.def=nil)
  962. ) or
  963. (
  964. (tfiledef(def_from).typedfiletype.def<>nil) and
  965. (tfiledef(def_to).typedfiletype.def<>nil) and
  966. equal_defs(tfiledef(def_from).typedfiletype.def,tfiledef(def_to).typedfiletype.def)
  967. ) or
  968. (
  969. (tfiledef(def_from).filetyp = ft_typed) and
  970. (tfiledef(def_to).filetyp = ft_typed) and
  971. (
  972. (tfiledef(def_from).typedfiletype.def = tdef(voidtype.def)) or
  973. (tfiledef(def_to).typedfiletype.def = tdef(voidtype.def))
  974. )
  975. ) then
  976. begin
  977. eq:=te_equal;
  978. end;
  979. end
  980. else
  981. if ((tfiledef(def_from).filetyp = ft_untyped) and
  982. (tfiledef(def_to).filetyp = ft_typed)) or
  983. ((tfiledef(def_from).filetyp = ft_typed) and
  984. (tfiledef(def_to).filetyp = ft_untyped)) then
  985. begin
  986. doconv:=tc_equal;
  987. eq:=te_convert_l1;
  988. end;
  989. end;
  990. end;
  991. recorddef :
  992. begin
  993. { interface -> guid }
  994. if is_interface(def_from) and
  995. (def_to=rec_tguid) then
  996. begin
  997. doconv:=tc_intf_2_guid;
  998. eq:=te_convert_l1;
  999. end;
  1000. end;
  1001. formaldef :
  1002. begin
  1003. doconv:=tc_equal;
  1004. if (def_from.deftype=formaldef) then
  1005. eq:=te_equal
  1006. else
  1007. { Just about everything can be converted to a formaldef...}
  1008. if not (def_from.deftype in [abstractdef,errordef]) then
  1009. eq:=te_convert_l1;
  1010. end;
  1011. end;
  1012. { if we didn't find an appropriate type conversion yet
  1013. then we search also the := operator }
  1014. if (eq=te_incompatible) and
  1015. (
  1016. { Check for variants? }
  1017. (
  1018. (cdo_allow_variant in cdoptions) and
  1019. ((def_from.deftype=variantdef) or (def_to.deftype=variantdef))
  1020. ) or
  1021. { Check for operators? }
  1022. (
  1023. (cdo_check_operator in cdoptions) and
  1024. ((def_from.deftype in [objectdef,recorddef,arraydef,stringdef,variantdef]) or
  1025. (def_to.deftype in [objectdef,recorddef,arraydef,stringdef,variantdef]))
  1026. )
  1027. ) then
  1028. begin
  1029. operatorpd:=search_assignment_operator(def_from,def_to);
  1030. if assigned(operatorpd) then
  1031. eq:=te_convert_operator;
  1032. end;
  1033. { update convtype for te_equal when it is not yet set }
  1034. if (eq=te_equal) and
  1035. (doconv=tc_not_possible) then
  1036. doconv:=tc_equal;
  1037. compare_defs_ext:=eq;
  1038. end;
  1039. function equal_defs(def_from,def_to:tdef):boolean;
  1040. var
  1041. convtyp : tconverttype;
  1042. pd : tprocdef;
  1043. begin
  1044. { Compare defs with nothingn and no explicit typecasts and
  1045. searching for overloaded operators is not needed }
  1046. equal_defs:=(compare_defs_ext(def_from,def_to,nothingn,convtyp,pd,[])>=te_equal);
  1047. end;
  1048. function compare_defs(def_from,def_to:tdef;fromtreetype:tnodetype):tequaltype;
  1049. var
  1050. doconv : tconverttype;
  1051. pd : tprocdef;
  1052. begin
  1053. compare_defs:=compare_defs_ext(def_from,def_to,fromtreetype,doconv,pd,[cdo_check_operator,cdo_allow_variant]);
  1054. end;
  1055. function is_subequal(def1, def2: tdef): boolean;
  1056. var
  1057. basedef1,basedef2 : tenumdef;
  1058. Begin
  1059. is_subequal := false;
  1060. if assigned(def1) and assigned(def2) then
  1061. Begin
  1062. if (def1.deftype = orddef) and (def2.deftype = orddef) then
  1063. Begin
  1064. { see p.47 of Turbo Pascal 7.01 manual for the separation of types }
  1065. { range checking for case statements is done with testrange }
  1066. case torddef(def1).typ of
  1067. u8bit,u16bit,u32bit,u64bit,
  1068. s8bit,s16bit,s32bit,s64bit :
  1069. is_subequal:=(torddef(def2).typ in [s64bit,u64bit,s32bit,u32bit,u8bit,s8bit,s16bit,u16bit]);
  1070. bool8bit,bool16bit,bool32bit :
  1071. is_subequal:=(torddef(def2).typ in [bool8bit,bool16bit,bool32bit]);
  1072. uchar :
  1073. is_subequal:=(torddef(def2).typ=uchar);
  1074. uwidechar :
  1075. is_subequal:=(torddef(def2).typ=uwidechar);
  1076. end;
  1077. end
  1078. else
  1079. Begin
  1080. { Check if both basedefs are equal }
  1081. if (def1.deftype=enumdef) and (def2.deftype=enumdef) then
  1082. Begin
  1083. { get both basedefs }
  1084. basedef1:=tenumdef(def1);
  1085. while assigned(basedef1.basedef) do
  1086. basedef1:=basedef1.basedef;
  1087. basedef2:=tenumdef(def2);
  1088. while assigned(basedef2.basedef) do
  1089. basedef2:=basedef2.basedef;
  1090. is_subequal:=(basedef1=basedef2);
  1091. end;
  1092. end;
  1093. end;
  1094. end;
  1095. function compare_paras(para1,para2 : tlist; acp : tcompare_paras_type; cpoptions: tcompare_paras_options):tequaltype;
  1096. var
  1097. currpara1,
  1098. currpara2 : tparavarsym;
  1099. eq,lowesteq : tequaltype;
  1100. hpd : tprocdef;
  1101. convtype : tconverttype;
  1102. cdoptions : tcompare_defs_options;
  1103. i1,i2 : byte;
  1104. begin
  1105. compare_paras:=te_incompatible;
  1106. cdoptions:=[cdo_check_operator,cdo_allow_variant];
  1107. { we need to parse the list from left-right so the
  1108. not-default parameters are checked first }
  1109. lowesteq:=high(tequaltype);
  1110. i1:=0;
  1111. i2:=0;
  1112. if cpo_ignorehidden in cpoptions then
  1113. begin
  1114. while (i1<para1.count) and
  1115. (vo_is_hidden_para in tparavarsym(para1[i1]).varoptions) do
  1116. inc(i1);
  1117. while (i2<para2.count) and
  1118. (vo_is_hidden_para in tparavarsym(para2[i2]).varoptions) do
  1119. inc(i2);
  1120. end;
  1121. while (i1<para1.count) and (i2<para2.count) do
  1122. begin
  1123. eq:=te_incompatible;
  1124. currpara1:=tparavarsym(para1[i1]);
  1125. currpara2:=tparavarsym(para2[i2]);
  1126. { Unique types must match exact }
  1127. if ((df_unique in currpara1.vartype.def.defoptions) or (df_unique in currpara2.vartype.def.defoptions)) and
  1128. (currpara1.vartype.def<>currpara2.vartype.def) then
  1129. exit;
  1130. { Handle hidden parameters separately, because self is
  1131. defined as voidpointer for methodpointers }
  1132. if (vo_is_hidden_para in currpara1.varoptions) or
  1133. (vo_is_hidden_para in currpara2.varoptions) then
  1134. begin
  1135. { both must be hidden }
  1136. if (vo_is_hidden_para in currpara1.varoptions)<>(vo_is_hidden_para in currpara2.varoptions) then
  1137. exit;
  1138. eq:=te_equal;
  1139. if not(vo_is_self in currpara1.varoptions) and
  1140. not(vo_is_self in currpara2.varoptions) then
  1141. begin
  1142. if (currpara1.varspez<>currpara2.varspez) then
  1143. exit;
  1144. eq:=compare_defs_ext(currpara1.vartype.def,currpara2.vartype.def,nothingn,
  1145. convtype,hpd,cdoptions);
  1146. end;
  1147. end
  1148. else
  1149. begin
  1150. case acp of
  1151. cp_value_equal_const :
  1152. begin
  1153. if (
  1154. (currpara1.varspez<>currpara2.varspez) and
  1155. ((currpara1.varspez in [vs_var,vs_out]) or
  1156. (currpara2.varspez in [vs_var,vs_out]))
  1157. ) then
  1158. exit;
  1159. eq:=compare_defs_ext(currpara1.vartype.def,currpara2.vartype.def,nothingn,
  1160. convtype,hpd,cdoptions);
  1161. end;
  1162. cp_all :
  1163. begin
  1164. if (currpara1.varspez<>currpara2.varspez) then
  1165. exit;
  1166. eq:=compare_defs_ext(currpara1.vartype.def,currpara2.vartype.def,nothingn,
  1167. convtype,hpd,cdoptions);
  1168. end;
  1169. cp_procvar :
  1170. begin
  1171. if (currpara1.varspez<>currpara2.varspez) then
  1172. exit;
  1173. eq:=compare_defs_ext(currpara1.vartype.def,currpara2.vartype.def,nothingn,
  1174. convtype,hpd,cdoptions);
  1175. { Parameters must be at least equal otherwise the are incompatible }
  1176. if (eq<te_equal) then
  1177. eq:=te_incompatible;
  1178. end;
  1179. else
  1180. eq:=compare_defs_ext(currpara1.vartype.def,currpara2.vartype.def,nothingn,
  1181. convtype,hpd,cdoptions);
  1182. end;
  1183. end;
  1184. { check type }
  1185. if eq=te_incompatible then
  1186. exit;
  1187. if eq<lowesteq then
  1188. lowesteq:=eq;
  1189. { also check default value if both have it declared }
  1190. if (cpo_comparedefaultvalue in cpoptions) and
  1191. assigned(currpara1.defaultconstsym) and
  1192. assigned(currpara2.defaultconstsym) then
  1193. begin
  1194. if not equal_constsym(tconstsym(currpara1.defaultconstsym),tconstsym(currpara2.defaultconstsym)) then
  1195. exit;
  1196. end;
  1197. inc(i1);
  1198. inc(i2);
  1199. if cpo_ignorehidden in cpoptions then
  1200. begin
  1201. while (i1<para1.count) and
  1202. (vo_is_hidden_para in tparavarsym(para1[i1]).varoptions) do
  1203. inc(i1);
  1204. while (i2<para2.count) and
  1205. (vo_is_hidden_para in tparavarsym(para2[i2]).varoptions) do
  1206. inc(i2);
  1207. end;
  1208. end;
  1209. { when both lists are empty then the parameters are equal. Also
  1210. when one list is empty and the other has a parameter with default
  1211. value assigned then the parameters are also equal }
  1212. if ((i1>=para1.count) and (i2>=para2.count)) or
  1213. ((cpo_allowdefaults in cpoptions) and
  1214. (((i1<para1.count) and assigned(tparavarsym(para1[i1]).defaultconstsym)) or
  1215. ((i2<para2.count) and assigned(tparavarsym(para2[i2]).defaultconstsym)))) then
  1216. compare_paras:=lowesteq;
  1217. end;
  1218. function proc_to_procvar_equal(def1:tabstractprocdef;def2:tprocvardef;methoderr:boolean):tequaltype;
  1219. var
  1220. eq : tequaltype;
  1221. po_comp : tprocoptions;
  1222. begin
  1223. proc_to_procvar_equal:=te_incompatible;
  1224. if not(assigned(def1)) or not(assigned(def2)) then
  1225. exit;
  1226. { check for method pointer }
  1227. if (def1.is_methodpointer xor def2.is_methodpointer) or
  1228. (def1.is_addressonly xor def2.is_addressonly) then
  1229. begin
  1230. if methoderr then
  1231. Message(type_e_no_method_and_procedure_not_compatible);
  1232. exit;
  1233. end;
  1234. { check return value and options, methodpointer is already checked }
  1235. po_comp:=[po_staticmethod,po_interrupt,
  1236. po_iocheck,po_varargs];
  1237. if (m_delphi in aktmodeswitches) then
  1238. exclude(po_comp,po_varargs);
  1239. if (def1.proccalloption=def2.proccalloption) and
  1240. ((po_comp * def1.procoptions)= (po_comp * def2.procoptions)) and
  1241. equal_defs(def1.rettype.def,def2.rettype.def) then
  1242. begin
  1243. { return equal type based on the parameters, but a proc->procvar
  1244. is never exact, so map an exact match of the parameters to
  1245. te_equal }
  1246. eq:=compare_paras(def1.paras,def2.paras,cp_procvar,[]);
  1247. if eq=te_exact then
  1248. eq:=te_equal;
  1249. proc_to_procvar_equal:=eq;
  1250. end;
  1251. end;
  1252. end.
  1253. {
  1254. $Log$
  1255. Revision 1.62 2004-12-05 12:28:10 peter
  1256. * procvar handling for tp procvar mode fixed
  1257. * proc to procvar moved from addrnode to typeconvnode
  1258. * inlininginfo is now allocated only for inline routines that
  1259. can be inlined, introduced a new flag po_has_inlining_info
  1260. Revision 1.61 2004/11/29 17:32:56 peter
  1261. * prevent some IEs with delphi methodpointers
  1262. Revision 1.60 2004/11/26 22:33:54 peter
  1263. * don't allow pointer(ordinal) typecast in fpc mode, only allow it
  1264. for delphi and for internal use
  1265. Revision 1.59 2004/11/15 23:35:31 peter
  1266. * tparaitem removed, use tparavarsym instead
  1267. * parameter order is now calculated from paranr value in tparavarsym
  1268. Revision 1.58 2004/11/08 22:09:58 peter
  1269. * tvarsym splitted
  1270. Revision 1.57 2004/11/01 10:31:48 peter
  1271. * procvar arguments need to be at least equal
  1272. Revision 1.56 2004/11/01 08:02:26 peter
  1273. * remove previous patch
  1274. Revision 1.55 2004/10/31 22:05:25 peter
  1275. * only allow ordinal-pointer for same size
  1276. Revision 1.54 2004/10/31 21:45:02 peter
  1277. * generic tlocation
  1278. * move tlocation to cgutils
  1279. Revision 1.53 2004/09/21 15:52:35 peter
  1280. * prefer pchar-string over pchar-pointer
  1281. Revision 1.52 2004/09/16 16:32:44 peter
  1282. * dynarr-pointer is allowed under delphi
  1283. Revision 1.51 2004/06/20 08:55:29 florian
  1284. * logs truncated
  1285. Revision 1.50 2004/04/12 11:26:10 peter
  1286. * voidpointer can be converted to dynarray
  1287. Revision 1.49 2004/03/04 17:22:32 peter
  1288. * use defs_equal when comparing pointer types
  1289. Revision 1.48 2004/03/03 22:02:16 peter
  1290. * also compare calling convention in proc_to_procvar_equal
  1291. Revision 1.47 2004/02/24 16:12:39 peter
  1292. * operator overload chooses rewrite
  1293. * overload choosing is now generic and moved to htypechk
  1294. Revision 1.46 2004/02/15 12:18:22 peter
  1295. * allow real_2_real conversion for realconstn, fixes 2971
  1296. }