htypechk.pas 28 KB

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