defcmp.pas 54 KB

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