defcmp.pas 54 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353
  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. if not(explicit) or
  367. not(m_delphi in aktmodeswitches) then
  368. begin
  369. doconv:=tc_real_2_real;
  370. eq:=te_convert_l1;
  371. end;
  372. end;
  373. end;
  374. end;
  375. end;
  376. enumdef :
  377. begin
  378. case def_from.deftype of
  379. enumdef :
  380. begin
  381. if explicit then
  382. begin
  383. eq:=te_convert_l1;
  384. doconv:=tc_int_2_int;
  385. end
  386. else
  387. begin
  388. hd1:=def_from;
  389. while assigned(tenumdef(hd1).basedef) do
  390. hd1:=tenumdef(hd1).basedef;
  391. hd2:=def_to;
  392. while assigned(tenumdef(hd2).basedef) do
  393. hd2:=tenumdef(hd2).basedef;
  394. if (hd1=hd2) then
  395. begin
  396. eq:=te_convert_l1;
  397. { because of packenum they can have different sizes! (JM) }
  398. doconv:=tc_int_2_int;
  399. end;
  400. end;
  401. end;
  402. orddef :
  403. begin
  404. if explicit then
  405. begin
  406. eq:=te_convert_l1;
  407. doconv:=tc_int_2_int;
  408. end;
  409. end;
  410. end;
  411. end;
  412. arraydef :
  413. begin
  414. { open array is also compatible with a single element of its base type }
  415. if is_open_array(def_to) and
  416. equal_defs(def_from,tarraydef(def_to).elementtype.def) then
  417. begin
  418. doconv:=tc_equal;
  419. eq:=te_convert_l1;
  420. end
  421. else
  422. begin
  423. case def_from.deftype of
  424. arraydef :
  425. begin
  426. { to dynamic array }
  427. if is_dynamic_array(def_to) then
  428. begin
  429. { dynamic array -> dynamic array }
  430. if is_dynamic_array(def_from) and
  431. equal_defs(tarraydef(def_from).elementtype.def,tarraydef(def_to).elementtype.def) then
  432. eq:=te_equal;
  433. end
  434. else
  435. { to open array }
  436. if is_open_array(def_to) then
  437. begin
  438. { array constructor -> open array }
  439. if is_array_constructor(def_from) then
  440. begin
  441. if is_void(tarraydef(def_from).elementtype.def) then
  442. begin
  443. doconv:=tc_equal;
  444. eq:=te_convert_l1;
  445. end
  446. else
  447. begin
  448. subeq:=compare_defs_ext(tarraydef(def_from).elementtype.def,
  449. tarraydef(def_to).elementtype.def,
  450. arrayconstructorn,false,true,hct,hpd);
  451. if (subeq>=te_equal) then
  452. begin
  453. doconv:=tc_equal;
  454. eq:=te_convert_l1;
  455. end
  456. else
  457. if (subeq>te_incompatible) then
  458. begin
  459. doconv:=hct;
  460. eq:=te_convert_l2;
  461. end;
  462. end;
  463. end
  464. else
  465. { dynamic array -> open array }
  466. if is_dynamic_array(def_from) and
  467. equal_defs(tarraydef(def_from).elementtype.def,tarraydef(def_to).elementtype.def) then
  468. begin
  469. doconv:=tc_dynarray_2_openarray;
  470. eq:=te_convert_l2;
  471. end
  472. else
  473. { array -> open array }
  474. if equal_defs(tarraydef(def_from).elementtype.def,tarraydef(def_to).elementtype.def) then
  475. eq:=te_equal;
  476. end
  477. else
  478. { to array of const }
  479. if is_array_of_const(def_to) then
  480. begin
  481. if is_array_of_const(def_from) or
  482. is_array_constructor(def_from) then
  483. begin
  484. eq:=te_equal;
  485. end
  486. else
  487. { array of tvarrec -> array of const }
  488. if equal_defs(tarraydef(def_to).elementtype.def,tarraydef(def_from).elementtype.def) then
  489. begin
  490. doconv:=tc_equal;
  491. eq:=te_convert_l1;
  492. end;
  493. end
  494. else
  495. { other arrays }
  496. begin
  497. { open array -> array }
  498. if is_open_array(def_from) and
  499. equal_defs(tarraydef(def_from).elementtype.def,tarraydef(def_to).elementtype.def) then
  500. begin
  501. eq:=te_equal
  502. end
  503. else
  504. { array -> array }
  505. if not(m_tp7 in aktmodeswitches) and
  506. not(m_delphi in aktmodeswitches) and
  507. (tarraydef(def_from).lowrange=tarraydef(def_to).lowrange) and
  508. (tarraydef(def_from).highrange=tarraydef(def_to).highrange) and
  509. equal_defs(tarraydef(def_from).elementtype.def,tarraydef(def_to).elementtype.def) and
  510. equal_defs(tarraydef(def_from).rangetype.def,tarraydef(def_to).rangetype.def) then
  511. begin
  512. eq:=te_equal
  513. end;
  514. end;
  515. end;
  516. pointerdef :
  517. begin
  518. { nil is compatible with dyn. arrays }
  519. if is_dynamic_array(def_to) and
  520. (fromtreetype=niln) then
  521. begin
  522. doconv:=tc_equal;
  523. eq:=te_convert_l1;
  524. end
  525. else
  526. if is_zero_based_array(def_to) and
  527. equal_defs(tpointerdef(def_from).pointertype.def,tarraydef(def_to).elementtype.def) then
  528. begin
  529. doconv:=tc_pointer_2_array;
  530. eq:=te_convert_l1;
  531. end;
  532. end;
  533. stringdef :
  534. begin
  535. { string to char array }
  536. if (not is_special_array(def_to)) and
  537. is_char(tarraydef(def_to).elementtype.def) then
  538. begin
  539. doconv:=tc_string_2_chararray;
  540. eq:=te_convert_l1;
  541. end;
  542. end;
  543. orddef:
  544. begin
  545. if is_chararray(def_to) and
  546. is_char(def_from) then
  547. begin
  548. doconv:=tc_char_2_chararray;
  549. eq:=te_convert_l2;
  550. end;
  551. end;
  552. recorddef :
  553. begin
  554. { tvarrec -> array of const }
  555. if is_array_of_const(def_to) and
  556. equal_defs(def_from,tarraydef(def_to).elementtype.def) then
  557. begin
  558. doconv:=tc_equal;
  559. eq:=te_convert_l1;
  560. end;
  561. end;
  562. variantdef :
  563. begin
  564. if is_dynamic_array(def_to) then
  565. begin
  566. doconv:=tc_variant_2_dynarray;
  567. eq:=te_convert_l1;
  568. end;
  569. end;
  570. end;
  571. end;
  572. end;
  573. pointerdef :
  574. begin
  575. case def_from.deftype of
  576. stringdef :
  577. begin
  578. { string constant (which can be part of array constructor)
  579. to zero terminated string constant }
  580. if (fromtreetype in [arrayconstructorn,stringconstn]) and
  581. (is_pchar(def_to) or is_pwidechar(def_to)) then
  582. begin
  583. doconv:=tc_cstring_2_pchar;
  584. eq:=te_convert_l1;
  585. end
  586. else
  587. if explicit then
  588. begin
  589. { pchar(ansistring) }
  590. if is_pchar(def_to) and
  591. is_ansistring(def_from) then
  592. begin
  593. doconv:=tc_ansistring_2_pchar;
  594. eq:=te_convert_l1;
  595. end
  596. else
  597. { pwidechar(ansistring) }
  598. if is_pwidechar(def_to) and
  599. is_widestring(def_from) then
  600. begin
  601. doconv:=tc_ansistring_2_pchar;
  602. eq:=te_convert_l1;
  603. end;
  604. end;
  605. end;
  606. orddef :
  607. begin
  608. { char constant to zero terminated string constant }
  609. if (fromtreetype=ordconstn) then
  610. begin
  611. if is_char(def_from) and
  612. is_pchar(def_to) then
  613. begin
  614. doconv:=tc_cchar_2_pchar;
  615. eq:=te_convert_l1;
  616. end
  617. else
  618. if is_integer(def_from) then
  619. begin
  620. doconv:=tc_cord_2_pointer;
  621. eq:=te_convert_l1;
  622. end;
  623. end;
  624. if (eq=te_incompatible) and
  625. explicit then
  626. begin
  627. doconv:=tc_int_2_int;
  628. eq:=te_convert_l1;
  629. end;
  630. end;
  631. arraydef :
  632. begin
  633. { chararray to pointer }
  634. if is_zero_based_array(def_from) and
  635. equal_defs(tarraydef(def_from).elementtype.def,tpointerdef(def_to).pointertype.def) then
  636. begin
  637. doconv:=tc_array_2_pointer;
  638. eq:=te_convert_l1;
  639. end;
  640. end;
  641. pointerdef :
  642. begin
  643. { check for far pointers }
  644. if (tpointerdef(def_from).is_far<>tpointerdef(def_to).is_far) then
  645. begin
  646. eq:=te_incompatible;
  647. end
  648. else
  649. { the types can be forward type, handle before normal type check !! }
  650. if assigned(def_to.typesym) and
  651. (tpointerdef(def_to).pointertype.def.deftype=forwarddef) then
  652. begin
  653. if (def_from.typesym=def_to.typesym) then
  654. eq:=te_equal
  655. end
  656. else
  657. { same types }
  658. if (tpointerdef(def_from).pointertype.def=tpointerdef(def_to).pointertype.def) then
  659. begin
  660. eq:=te_equal
  661. end
  662. else
  663. { child class pointer can be assigned to anchestor pointers }
  664. if (
  665. (tpointerdef(def_from).pointertype.def.deftype=objectdef) and
  666. (tpointerdef(def_to).pointertype.def.deftype=objectdef) and
  667. tobjectdef(tpointerdef(def_from).pointertype.def).is_related(
  668. tobjectdef(tpointerdef(def_to).pointertype.def))
  669. ) or
  670. { all pointers can be assigned to/from void-pointer }
  671. is_void(tpointerdef(def_to).pointertype.def) or
  672. is_void(tpointerdef(def_from).pointertype.def) then
  673. begin
  674. doconv:=tc_equal;
  675. { give pwidechar a penalty }
  676. if is_pwidechar(def_to) then
  677. eq:=te_convert_l2
  678. else
  679. eq:=te_convert_l1;
  680. end;
  681. end;
  682. procvardef :
  683. begin
  684. { procedure variable can be assigned to an void pointer }
  685. { Not anymore. Use the @ operator now.}
  686. if not(m_tp_procvar in aktmodeswitches) and
  687. { method pointers can't be assigned to void pointers
  688. not(tprocvardef(def_from).is_methodpointer) and }
  689. (tpointerdef(def_to).pointertype.def.deftype=orddef) and
  690. (torddef(tpointerdef(def_to).pointertype.def).typ=uvoid) then
  691. begin
  692. doconv:=tc_equal;
  693. eq:=te_convert_l1;
  694. end;
  695. end;
  696. classrefdef,
  697. objectdef :
  698. begin
  699. { class types and class reference type
  700. can be assigned to void pointers }
  701. if (
  702. is_class_or_interface(def_from) or
  703. (def_from.deftype=classrefdef)
  704. ) and
  705. (tpointerdef(def_to).pointertype.def.deftype=orddef) and
  706. (torddef(tpointerdef(def_to).pointertype.def).typ=uvoid) then
  707. begin
  708. doconv:=tc_equal;
  709. eq:=te_convert_l1;
  710. end;
  711. end;
  712. end;
  713. end;
  714. setdef :
  715. begin
  716. case def_from.deftype of
  717. setdef :
  718. begin
  719. if assigned(tsetdef(def_from).elementtype.def) and
  720. assigned(tsetdef(def_to).elementtype.def) then
  721. begin
  722. { sets with the same element base type are equal }
  723. if is_subequal(tsetdef(def_from).elementtype.def,tsetdef(def_to).elementtype.def) then
  724. eq:=te_equal;
  725. end
  726. else
  727. { empty set is compatible with everything }
  728. eq:=te_equal;
  729. end;
  730. arraydef :
  731. begin
  732. { automatic arrayconstructor -> set conversion }
  733. if is_array_constructor(def_from) then
  734. begin
  735. doconv:=tc_arrayconstructor_2_set;
  736. eq:=te_convert_l1;
  737. end;
  738. end;
  739. end;
  740. end;
  741. procvardef :
  742. begin
  743. case def_from.deftype of
  744. procdef :
  745. begin
  746. { proc -> procvar }
  747. if (m_tp_procvar in aktmodeswitches) then
  748. begin
  749. subeq:=proc_to_procvar_equal(tprocdef(def_from),tprocvardef(def_to),true);
  750. if subeq>te_incompatible then
  751. begin
  752. doconv:=tc_proc_2_procvar;
  753. eq:=te_convert_l1;
  754. end;
  755. end;
  756. end;
  757. procvardef :
  758. begin
  759. { procvar -> procvar }
  760. eq:=proc_to_procvar_equal(tprocvardef(def_from),tprocvardef(def_to),false);
  761. end;
  762. pointerdef :
  763. begin
  764. { nil is compatible with procvars }
  765. if (fromtreetype=niln) then
  766. begin
  767. doconv:=tc_equal;
  768. eq:=te_convert_l1;
  769. end
  770. else
  771. { for example delphi allows the assignement from pointers }
  772. { to procedure variables }
  773. if (m_pointer_2_procedure in aktmodeswitches) and
  774. (tpointerdef(def_from).pointertype.def.deftype=orddef) and
  775. (torddef(tpointerdef(def_from).pointertype.def).typ=uvoid) then
  776. begin
  777. doconv:=tc_equal;
  778. eq:=te_convert_l1;
  779. end;
  780. end;
  781. end;
  782. end;
  783. objectdef :
  784. begin
  785. { object pascal objects }
  786. if (def_from.deftype=objectdef) and
  787. (tobjectdef(def_from).is_related(tobjectdef(def_to)) or
  788. tobjectdef(def_to).is_related(tobjectdef(def_from))) then
  789. begin
  790. doconv:=tc_equal;
  791. eq:=te_convert_l1;
  792. end
  793. else
  794. { Class/interface specific }
  795. if is_class_or_interface(def_to) then
  796. begin
  797. { void pointer also for delphi mode }
  798. if (m_delphi in aktmodeswitches) and
  799. is_voidpointer(def_from) then
  800. begin
  801. doconv:=tc_equal;
  802. eq:=te_convert_l1;
  803. end
  804. else
  805. { nil is compatible with class instances and interfaces }
  806. if (fromtreetype=niln) then
  807. begin
  808. doconv:=tc_equal;
  809. eq:=te_convert_l1;
  810. end
  811. { classes can be assigned to interfaces }
  812. else if is_interface(def_to) and
  813. is_class(def_from) and
  814. assigned(tobjectdef(def_from).implementedinterfaces) then
  815. begin
  816. { we've to search in parent classes as well }
  817. hd3:=tobjectdef(def_from);
  818. while assigned(hd3) do
  819. begin
  820. if hd3.implementedinterfaces.searchintf(def_to)<>-1 then
  821. begin
  822. doconv:=tc_class_2_intf;
  823. eq:=te_convert_l1;
  824. break;
  825. end;
  826. hd3:=hd3.childof;
  827. end;
  828. end
  829. { Interface 2 GUID handling }
  830. else if (def_to=tdef(rec_tguid)) and
  831. (fromtreetype=typen) and
  832. is_interface(def_from) and
  833. assigned(tobjectdef(def_from).iidguid) then
  834. begin
  835. eq:=te_convert_l1;
  836. doconv:=tc_equal;
  837. end;
  838. end;
  839. end;
  840. classrefdef :
  841. begin
  842. { similar to pointerdef wrt forwards }
  843. if assigned(def_to.typesym) and
  844. (tclassrefdef(def_to).pointertype.def.deftype=forwarddef) then
  845. begin
  846. if (def_from.typesym=def_to.typesym) then
  847. eq:=te_equal;
  848. end
  849. else
  850. { class reference types }
  851. if (def_from.deftype=classrefdef) then
  852. begin
  853. if equal_defs(tclassrefdef(def_from).pointertype.def,tclassrefdef(def_to).pointertype.def) then
  854. begin
  855. eq:=te_equal;
  856. end
  857. else
  858. begin
  859. doconv:=tc_equal;
  860. if explicit or
  861. tobjectdef(tclassrefdef(def_from).pointertype.def).is_related(
  862. tobjectdef(tclassrefdef(def_to).pointertype.def)) then
  863. eq:=te_convert_l1;
  864. end;
  865. end
  866. else
  867. { nil is compatible with class references }
  868. if (fromtreetype=niln) then
  869. begin
  870. doconv:=tc_equal;
  871. eq:=te_convert_l1;
  872. end;
  873. end;
  874. filedef :
  875. begin
  876. { typed files are all equal to the abstract file type
  877. name TYPEDFILE in system.pp in is_equal in types.pas
  878. the problem is that it sholud be also compatible to FILE
  879. but this would leed to a problem for ASSIGN RESET and REWRITE
  880. when trying to find the good overloaded function !!
  881. so all file function are doubled in system.pp
  882. this is not very beautiful !!}
  883. if (def_from.deftype=filedef) then
  884. begin
  885. if (tfiledef(def_from).filetyp=tfiledef(def_to).filetyp) then
  886. begin
  887. if
  888. (
  889. (tfiledef(def_from).typedfiletype.def=nil) and
  890. (tfiledef(def_to).typedfiletype.def=nil)
  891. ) or
  892. (
  893. (tfiledef(def_from).typedfiletype.def<>nil) and
  894. (tfiledef(def_to).typedfiletype.def<>nil) and
  895. equal_defs(tfiledef(def_from).typedfiletype.def,tfiledef(def_to).typedfiletype.def)
  896. ) or
  897. (
  898. (tfiledef(def_from).filetyp = ft_typed) and
  899. (tfiledef(def_to).filetyp = ft_typed) and
  900. (
  901. (tfiledef(def_from).typedfiletype.def = tdef(voidtype.def)) or
  902. (tfiledef(def_to).typedfiletype.def = tdef(voidtype.def))
  903. )
  904. ) then
  905. begin
  906. eq:=te_equal;
  907. end;
  908. end
  909. else
  910. if ((tfiledef(def_from).filetyp = ft_untyped) and
  911. (tfiledef(def_to).filetyp = ft_typed)) or
  912. ((tfiledef(def_from).filetyp = ft_typed) and
  913. (tfiledef(def_to).filetyp = ft_untyped)) then
  914. begin
  915. doconv:=tc_equal;
  916. eq:=te_convert_l1;
  917. end;
  918. end;
  919. end;
  920. recorddef :
  921. begin
  922. { interface -> guid }
  923. if is_interface(def_from) and
  924. (def_to=rec_tguid) then
  925. begin
  926. doconv:=tc_intf_2_guid;
  927. eq:=te_convert_l1;
  928. end;
  929. end;
  930. formaldef :
  931. begin
  932. doconv:=tc_equal;
  933. if (def_from.deftype=formaldef) then
  934. eq:=te_equal
  935. else
  936. { Just about everything can be converted to a formaldef...}
  937. if not (def_from.deftype in [abstractdef,errordef]) then
  938. eq:=te_convert_l1;
  939. end;
  940. end;
  941. { if we didn't find an appropriate type conversion yet and
  942. there is a variant involved then we search also the := operator }
  943. if (eq=te_incompatible) and
  944. check_operator and
  945. ((def_from.deftype in [objectdef,recorddef,arraydef,stringdef,variantdef]) or
  946. (def_to.deftype in [objectdef,recorddef,arraydef,stringdef,variantdef])) then
  947. begin
  948. operatorpd:=assignment_overloaded(def_from,def_to);
  949. if assigned(operatorpd) then
  950. eq:=te_convert_operator;
  951. end;
  952. { update convtype for te_equal when it is not yet set }
  953. if (eq=te_equal) and
  954. (doconv=tc_not_possible) then
  955. doconv:=tc_equal;
  956. compare_defs_ext:=eq;
  957. end;
  958. function equal_defs(def_from,def_to:tdef):boolean;
  959. var
  960. convtyp : tconverttype;
  961. pd : tprocdef;
  962. begin
  963. { Compare defs with nothingn and no explicit typecasts and
  964. searching for overloaded operators is not needed }
  965. equal_defs:=(compare_defs_ext(def_from,def_to,nothingn,false,false,convtyp,pd)>=te_equal);
  966. end;
  967. function compare_defs(def_from,def_to:tdef;fromtreetype:tnodetype):tequaltype;
  968. var
  969. doconv : tconverttype;
  970. pd : tprocdef;
  971. begin
  972. compare_defs:=compare_defs_ext(def_from,def_to,fromtreetype,false,true,doconv,pd);
  973. end;
  974. function is_subequal(def1, def2: tdef): boolean;
  975. var
  976. basedef1,basedef2 : tenumdef;
  977. Begin
  978. is_subequal := false;
  979. if assigned(def1) and assigned(def2) then
  980. Begin
  981. if (def1.deftype = orddef) and (def2.deftype = orddef) then
  982. Begin
  983. { see p.47 of Turbo Pascal 7.01 manual for the separation of types }
  984. { range checking for case statements is done with testrange }
  985. case torddef(def1).typ of
  986. u8bit,u16bit,u32bit,u64bit,
  987. s8bit,s16bit,s32bit,s64bit :
  988. is_subequal:=(torddef(def2).typ in [s64bit,u64bit,s32bit,u32bit,u8bit,s8bit,s16bit,u16bit]);
  989. bool8bit,bool16bit,bool32bit :
  990. is_subequal:=(torddef(def2).typ in [bool8bit,bool16bit,bool32bit]);
  991. uchar :
  992. is_subequal:=(torddef(def2).typ=uchar);
  993. uwidechar :
  994. is_subequal:=(torddef(def2).typ=uwidechar);
  995. end;
  996. end
  997. else
  998. Begin
  999. { Check if both basedefs are equal }
  1000. if (def1.deftype=enumdef) and (def2.deftype=enumdef) then
  1001. Begin
  1002. { get both basedefs }
  1003. basedef1:=tenumdef(def1);
  1004. while assigned(basedef1.basedef) do
  1005. basedef1:=basedef1.basedef;
  1006. basedef2:=tenumdef(def2);
  1007. while assigned(basedef2.basedef) do
  1008. basedef2:=basedef2.basedef;
  1009. is_subequal:=(basedef1=basedef2);
  1010. end;
  1011. end;
  1012. end;
  1013. end;
  1014. function compare_paras(paralist1,paralist2 : TLinkedList; acp : compare_type;allowdefaults,ignorehidden:boolean):tequaltype;
  1015. var
  1016. currpara1,
  1017. currpara2 : TParaItem;
  1018. eq,lowesteq : tequaltype;
  1019. hpd : tprocdef;
  1020. convtype : tconverttype;
  1021. begin
  1022. compare_paras:=te_incompatible;
  1023. { we need to parse the list from left-right so the
  1024. not-default parameters are checked first }
  1025. lowesteq:=high(tequaltype);
  1026. currpara1:=TParaItem(paralist1.first);
  1027. currpara2:=TParaItem(paralist2.first);
  1028. if ignorehidden then
  1029. begin
  1030. while assigned(currpara1) and currpara1.is_hidden do
  1031. currpara1:=tparaitem(currpara1.next);
  1032. while assigned(currpara2) and currpara2.is_hidden do
  1033. currpara2:=tparaitem(currpara2.next);
  1034. end;
  1035. while (assigned(currpara1)) and (assigned(currpara2)) do
  1036. begin
  1037. eq:=te_incompatible;
  1038. { Unique types must match exact }
  1039. if ((df_unique in currpara1.paratype.def.defoptions) or (df_unique in currpara2.paratype.def.defoptions)) and
  1040. (currpara1.paratype.def<>currpara2.paratype.def) then
  1041. exit;
  1042. { Handle hidden parameters separately, because self is
  1043. defined as voidpointer for methodpointers }
  1044. if (currpara1.is_hidden or
  1045. currpara2.is_hidden) then
  1046. begin
  1047. { both must be hidden }
  1048. if currpara1.is_hidden<>currpara2.is_hidden then
  1049. exit;
  1050. eq:=te_equal;
  1051. if not(vo_is_self in tvarsym(currpara1.parasym).varoptions) and
  1052. not(vo_is_self in tvarsym(currpara2.parasym).varoptions) then
  1053. begin
  1054. if (currpara1.paratyp<>currpara2.paratyp) then
  1055. exit;
  1056. eq:=compare_defs(currpara1.paratype.def,currpara2.paratype.def,nothingn);
  1057. end;
  1058. end
  1059. else
  1060. begin
  1061. case acp of
  1062. cp_value_equal_const :
  1063. begin
  1064. if (
  1065. (currpara1.paratyp<>currpara2.paratyp) and
  1066. ((currpara1.paratyp in [vs_var,vs_out]) or
  1067. (currpara2.paratyp in [vs_var,vs_out]))
  1068. ) then
  1069. exit;
  1070. eq:=compare_defs(currpara1.paratype.def,currpara2.paratype.def,nothingn);
  1071. end;
  1072. cp_all :
  1073. begin
  1074. if (currpara1.paratyp<>currpara2.paratyp) then
  1075. exit;
  1076. eq:=compare_defs(currpara1.paratype.def,currpara2.paratype.def,nothingn);
  1077. end;
  1078. cp_procvar :
  1079. begin
  1080. if (currpara1.paratyp<>currpara2.paratyp) then
  1081. exit;
  1082. eq:=compare_defs_ext(currpara1.paratype.def,currpara2.paratype.def,nothingn,
  1083. false,true,convtype,hpd);
  1084. if (eq>te_incompatible) and
  1085. (eq<te_equal) and
  1086. not(
  1087. (convtype in [tc_equal,tc_int_2_int]) and
  1088. (currpara1.paratype.def.size=currpara2.paratype.def.size)
  1089. ) then
  1090. begin
  1091. eq:=te_incompatible;
  1092. end;
  1093. end;
  1094. else
  1095. eq:=compare_defs(currpara1.paratype.def,currpara2.paratype.def,nothingn);
  1096. end;
  1097. end;
  1098. { check type }
  1099. if eq=te_incompatible then
  1100. exit;
  1101. if eq<lowesteq then
  1102. lowesteq:=eq;
  1103. { also check default value if both have it declared }
  1104. if assigned(currpara1.defaultvalue) and
  1105. assigned(currpara2.defaultvalue) then
  1106. begin
  1107. if not equal_constsym(tconstsym(currpara1.defaultvalue),tconstsym(currpara2.defaultvalue)) then
  1108. exit;
  1109. end;
  1110. currpara1:=TParaItem(currpara1.next);
  1111. currpara2:=TParaItem(currpara2.next);
  1112. if ignorehidden then
  1113. begin
  1114. while assigned(currpara1) and currpara1.is_hidden do
  1115. currpara1:=tparaitem(currpara1.next);
  1116. while assigned(currpara2) and currpara2.is_hidden do
  1117. currpara2:=tparaitem(currpara2.next);
  1118. end;
  1119. end;
  1120. { when both lists are empty then the parameters are equal. Also
  1121. when one list is empty and the other has a parameter with default
  1122. value assigned then the parameters are also equal }
  1123. if ((currpara1=nil) and (currpara2=nil)) or
  1124. (allowdefaults and
  1125. ((assigned(currpara1) and assigned(currpara1.defaultvalue)) or
  1126. (assigned(currpara2) and assigned(currpara2.defaultvalue)))) then
  1127. compare_paras:=lowesteq;
  1128. end;
  1129. function proc_to_procvar_equal(def1:tabstractprocdef;def2:tprocvardef;methoderr:boolean):tequaltype;
  1130. var
  1131. eq : tequaltype;
  1132. po_comp : tprocoptions;
  1133. begin
  1134. proc_to_procvar_equal:=te_incompatible;
  1135. if not(assigned(def1)) or not(assigned(def2)) then
  1136. exit;
  1137. { check for method pointer }
  1138. if (def1.is_methodpointer xor def2.is_methodpointer) or
  1139. (def1.is_addressonly xor def2.is_addressonly) then
  1140. begin
  1141. if methoderr then
  1142. Message(type_e_no_method_and_procedure_not_compatible);
  1143. exit;
  1144. end;
  1145. { check return value and options, methodpointer is already checked }
  1146. po_comp:=[po_staticmethod,po_interrupt,
  1147. po_iocheck,po_varargs];
  1148. if (m_delphi in aktmodeswitches) then
  1149. exclude(po_comp,po_varargs);
  1150. if ((po_comp * def1.procoptions)= (po_comp * def2.procoptions)) and
  1151. equal_defs(def1.rettype.def,def2.rettype.def) then
  1152. begin
  1153. { return equal type based on the parameters, but a proc->procvar
  1154. is never exact, so map an exact match of the parameters to
  1155. te_equal }
  1156. eq:=compare_paras(def1.para,def2.para,cp_procvar,false,false);
  1157. if eq=te_exact then
  1158. eq:=te_equal;
  1159. proc_to_procvar_equal:=eq;
  1160. end;
  1161. end;
  1162. end.
  1163. {
  1164. $Log$
  1165. Revision 1.34 2003-10-26 14:11:35 florian
  1166. * fixed web bug 2129: explicit float casts in Delphi mode must be handled by the default code
  1167. Revision 1.33 2003/10/14 12:23:06 florian
  1168. * fixed 2729: overloading problem with methodvars and procvars
  1169. Revision 1.32 2003/10/10 17:48:13 peter
  1170. * old trgobj moved to x86/rgcpu and renamed to trgx86fpu
  1171. * tregisteralloctor renamed to trgobj
  1172. * removed rgobj from a lot of units
  1173. * moved location_* and reference_* to cgobj
  1174. * first things for mmx register allocation
  1175. Revision 1.31 2003/10/07 21:14:32 peter
  1176. * compare_paras() has a parameter to ignore hidden parameters
  1177. * cross unit overload searching ignores hidden parameters when
  1178. comparing parameter lists. Now function(string):string is
  1179. not overriden with procedure(string) which has the same visible
  1180. parameter list
  1181. Revision 1.30 2003/10/05 13:05:05 peter
  1182. * when comparing hidden parameters both must be hidden
  1183. Revision 1.29 2003/10/05 12:57:11 peter
  1184. * set correct conversion for subranges
  1185. Revision 1.28 2003/09/09 21:03:17 peter
  1186. * basics for x86 register calling
  1187. Revision 1.27 2003/06/03 21:02:08 peter
  1188. * allow pointer(int64) in all modes
  1189. Revision 1.26 2003/05/26 21:17:17 peter
  1190. * procinlinenode removed
  1191. * aktexit2label removed, fast exit removed
  1192. + tcallnode.inlined_pass_2 added
  1193. Revision 1.25 2003/05/15 18:58:53 peter
  1194. * removed selfpointer_offset, vmtpointer_offset
  1195. * tvarsym.adjusted_address
  1196. * address in localsymtable is now in the real direction
  1197. * removed some obsolete globals
  1198. Revision 1.24 2003/05/09 17:47:02 peter
  1199. * self moved to hidden parameter
  1200. * removed hdisposen,hnewn,selfn
  1201. Revision 1.23 2003/04/23 20:16:04 peter
  1202. + added currency support based on int64
  1203. + is_64bit for use in cg units instead of is_64bitint
  1204. * removed cgmessage from n386add, replace with internalerrors
  1205. Revision 1.22 2003/04/23 11:37:33 peter
  1206. * po_comp for proc to procvar fixed
  1207. Revision 1.21 2003/04/10 17:57:52 peter
  1208. * vs_hidden released
  1209. Revision 1.20 2003/03/20 17:52:18 peter
  1210. * fix compare for unique types, they are allowed when they match
  1211. exact
  1212. Revision 1.19 2003/01/16 22:13:51 peter
  1213. * convert_l3 convertlevel added. This level is used for conversions
  1214. where information can be lost like converting widestring->ansistring
  1215. or dword->byte
  1216. Revision 1.18 2003/01/15 01:44:32 peter
  1217. * merged methodpointer fixes from 1.0.x
  1218. Revision 1.17 2003/01/09 21:43:39 peter
  1219. * constant string conversion fixed, it's now equal to both
  1220. shortstring, ansistring and the typeconvnode will return
  1221. te_equal but still return convtype to change the constnode
  1222. Revision 1.16 2003/01/05 22:42:13 peter
  1223. * use int_to_int conversion for pointer/procvar/classref to int
  1224. Revision 1.15 2003/01/05 15:54:15 florian
  1225. + added proper support of type = type <type>; for simple types
  1226. Revision 1.14 2003/01/03 17:16:04 peter
  1227. * fixed assignment operator checking for typecast
  1228. Revision 1.13 2002/12/29 18:15:19 peter
  1229. * varargs is not checked in proc->procvar for delphi
  1230. Revision 1.12 2002/12/29 14:57:50 peter
  1231. * unit loading changed to first register units and load them
  1232. afterwards. This is needed to support uses xxx in yyy correctly
  1233. * unit dependency check fixed
  1234. Revision 1.11 2002/12/27 15:26:12 peter
  1235. * procvar compare with 2 ints did not check the integer size
  1236. Revision 1.10 2002/12/23 22:22:16 peter
  1237. * don't allow implicit bool->int conversion
  1238. Revision 1.9 2002/12/18 21:37:36 peter
  1239. * allow classref-classref always when explicit
  1240. Revision 1.8 2002/12/15 22:37:53 peter
  1241. * give conversions from pointer to pwidechar a penalty (=prefer pchar)
  1242. Revision 1.7 2002/12/11 22:40:12 peter
  1243. * proc->procvar is never an exact match, convert exact parameters
  1244. to equal for the whole proc to procvar conversion level
  1245. Revision 1.6 2002/12/06 17:49:44 peter
  1246. * prefer string-shortstring over other string-string conversions
  1247. Revision 1.5 2002/12/05 14:27:26 florian
  1248. * some variant <-> dyn. array stuff
  1249. Revision 1.4 2002/12/01 22:07:41 carl
  1250. * warning of portabilitiy problems with parasize / localsize
  1251. + some added documentation
  1252. Revision 1.3 2002/11/27 15:33:46 peter
  1253. * the never ending story of tp procvar hacks
  1254. Revision 1.2 2002/11/27 02:32:14 peter
  1255. * fix cp_procvar compare
  1256. Revision 1.1 2002/11/25 17:43:16 peter
  1257. * splitted defbase in defutil,symutil,defcmp
  1258. * merged isconvertable and is_equal into compare_defs(_ext)
  1259. * made operator search faster by walking the list only once
  1260. }