htypechk.pas 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794
  1. {
  2. $Id$
  3. Copyright (c) 1996-98 by Florian Klaempfl
  4. This unit exports some help routines for the type checking
  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 htypechk;
  19. interface
  20. uses
  21. tree,symtable;
  22. const
  23. { firstcallparan without varspez we don't count the ref }
  24. count_ref : boolean = true;
  25. get_para_resulttype : boolean = false;
  26. allow_array_constructor : boolean = false;
  27. { Conversion }
  28. function isconvertable(def_from,def_to : pdef;
  29. var doconv : tconverttype;fromtreetype : ttreetyp;
  30. explicit : boolean) : byte;
  31. { Register Allocation }
  32. procedure make_not_regable(p : ptree);
  33. procedure left_right_max(p : ptree);
  34. procedure calcregisters(p : ptree;r32,fpu,mmx : word);
  35. { subroutine handling }
  36. procedure test_protected_sym(sym : psym);
  37. procedure test_protected(p : ptree);
  38. function valid_for_formal_var(p : ptree) : boolean;
  39. function valid_for_formal_const(p : ptree) : boolean;
  40. function is_procsym_load(p:Ptree):boolean;
  41. function is_procsym_call(p:Ptree):boolean;
  42. function assignment_overloaded(from_def,to_def : pdef) : pprocdef;
  43. implementation
  44. uses
  45. globtype,systems,tokens,
  46. cobjects,verbose,globals,
  47. symconst,
  48. types,
  49. hcodegen;
  50. {****************************************************************************
  51. Convert
  52. ****************************************************************************}
  53. { Returns:
  54. 0 - Not convertable
  55. 1 - Convertable
  56. 2 - Convertable, but not first choice }
  57. function isconvertable(def_from,def_to : pdef;
  58. var doconv : tconverttype;fromtreetype : ttreetyp;
  59. explicit : boolean) : byte;
  60. { Tbasetype: uauto,uvoid,uchar,
  61. u8bit,u16bit,u32bit,
  62. s8bit,s16bit,s32,
  63. bool8bit,bool16bit,bool32bit,
  64. u64bit,s64bitint }
  65. type
  66. tbasedef=(bvoid,bchar,bint,bbool);
  67. const
  68. basedeftbl:array[tbasetype] of tbasedef =
  69. (bvoid,bvoid,bchar,
  70. bint,bint,bint,
  71. bint,bint,bint,
  72. bbool,bbool,bbool,bint,bint);
  73. basedefconverts : array[tbasedef,tbasedef] of tconverttype =
  74. ((tc_not_possible,tc_not_possible,tc_not_possible,tc_not_possible),
  75. (tc_not_possible,tc_equal,tc_not_possible,tc_not_possible),
  76. (tc_not_possible,tc_not_possible,tc_int_2_int,tc_int_2_bool),
  77. (tc_not_possible,tc_not_possible,tc_bool_2_int,tc_bool_2_bool));
  78. var
  79. b : byte;
  80. hd1,hd2 : pdef;
  81. begin
  82. { safety check }
  83. if not(assigned(def_from) and assigned(def_to)) then
  84. begin
  85. isconvertable:=0;
  86. exit;
  87. end;
  88. b:=0;
  89. { we walk the wanted (def_to) types and check then the def_from
  90. types if there is a conversion possible }
  91. case def_to^.deftype of
  92. orddef :
  93. begin
  94. case def_from^.deftype of
  95. orddef :
  96. begin
  97. doconv:=basedefconverts[basedeftbl[porddef(def_from)^.typ],basedeftbl[porddef(def_to)^.typ]];
  98. b:=1;
  99. if (doconv=tc_not_possible) or
  100. ((doconv=tc_int_2_bool) and
  101. (not explicit) and
  102. (not is_boolean(def_from))) or
  103. ((doconv=tc_bool_2_int) and
  104. (not explicit) and
  105. (not is_boolean(def_to))) then
  106. b:=0;
  107. end;
  108. enumdef :
  109. begin
  110. { needed for char(enum) }
  111. if explicit then
  112. begin
  113. doconv:=tc_int_2_int;
  114. b:=1;
  115. end;
  116. end;
  117. end;
  118. end;
  119. stringdef :
  120. begin
  121. case def_from^.deftype of
  122. stringdef :
  123. begin
  124. doconv:=tc_string_2_string;
  125. b:=1;
  126. end;
  127. orddef :
  128. begin
  129. { char to string}
  130. if is_char(def_from) then
  131. begin
  132. doconv:=tc_char_2_string;
  133. b:=1;
  134. end;
  135. end;
  136. arraydef :
  137. begin
  138. { array of char to string, the length check is done by the firstpass of this node }
  139. if is_chararray(def_from) then
  140. begin
  141. doconv:=tc_chararray_2_string;
  142. if (not(cs_ansistrings in aktlocalswitches) and
  143. is_shortstring(def_to)) or
  144. ((cs_ansistrings in aktlocalswitches) and
  145. is_ansistring(def_to)) then
  146. b:=1
  147. else
  148. b:=2;
  149. end;
  150. end;
  151. pointerdef :
  152. begin
  153. { pchar can be assigned to short/ansistrings }
  154. if is_pchar(def_from) and not(m_tp in aktmodeswitches) then
  155. begin
  156. doconv:=tc_pchar_2_string;
  157. b:=1;
  158. end;
  159. end;
  160. end;
  161. end;
  162. floatdef :
  163. begin
  164. case def_from^.deftype of
  165. orddef :
  166. begin { ordinal to real }
  167. if is_integer(def_from) then
  168. begin
  169. if pfloatdef(def_to)^.typ=f32bit then
  170. doconv:=tc_int_2_fix
  171. else
  172. doconv:=tc_int_2_real;
  173. b:=1;
  174. end;
  175. end;
  176. floatdef :
  177. begin { 2 float types ? }
  178. if pfloatdef(def_from)^.typ=pfloatdef(def_to)^.typ then
  179. doconv:=tc_equal
  180. else
  181. begin
  182. if pfloatdef(def_from)^.typ=f32bit then
  183. doconv:=tc_fix_2_real
  184. else
  185. if pfloatdef(def_to)^.typ=f32bit then
  186. doconv:=tc_real_2_fix
  187. else
  188. doconv:=tc_real_2_real;
  189. end;
  190. b:=1;
  191. end;
  192. end;
  193. end;
  194. enumdef :
  195. begin
  196. if (def_from^.deftype=enumdef) then
  197. begin
  198. if assigned(penumdef(def_from)^.basedef) then
  199. hd1:=penumdef(def_from)^.basedef
  200. else
  201. hd1:=def_from;
  202. if assigned(penumdef(def_to)^.basedef) then
  203. hd2:=penumdef(def_to)^.basedef
  204. else
  205. hd2:=def_to;
  206. if (hd1=hd2) then
  207. b:=1;
  208. end;
  209. end;
  210. arraydef :
  211. begin
  212. { open array is also compatible with a single element of its base type }
  213. if is_open_array(def_to) and
  214. is_equal(parraydef(def_to)^.definition,def_from) then
  215. begin
  216. doconv:=tc_equal;
  217. b:=1;
  218. end
  219. else
  220. begin
  221. case def_from^.deftype of
  222. pointerdef :
  223. begin
  224. if is_zero_based_array(def_to) and
  225. is_equal(ppointerdef(def_from)^.definition,parraydef(def_to)^.definition) then
  226. begin
  227. doconv:=tc_pointer_2_array;
  228. b:=1;
  229. end;
  230. end;
  231. stringdef :
  232. begin
  233. { string to array of char}
  234. if (not(is_special_array(def_to)) or is_open_array(def_to)) and
  235. is_equal(parraydef(def_to)^.definition,cchardef) then
  236. begin
  237. doconv:=tc_string_2_chararray;
  238. b:=1;
  239. end;
  240. end;
  241. end;
  242. end;
  243. end;
  244. pointerdef :
  245. begin
  246. case def_from^.deftype of
  247. stringdef :
  248. begin
  249. { string constant to zero terminated string constant }
  250. if (fromtreetype=stringconstn) and
  251. is_pchar(def_to) then
  252. begin
  253. doconv:=tc_cstring_2_pchar;
  254. b:=1;
  255. end;
  256. end;
  257. orddef :
  258. begin
  259. { char constant to zero terminated string constant }
  260. if (fromtreetype=ordconstn) and is_equal(def_from,cchardef) and
  261. is_pchar(def_to) then
  262. begin
  263. doconv:=tc_cchar_2_pchar;
  264. b:=1;
  265. end;
  266. end;
  267. arraydef :
  268. begin
  269. { chararray to pointer }
  270. if is_zero_based_array(def_from) and
  271. is_equal(parraydef(def_from)^.definition,ppointerdef(def_to)^.definition) then
  272. begin
  273. doconv:=tc_array_2_pointer;
  274. b:=1;
  275. end;
  276. end;
  277. pointerdef :
  278. begin
  279. { child class pointer can be assigned to anchestor pointers }
  280. if (
  281. (ppointerdef(def_from)^.definition^.deftype=objectdef) and
  282. (ppointerdef(def_to)^.definition^.deftype=objectdef) and
  283. pobjectdef(ppointerdef(def_from)^.definition)^.is_related(
  284. pobjectdef(ppointerdef(def_to)^.definition))
  285. ) or
  286. { all pointers can be assigned to void-pointer }
  287. is_equal(ppointerdef(def_to)^.definition,voiddef) or
  288. { in my opnion, is this not clean pascal }
  289. { well, but it's handy to use, it isn't ? (FK) }
  290. is_equal(ppointerdef(def_from)^.definition,voiddef) then
  291. begin
  292. doconv:=tc_equal;
  293. b:=1;
  294. end;
  295. end;
  296. procvardef :
  297. begin
  298. { procedure variable can be assigned to an void pointer }
  299. { Not anymore. Use the @ operator now.}
  300. if not(m_tp_procvar in aktmodeswitches) and
  301. (ppointerdef(def_to)^.definition^.deftype=orddef) and
  302. (porddef(ppointerdef(def_to)^.definition)^.typ=uvoid) then
  303. begin
  304. doconv:=tc_equal;
  305. b:=1;
  306. end;
  307. end;
  308. classrefdef,
  309. objectdef :
  310. begin
  311. { class types and class reference type
  312. can be assigned to void pointers }
  313. if (
  314. ((def_from^.deftype=objectdef) and pobjectdef(def_from)^.is_class) or
  315. (def_from^.deftype=classrefdef)
  316. ) and
  317. (ppointerdef(def_to)^.definition^.deftype=orddef) and
  318. (porddef(ppointerdef(def_to)^.definition)^.typ=uvoid) then
  319. begin
  320. doconv:=tc_equal;
  321. b:=1;
  322. end;
  323. end;
  324. end;
  325. end;
  326. setdef :
  327. begin
  328. { automatic arrayconstructor -> set conversion }
  329. if is_array_constructor(def_from) then
  330. begin
  331. doconv:=tc_arrayconstructor_2_set;
  332. b:=1;
  333. end;
  334. end;
  335. procvardef :
  336. begin
  337. { proc -> procvar }
  338. if (def_from^.deftype=procdef) then
  339. begin
  340. doconv:=tc_proc_2_procvar;
  341. if proc_to_procvar_equal(pprocdef(def_from),pprocvardef(def_to)) then
  342. b:=1;
  343. end
  344. else
  345. { for example delphi allows the assignement from pointers }
  346. { to procedure variables }
  347. if (m_pointer_2_procedure in aktmodeswitches) and
  348. (def_from^.deftype=pointerdef) and
  349. (ppointerdef(def_from)^.definition^.deftype=orddef) and
  350. (porddef(ppointerdef(def_from)^.definition)^.typ=uvoid) then
  351. begin
  352. doconv:=tc_equal;
  353. b:=1;
  354. end
  355. else
  356. { nil is compatible with procvars }
  357. if (fromtreetype=niln) then
  358. begin
  359. doconv:=tc_equal;
  360. b:=1;
  361. end;
  362. end;
  363. objectdef :
  364. begin
  365. { object pascal objects }
  366. if (def_from^.deftype=objectdef) {and
  367. pobjectdef(def_from)^.isclass and pobjectdef(def_to)^.isclass }then
  368. begin
  369. doconv:=tc_equal;
  370. if pobjectdef(def_from)^.is_related(pobjectdef(def_to)) then
  371. b:=1;
  372. end
  373. else
  374. { nil is compatible with class instances }
  375. if (fromtreetype=niln) and (pobjectdef(def_to)^.is_class) then
  376. begin
  377. doconv:=tc_equal;
  378. b:=1;
  379. end;
  380. end;
  381. classrefdef :
  382. begin
  383. { class reference types }
  384. if (def_from^.deftype=classrefdef) then
  385. begin
  386. doconv:=tc_equal;
  387. if pobjectdef(pclassrefdef(def_from)^.definition)^.is_related(
  388. pobjectdef(pclassrefdef(def_to)^.definition)) then
  389. b:=1;
  390. end
  391. else
  392. { nil is compatible with class references }
  393. if (fromtreetype=niln) then
  394. begin
  395. doconv:=tc_equal;
  396. b:=1;
  397. end;
  398. end;
  399. filedef :
  400. begin
  401. { typed files are all equal to the abstract file type
  402. name TYPEDFILE in system.pp in is_equal in types.pas
  403. the problem is that it sholud be also compatible to FILE
  404. but this would leed to a problem for ASSIGN RESET and REWRITE
  405. when trying to find the good overloaded function !!
  406. so all file function are doubled in system.pp
  407. this is not very beautiful !!}
  408. if (def_from^.deftype=filedef) and
  409. (
  410. (
  411. (pfiledef(def_from)^.filetype = ft_typed) and
  412. (pfiledef(def_to)^.filetype = ft_typed) and
  413. (
  414. (pfiledef(def_from)^.typed_as = pdef(voiddef)) or
  415. (pfiledef(def_to)^.typed_as = pdef(voiddef))
  416. )
  417. ) or
  418. (
  419. (
  420. (pfiledef(def_from)^.filetype = ft_untyped) and
  421. (pfiledef(def_to)^.filetype = ft_typed)
  422. ) or
  423. (
  424. (pfiledef(def_from)^.filetype = ft_typed) and
  425. (pfiledef(def_to)^.filetype = ft_untyped)
  426. )
  427. )
  428. ) then
  429. begin
  430. doconv:=tc_equal;
  431. b:=1;
  432. end
  433. end;
  434. else
  435. begin
  436. { assignment overwritten ?? }
  437. if assignment_overloaded(def_from,def_to)<>nil then
  438. b:=2;
  439. end;
  440. end;
  441. isconvertable:=b;
  442. end;
  443. {****************************************************************************
  444. Register Calculation
  445. ****************************************************************************}
  446. { marks an lvalue as "unregable" }
  447. procedure make_not_regable(p : ptree);
  448. begin
  449. case p^.treetype of
  450. typeconvn :
  451. make_not_regable(p^.left);
  452. loadn :
  453. if p^.symtableentry^.typ=varsym then
  454. {$ifdef INCLUDEOK}
  455. exclude(pvarsym(p^.symtableentry)^.varoptions,vo_regable);
  456. {$else}
  457. pvarsym(p^.symtableentry)^.varoptions:=pvarsym(p^.symtableentry)^.varoptions-[vo_regable];
  458. {$endif}
  459. end;
  460. end;
  461. procedure left_right_max(p : ptree);
  462. begin
  463. if assigned(p^.left) then
  464. begin
  465. if assigned(p^.right) then
  466. begin
  467. p^.registers32:=max(p^.left^.registers32,p^.right^.registers32);
  468. p^.registersfpu:=max(p^.left^.registersfpu,p^.right^.registersfpu);
  469. {$ifdef SUPPORT_MMX}
  470. p^.registersmmx:=max(p^.left^.registersmmx,p^.right^.registersmmx);
  471. {$endif SUPPORT_MMX}
  472. end
  473. else
  474. begin
  475. p^.registers32:=p^.left^.registers32;
  476. p^.registersfpu:=p^.left^.registersfpu;
  477. {$ifdef SUPPORT_MMX}
  478. p^.registersmmx:=p^.left^.registersmmx;
  479. {$endif SUPPORT_MMX}
  480. end;
  481. end;
  482. end;
  483. { calculates the needed registers for a binary operator }
  484. procedure calcregisters(p : ptree;r32,fpu,mmx : word);
  485. begin
  486. left_right_max(p);
  487. { Only when the difference between the left and right registers < the
  488. wanted registers allocate the amount of registers }
  489. if assigned(p^.left) then
  490. begin
  491. if assigned(p^.right) then
  492. begin
  493. if (abs(p^.left^.registers32-p^.right^.registers32)<r32) then
  494. inc(p^.registers32,r32);
  495. if (abs(p^.left^.registersfpu-p^.right^.registersfpu)<fpu) then
  496. inc(p^.registersfpu,fpu);
  497. {$ifdef SUPPORT_MMX}
  498. if (abs(p^.left^.registersmmx-p^.right^.registersmmx)<mmx) then
  499. inc(p^.registersmmx,mmx);
  500. {$endif SUPPORT_MMX}
  501. end
  502. else
  503. begin
  504. if (p^.left^.registers32<r32) then
  505. inc(p^.registers32,r32);
  506. if (p^.left^.registersfpu<fpu) then
  507. inc(p^.registersfpu,fpu);
  508. {$ifdef SUPPORT_MMX}
  509. if (p^.left^.registersmmx<mmx) then
  510. inc(p^.registersmmx,mmx);
  511. {$endif SUPPORT_MMX}
  512. end;
  513. end;
  514. { error CGMessage, if more than 8 floating point }
  515. { registers are needed }
  516. if p^.registersfpu>8 then
  517. CGMessage(cg_e_too_complex_expr);
  518. end;
  519. {****************************************************************************
  520. Subroutine Handling
  521. ****************************************************************************}
  522. { protected field handling
  523. protected field can not appear in
  524. var parameters of function !!
  525. this can only be done after we have determined the
  526. overloaded function
  527. this is the reason why it is not in the parser, PM }
  528. procedure test_protected_sym(sym : psym);
  529. begin
  530. if (sp_protected in sym^.symoptions) and
  531. ((sym^.owner^.symtabletype=unitsymtable) or
  532. ((sym^.owner^.symtabletype=objectsymtable) and
  533. (pobjectdef(sym^.owner^.defowner)^.owner^.symtabletype=unitsymtable))
  534. ) then
  535. CGMessage(parser_e_cant_access_protected_member);
  536. end;
  537. procedure test_protected(p : ptree);
  538. begin
  539. case p^.treetype of
  540. loadn : test_protected_sym(p^.symtableentry);
  541. typeconvn : test_protected(p^.left);
  542. derefn : test_protected(p^.left);
  543. subscriptn : begin
  544. { test_protected(p^.left);
  545. Is a field of a protected var
  546. also protected ??? PM }
  547. test_protected_sym(p^.vs);
  548. end;
  549. end;
  550. end;
  551. function valid_for_formal_var(p : ptree) : boolean;
  552. var
  553. v : boolean;
  554. begin
  555. case p^.treetype of
  556. loadn : v:=(p^.symtableentry^.typ in [typedconstsym,varsym]);
  557. typeconvn : v:=valid_for_formal_var(p^.left);
  558. typen : v:=false;
  559. derefn,subscriptn,vecn,
  560. funcretn,selfn : v:=true;
  561. { procvars are callnodes first }
  562. calln : v:=assigned(p^.right) and not assigned(p^.left);
  563. { should this depend on mode ? }
  564. addrn : v:=true;
  565. { no other node accepted (PM) }
  566. else v:=false;
  567. end;
  568. valid_for_formal_var:=v;
  569. end;
  570. function valid_for_formal_const(p : ptree) : boolean;
  571. var
  572. v : boolean;
  573. begin
  574. { p must have been firstpass'd before }
  575. { accept about anything but not a statement ! }
  576. v:=true;
  577. if (p^.treetype in [calln,statementn]) then
  578. { if not assigned(p^.resulttype) or (p^.resulttype=pdef(voiddef)) then }
  579. v:=false;
  580. valid_for_formal_const:=v;
  581. end;
  582. function is_procsym_load(p:Ptree):boolean;
  583. begin
  584. is_procsym_load:=((p^.treetype=loadn) and (p^.symtableentry^.typ=procsym)) or
  585. ((p^.treetype=addrn) and (p^.left^.treetype=loadn)
  586. and (p^.left^.symtableentry^.typ=procsym)) ;
  587. end;
  588. { change a proc call to a procload for assignment to a procvar }
  589. { this can only happen for proc/function without arguments }
  590. function is_procsym_call(p:Ptree):boolean;
  591. begin
  592. is_procsym_call:=(p^.treetype=calln) and (p^.left=nil) and
  593. (((p^.symtableprocentry^.typ=procsym) and (p^.right=nil)) or
  594. ((p^.right<>nil) and (p^.right^.symtableprocentry^.typ=varsym)));
  595. end;
  596. function assignment_overloaded(from_def,to_def : pdef) : pprocdef;
  597. var
  598. passproc : pprocdef;
  599. convtyp : tconverttype;
  600. begin
  601. assignment_overloaded:=nil;
  602. if assigned(overloaded_operators[_assignment]) then
  603. passproc:=overloaded_operators[_assignment]^.definition
  604. else
  605. exit;
  606. while passproc<>nil do
  607. begin
  608. if is_equal(passproc^.retdef,to_def) and
  609. (is_equal(passproc^.para1^.data,from_def) or
  610. (isconvertable(from_def,passproc^.para1^.data,convtyp,ordconstn,false)=1)) then
  611. begin
  612. assignment_overloaded:=passproc;
  613. break;
  614. end;
  615. passproc:=passproc^.nextoverloaded;
  616. end;
  617. end;
  618. end.
  619. {
  620. $Log$
  621. Revision 1.33 1999-08-04 13:02:43 jonas
  622. * all tokens now start with an underscore
  623. * PowerPC compiles!!
  624. Revision 1.32 1999/08/03 22:02:53 peter
  625. * moved bitmask constants to sets
  626. * some other type/const renamings
  627. Revision 1.31 1999/07/16 10:04:32 peter
  628. * merged
  629. Revision 1.30 1999/06/28 16:02:30 peter
  630. * merged
  631. Revision 1.27.2.4 1999/07/16 09:52:18 peter
  632. * allow char(enum)
  633. Revision 1.27.2.3 1999/06/28 15:51:27 peter
  634. * tp7 fix
  635. Revision 1.27.2.2 1999/06/18 10:56:58 daniel
  636. - Enumerations no longer compatible with integer types
  637. Revision 1.27.2.1 1999/06/17 12:51:42 pierre
  638. * changed is_assignment_overloaded into
  639. function assignment_overloaded : pprocdef
  640. to allow overloading of assignment with only different result type
  641. Revision 1.27 1999/06/01 19:27:47 peter
  642. * better checks for procvar and methodpointer
  643. Revision 1.26 1999/05/20 14:58:26 peter
  644. * fixed arrayconstruct->set conversion which didn't work for enum sets
  645. Revision 1.25 1999/05/19 20:40:12 florian
  646. * fixed a couple of array related bugs:
  647. - var a : array[0..1] of char; p : pchar; p:=a+123; works now
  648. - open arrays with an odd size doesn't work: movsb wasn't generated
  649. - introduced some new array type helper routines (is_special_array) etc.
  650. - made the array type checking in isconvertable more strict, often
  651. open array can be used where is wasn't allowed etc...
  652. Revision 1.24 1999/05/06 10:10:02 peter
  653. * overloaded conversion has lower priority
  654. Revision 1.23 1999/04/26 09:30:47 peter
  655. * small tp7 fix
  656. * fix void pointer with formaldef
  657. Revision 1.22 1999/04/21 22:00:01 pierre
  658. + valid_for_formal_var and valid_for_formal_const added
  659. Revision 1.21 1999/04/21 16:31:40 pierre
  660. ra386att.pas : problem with commit -m !
  661. Revision 1.20 1999/04/15 08:56:27 peter
  662. * fixed bool-bool conversion
  663. Revision 1.19 1999/03/24 23:17:02 peter
  664. * fixed bugs 212,222,225,227,229,231,233
  665. Revision 1.18 1999/03/06 17:25:19 peter
  666. * moved comp<->real warning so it doesn't occure everytime that
  667. isconvertable is called with
  668. Revision 1.17 1999/03/02 18:24:20 peter
  669. * fixed overloading of array of char
  670. Revision 1.16 1999/01/27 13:53:27 pierre
  671. htypechk.pas
  672. Revision 1.15 1999/01/27 13:12:10 pierre
  673. * bool to int must be explicit
  674. Revision 1.14 1999/01/19 15:55:32 pierre
  675. * fix for boolean to comp conversion (now disabled)
  676. Revision 1.13 1998/12/15 17:11:37 peter
  677. * string:=pchar not allowed in tp mode
  678. Revision 1.12 1998/12/11 00:03:18 peter
  679. + globtype,tokens,version unit splitted from globals
  680. Revision 1.11 1998/12/10 09:47:21 florian
  681. + basic operations with int64/qord (compiler with -dint64)
  682. + rtti of enumerations extended: names are now written
  683. Revision 1.10 1998/11/29 12:40:23 peter
  684. * newcnv -> not oldcnv
  685. Revision 1.9 1998/11/26 13:10:42 peter
  686. * new int - int conversion -dNEWCNV
  687. * some function renamings
  688. Revision 1.8 1998/11/17 00:36:42 peter
  689. * more ansistring fixes
  690. Revision 1.7 1998/10/14 13:33:24 peter
  691. * fixed small typo
  692. Revision 1.6 1998/10/14 12:53:38 peter
  693. * fixed small tp7 things
  694. * boolean:=longbool and longbool fixed
  695. Revision 1.5 1998/10/12 09:49:58 florian
  696. + support of <procedure var type>:=<pointer> in delphi mode added
  697. Revision 1.4 1998/09/30 16:42:52 peter
  698. * fixed bool-bool cnv
  699. Revision 1.3 1998/09/24 23:49:05 peter
  700. + aktmodeswitches
  701. Revision 1.2 1998/09/24 09:02:14 peter
  702. * rewritten isconvertable to use case
  703. * array of .. and single variable are compatible
  704. Revision 1.1 1998/09/23 20:42:22 peter
  705. * splitted pass_1
  706. }