nld.pas 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836
  1. {
  2. $Id$
  3. Copyright (c) 2000 by Florian Klaempfl
  4. Type checking and register allocation for load/assignment nodes
  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 nld;
  19. {$i defines.inc}
  20. interface
  21. uses
  22. node,
  23. symbase,symtype,symsym;
  24. type
  25. tloadnode = class(tunarynode)
  26. symtableentry : tsym;
  27. symtable : tsymtable;
  28. constructor create(v : tsym;st : tsymtable);virtual;
  29. procedure set_mp(p:tnode);
  30. function getcopy : tnode;override;
  31. function pass_1 : tnode;override;
  32. function det_resulttype:tnode;override;
  33. function docompare(p: tnode): boolean; override;
  34. end;
  35. { different assignment types }
  36. tassigntype = (at_normal,at_plus,at_minus,at_star,at_slash);
  37. tassignmentnode = class(tbinarynode)
  38. assigntype : tassigntype;
  39. constructor create(l,r : tnode);virtual;
  40. function getcopy : tnode;override;
  41. function pass_1 : tnode;override;
  42. function det_resulttype:tnode;override;
  43. function docompare(p: tnode): boolean; override;
  44. end;
  45. tfuncretnode = class(tnode)
  46. funcretprocinfo : pointer;
  47. constructor create(p:pointer);virtual;
  48. function getcopy : tnode;override;
  49. function pass_1 : tnode;override;
  50. function det_resulttype:tnode;override;
  51. function docompare(p: tnode): boolean; override;
  52. end;
  53. tarrayconstructorrangenode = class(tbinarynode)
  54. constructor create(l,r : tnode);virtual;
  55. function pass_1 : tnode;override;
  56. function det_resulttype:tnode;override;
  57. end;
  58. tarrayconstructornode = class(tbinarynode)
  59. constructortype : ttype;
  60. constructor create(l,r : tnode);virtual;
  61. function getcopy : tnode;override;
  62. function pass_1 : tnode;override;
  63. function det_resulttype:tnode;override;
  64. function docompare(p: tnode): boolean; override;
  65. end;
  66. ttypenode = class(tnode)
  67. allowed : boolean;
  68. restype : ttype;
  69. constructor create(t : ttype);virtual;
  70. function pass_1 : tnode;override;
  71. function det_resulttype:tnode;override;
  72. function docompare(p: tnode): boolean; override;
  73. end;
  74. var
  75. cloadnode : class of tloadnode;
  76. cassignmentnode : class of tassignmentnode;
  77. cfuncretnode : class of tfuncretnode;
  78. carrayconstructorrangenode : class of tarrayconstructorrangenode;
  79. carrayconstructornode : class of tarrayconstructornode;
  80. ctypenode : class of ttypenode;
  81. implementation
  82. uses
  83. cutils,verbose,globtype,globals,systems,
  84. symconst,symdef,symtable,types,
  85. htypechk,pass_1,
  86. ncnv,nmem,cpubase,tgcpu,hcodegen
  87. {$ifdef newcg}
  88. ,cgbase
  89. ,tgobj
  90. {$endif newcg}
  91. ;
  92. {*****************************************************************************
  93. TLOADNODE
  94. *****************************************************************************}
  95. constructor tloadnode.create(v : tsym;st : tsymtable);
  96. begin
  97. inherited create(loadn,nil);
  98. symtableentry:=v;
  99. symtable:=st;
  100. end;
  101. procedure tloadnode.set_mp(p:tnode);
  102. begin
  103. left:=p;
  104. end;
  105. function tloadnode.getcopy : tnode;
  106. var
  107. n : tloadnode;
  108. begin
  109. n:=tloadnode(inherited getcopy);
  110. n.symtable:=symtable;
  111. n.symtableentry:=symtableentry;
  112. result:=n;
  113. end;
  114. function tloadnode.det_resulttype:tnode;
  115. var
  116. p1 : tnode;
  117. begin
  118. result:=nil;
  119. { optimize simple with loadings }
  120. if (symtable.symtabletype=withsymtable) and
  121. (twithsymtable(symtable).direct_with) and
  122. (symtableentry.typ=varsym) then
  123. begin
  124. p1:=tnode(twithsymtable(symtable).withrefnode).getcopy;
  125. p1:=csubscriptnode.create(tvarsym(symtableentry),p1);
  126. left:=nil;
  127. resulttypepass(p1);
  128. result:=p1;
  129. exit;
  130. end;
  131. { handle first absolute as it will replace the symtableentry }
  132. if symtableentry.typ=absolutesym then
  133. begin
  134. { force the resulttype to the type of the absolute }
  135. resulttype:=tabsolutesym(symtableentry).vartype;
  136. { replace the symtableentry when it points to a var, else
  137. we are finished }
  138. if tabsolutesym(symtableentry).abstyp=tovar then
  139. begin
  140. symtableentry:=tabsolutesym(symtableentry).ref;
  141. symtable:=symtableentry.owner;
  142. include(flags,nf_absolute);
  143. end
  144. else
  145. exit;
  146. end;
  147. case symtableentry.typ of
  148. funcretsym :
  149. begin
  150. p1:=cfuncretnode.create(tfuncretsym(symtableentry).funcretprocinfo);
  151. resulttypepass(p1);
  152. { if it's refered as absolute then we need to have the
  153. type of the absolute instead of the function return,
  154. the function return is then also assigned }
  155. if nf_absolute in flags then
  156. begin
  157. pprocinfo(tfuncretnode(p1).funcretprocinfo)^.funcret_state:=vs_assigned;
  158. p1.resulttype:=resulttype;
  159. end;
  160. left:=nil;
  161. result:=p1;
  162. end;
  163. constsym:
  164. begin
  165. if tconstsym(symtableentry).consttyp=constresourcestring then
  166. resulttype:=cansistringtype
  167. else
  168. internalerror(22799);
  169. end;
  170. varsym :
  171. begin
  172. { if it's refered by absolute then it's used }
  173. if nf_absolute in flags then
  174. tvarsym(symtableentry).varstate:=vs_used
  175. else
  176. resulttype:=tvarsym(symtableentry).vartype;
  177. end;
  178. typedconstsym :
  179. if not(nf_absolute in flags) then
  180. resulttype:=ttypedconstsym(symtableentry).typedconsttype;
  181. procsym :
  182. begin
  183. if assigned(tprocsym(symtableentry).definition.nextoverloaded) then
  184. CGMessage(parser_e_no_overloaded_procvars);
  185. resulttype.setdef(tprocsym(symtableentry).definition);
  186. { if the owner of the procsym is a object, }
  187. { left must be set, if left isn't set }
  188. { it can be only self }
  189. { this code is only used in TP procvar mode }
  190. if (m_tp_procvar in aktmodeswitches) and
  191. not(assigned(left)) and
  192. (tprocsym(symtableentry).owner.symtabletype=objectsymtable) then
  193. begin
  194. left:=cselfnode.create(tobjectdef(symtableentry.owner.defowner));
  195. end;
  196. { process methodpointer }
  197. if assigned(left) then
  198. begin
  199. { if only typenode then remove }
  200. if left.nodetype=typen then
  201. begin
  202. left.free;
  203. left:=nil;
  204. end
  205. else
  206. resulttypepass(left);
  207. end;
  208. end;
  209. else
  210. internalerror(200104141);
  211. end;
  212. end;
  213. function tloadnode.pass_1 : tnode;
  214. begin
  215. result:=nil;
  216. location.loc:=LOC_REFERENCE;
  217. registers32:=0;
  218. registersfpu:=0;
  219. {$ifdef SUPPORT_MMX}
  220. registersmmx:=0;
  221. {$endif SUPPORT_MMX}
  222. case symtableentry.typ of
  223. absolutesym :
  224. ;
  225. funcretsym :
  226. internalerror(200104142);
  227. constsym:
  228. begin
  229. if tconstsym(symtableentry).consttyp=constresourcestring then
  230. begin
  231. { we use ansistrings so no fast exit here }
  232. if assigned(procinfo) then
  233. procinfo^.no_fast_exit:=true;
  234. location.loc:=LOC_MEM;
  235. end;
  236. end;
  237. varsym :
  238. begin
  239. if (symtable.symtabletype in [parasymtable,localsymtable]) and
  240. (lexlevel>symtable.symtablelevel) then
  241. begin
  242. { if the variable is in an other stackframe then we need
  243. a register to dereference }
  244. if (symtable.symtablelevel)>0 then
  245. begin
  246. registers32:=1;
  247. { further, the variable can't be put into a register }
  248. tvarsym(symtableentry).varoptions:=
  249. tvarsym(symtableentry).varoptions-[vo_fpuregable,vo_regable];
  250. end;
  251. end;
  252. if (tvarsym(symtableentry).varspez=vs_const) then
  253. location.loc:=LOC_MEM;
  254. { we need a register for call by reference parameters }
  255. if (tvarsym(symtableentry).varspez in [vs_var,vs_out]) or
  256. ((tvarsym(symtableentry).varspez=vs_const) and
  257. push_addr_param(tvarsym(symtableentry).vartype.def)) or
  258. { call by value open arrays are also indirect addressed }
  259. is_open_array(tvarsym(symtableentry).vartype.def) then
  260. registers32:=1;
  261. if symtable.symtabletype=withsymtable then
  262. inc(registers32);
  263. if ([vo_is_thread_var,vo_is_dll_var]*tvarsym(symtableentry).varoptions)<>[] then
  264. registers32:=1;
  265. { count variable references }
  266. { this will create problem with local var set by
  267. under_procedures
  268. if (assigned(tvarsym(symtableentry).owner) and assigned(aktprocsym)
  269. and ((tvarsym(symtableentry).owner = aktprocsym.definition.localst)
  270. or (tvarsym(symtableentry).owner = aktprocsym.definition.localst))) then }
  271. if t_times<1 then
  272. inc(tvarsym(symtableentry).refs)
  273. else
  274. inc(tvarsym(symtableentry).refs,t_times);
  275. end;
  276. typedconstsym :
  277. ;
  278. procsym :
  279. begin
  280. { method pointer ? }
  281. if assigned(left) then
  282. begin
  283. firstpass(left);
  284. registers32:=max(registers32,left.registers32);
  285. registersfpu:=max(registersfpu,left.registersfpu);
  286. {$ifdef SUPPORT_MMX}
  287. registersmmx:=max(registersmmx,left.registersmmx);
  288. {$endif SUPPORT_MMX}
  289. end;
  290. end;
  291. else
  292. internalerror(200104143);
  293. end;
  294. end;
  295. function tloadnode.docompare(p: tnode): boolean;
  296. begin
  297. docompare :=
  298. inherited docompare(p) and
  299. (symtableentry = tloadnode(p).symtableentry) and
  300. (symtable = tloadnode(p).symtable);
  301. end;
  302. {*****************************************************************************
  303. TASSIGNMENTNODE
  304. *****************************************************************************}
  305. constructor tassignmentnode.create(l,r : tnode);
  306. begin
  307. inherited create(assignn,l,r);
  308. assigntype:=at_normal;
  309. end;
  310. function tassignmentnode.getcopy : tnode;
  311. var
  312. n : tassignmentnode;
  313. begin
  314. n:=tassignmentnode(inherited getcopy);
  315. n.assigntype:=assigntype;
  316. getcopy:=n;
  317. end;
  318. function tassignmentnode.det_resulttype:tnode;
  319. begin
  320. result:=nil;
  321. resulttype:=voidtype;
  322. { must be made unique }
  323. if assigned(left) then
  324. begin
  325. set_unique(left);
  326. { set we the function result? }
  327. set_funcret_is_valid(left);
  328. end;
  329. resulttypepass(left);
  330. resulttypepass(right);
  331. set_varstate(left,false);
  332. set_varstate(right,true);
  333. if codegenerror then
  334. exit;
  335. { assignments to open arrays aren't allowed }
  336. if is_open_array(left.resulttype.def) then
  337. CGMessage(type_e_mismatch);
  338. { some string functions don't need conversion, so treat them separatly }
  339. if not (
  340. is_shortstring(left.resulttype.def) and
  341. (
  342. is_shortstring(right.resulttype.def) or
  343. is_ansistring(right.resulttype.def) or
  344. is_char(right.resulttype.def)
  345. )
  346. ) then
  347. inserttypeconv(right,left.resulttype);
  348. { test if node can be assigned, properties are allowed }
  349. valid_for_assignment(left);
  350. { check if local proc/func is assigned to procvar }
  351. if right.resulttype.def.deftype=procvardef then
  352. test_local_to_procvar(tprocvardef(right.resulttype.def),left.resulttype.def);
  353. end;
  354. function tassignmentnode.pass_1 : tnode;
  355. begin
  356. result:=nil;
  357. firstpass(left);
  358. firstpass(right);
  359. if codegenerror then
  360. exit;
  361. { some string functions don't need conversion, so treat them separatly }
  362. if is_shortstring(left.resulttype.def) and
  363. (
  364. is_shortstring(right.resulttype.def) or
  365. is_ansistring(right.resulttype.def) or
  366. is_char(right.resulttype.def)
  367. ) then
  368. begin
  369. { we call STRCOPY }
  370. procinfo^.flags:=procinfo^.flags or pi_do_call;
  371. { test for s:=s+anything ... }
  372. { the problem is for
  373. s:=s+s+s;
  374. this is broken here !! }
  375. {$ifdef newoptimizations2}
  376. { the above is fixed now, but still problem with s := s + f(); if }
  377. { f modifies s (bad programming, so only enable if uncertain }
  378. { optimizations are on) (JM) }
  379. if (cs_UncertainOpts in aktglobalswitches) then
  380. begin
  381. hp := right;
  382. while hp.treetype=addn do hp:=hp.left;
  383. if equal_trees(left,hp) and
  384. not multiple_uses(left,right) then
  385. begin
  386. concat_string:=true;
  387. hp:=right;
  388. while hp.treetype=addn do
  389. begin
  390. hp.use_strconcat:=true;
  391. hp:=hp.left;
  392. end;
  393. end;
  394. end;
  395. {$endif newoptimizations2}
  396. end;
  397. registers32:=left.registers32+right.registers32;
  398. registersfpu:=max(left.registersfpu,right.registersfpu);
  399. {$ifdef SUPPORT_MMX}
  400. registersmmx:=max(left.registersmmx,right.registersmmx);
  401. {$endif SUPPORT_MMX}
  402. end;
  403. function tassignmentnode.docompare(p: tnode): boolean;
  404. begin
  405. docompare :=
  406. inherited docompare(p) and
  407. (assigntype = tassignmentnode(p).assigntype);
  408. end;
  409. {*****************************************************************************
  410. TFUNCRETNODE
  411. *****************************************************************************}
  412. constructor tfuncretnode.create(p:pointer);
  413. begin
  414. inherited create(funcretn);
  415. funcretprocinfo:=p;
  416. end;
  417. function tfuncretnode.getcopy : tnode;
  418. var
  419. n : tfuncretnode;
  420. begin
  421. n:=tfuncretnode(inherited getcopy);
  422. n.funcretprocinfo:=funcretprocinfo;
  423. getcopy:=n;
  424. end;
  425. function tfuncretnode.det_resulttype:tnode;
  426. begin
  427. result:=nil;
  428. resulttype:=pprocinfo(funcretprocinfo)^.returntype;
  429. end;
  430. function tfuncretnode.pass_1 : tnode;
  431. begin
  432. result:=nil;
  433. location.loc:=LOC_REFERENCE;
  434. if ret_in_param(resulttype.def) or
  435. (procinfo<>pprocinfo(funcretprocinfo)) then
  436. registers32:=1;
  437. end;
  438. function tfuncretnode.docompare(p: tnode): boolean;
  439. begin
  440. docompare :=
  441. inherited docompare(p) and
  442. (funcretprocinfo = tfuncretnode(p).funcretprocinfo);
  443. end;
  444. {*****************************************************************************
  445. TARRAYCONSTRUCTORRANGENODE
  446. *****************************************************************************}
  447. constructor tarrayconstructorrangenode.create(l,r : tnode);
  448. begin
  449. inherited create(arrayconstructorrangen,l,r);
  450. end;
  451. function tarrayconstructorrangenode.det_resulttype:tnode;
  452. begin
  453. result:=nil;
  454. resulttypepass(left);
  455. resulttypepass(right);
  456. set_varstate(left,true);
  457. set_varstate(right,true);
  458. if codegenerror then
  459. exit;
  460. resulttype:=left.resulttype;
  461. end;
  462. function tarrayconstructorrangenode.pass_1 : tnode;
  463. begin
  464. firstpass(left);
  465. firstpass(right);
  466. calcregisters(self,0,0,0);
  467. result:=nil;
  468. end;
  469. {****************************************************************************
  470. TARRAYCONSTRUCTORNODE
  471. *****************************************************************************}
  472. constructor tarrayconstructornode.create(l,r : tnode);
  473. begin
  474. inherited create(arrayconstructorn,l,r);
  475. constructortype.reset;
  476. end;
  477. function tarrayconstructornode.getcopy : tnode;
  478. var
  479. n : tarrayconstructornode;
  480. begin
  481. n:=tarrayconstructornode(inherited getcopy);
  482. n.constructortype:=constructortype;
  483. result:=n;
  484. end;
  485. function tarrayconstructornode.det_resulttype:tnode;
  486. var
  487. htype : ttype;
  488. hp : tarrayconstructornode;
  489. len : longint;
  490. varia : boolean;
  491. begin
  492. result:=nil;
  493. { are we allowing array constructor? Then convert it to a set }
  494. if not allow_array_constructor then
  495. begin
  496. hp:=tarrayconstructornode(getcopy);
  497. arrayconstructor_to_set(hp);
  498. resulttypepass(hp);
  499. result:=hp;
  500. exit;
  501. end;
  502. { only pass left tree, right tree contains next construct if any }
  503. htype:=constructortype;
  504. len:=0;
  505. varia:=false;
  506. if assigned(left) then
  507. begin
  508. hp:=self;
  509. while assigned(hp) do
  510. begin
  511. resulttypepass(hp.left);
  512. set_varstate(hp.left,true);
  513. if (htype.def=nil) then
  514. htype:=hp.left.resulttype
  515. else
  516. begin
  517. if ((nf_novariaallowed in flags) or (not varia)) and
  518. (not is_equal(htype.def,hp.left.resulttype.def)) then
  519. begin
  520. varia:=true;
  521. end;
  522. end;
  523. inc(len);
  524. hp:=tarrayconstructornode(hp.right);
  525. end;
  526. end;
  527. if not assigned(htype.def) then
  528. htype:=voidtype;
  529. resulttype.setdef(tarraydef.create(0,len-1,s32bittype));
  530. tarraydef(resulttype.def).elementtype:=htype;
  531. tarraydef(resulttype.def).IsConstructor:=true;
  532. tarraydef(resulttype.def).IsVariant:=varia;
  533. end;
  534. function tarrayconstructornode.pass_1 : tnode;
  535. var
  536. thp,
  537. chp,
  538. hp : tarrayconstructornode;
  539. dovariant : boolean;
  540. htype : ttype;
  541. begin
  542. dovariant:=(nf_forcevaria in flags) or tarraydef(resulttype.def).isvariant;
  543. result:=nil;
  544. { only pass left tree, right tree contains next construct if any }
  545. if assigned(left) then
  546. begin
  547. hp:=self;
  548. while assigned(hp) do
  549. begin
  550. firstpass(hp.left);
  551. { Insert typeconvs for array of const }
  552. if dovariant then
  553. begin
  554. case hp.left.resulttype.def.deftype of
  555. enumdef :
  556. begin
  557. hp.left:=ctypeconvnode.create(hp.left,s32bittype);
  558. firstpass(hp.left);
  559. end;
  560. orddef :
  561. begin
  562. if is_integer(hp.left.resulttype.def) and
  563. not(is_64bitint(hp.left.resulttype.def)) then
  564. begin
  565. hp.left:=ctypeconvnode.create(hp.left,s32bittype);
  566. firstpass(hp.left);
  567. end;
  568. end;
  569. floatdef :
  570. begin
  571. hp.left:=ctypeconvnode.create(hp.left,pbestrealtype^);
  572. firstpass(hp.left);
  573. end;
  574. stringdef :
  575. begin
  576. if nf_cargs in flags then
  577. begin
  578. hp.left:=ctypeconvnode.create(hp.left,charpointertype);
  579. firstpass(hp.left);
  580. end;
  581. end;
  582. procvardef :
  583. begin
  584. hp.left:=ctypeconvnode.create(hp.left,voidpointertype);
  585. firstpass(hp.left);
  586. end;
  587. pointerdef,
  588. classrefdef,
  589. objectdef : ;
  590. else
  591. CGMessagePos1(hp.left.fileinfo,type_e_wrong_type_in_array_constructor,hp.left.resulttype.def.typename);
  592. end;
  593. end;
  594. hp:=tarrayconstructornode(hp.right);
  595. end;
  596. { swap the tree for cargs }
  597. if (nf_cargs in flags) and (not(nf_cargswap in flags)) then
  598. begin
  599. chp:=nil;
  600. { save resulttype }
  601. htype:=resulttype;
  602. { we need a copy here, because self is destroyed }
  603. { by firstpass later }
  604. hp:=tarrayconstructornode(getcopy);
  605. while assigned(hp) do
  606. begin
  607. thp:=tarrayconstructornode(hp.right);
  608. hp.right:=chp;
  609. chp:=hp;
  610. hp:=thp;
  611. end;
  612. include(chp.flags,nf_cargs);
  613. include(chp.flags,nf_cargswap);
  614. calcregisters(chp,0,0,0);
  615. chp.location.loc:=LOC_MEM;
  616. chp.resulttype:=htype;
  617. result:=chp;
  618. exit;
  619. end;
  620. end;
  621. calcregisters(self,0,0,0);
  622. location.loc:=LOC_MEM;
  623. end;
  624. function tarrayconstructornode.docompare(p: tnode): boolean;
  625. begin
  626. docompare :=
  627. inherited docompare(p) and
  628. (constructortype.def = tarrayconstructornode(p).constructortype.def);
  629. end;
  630. {*****************************************************************************
  631. TTYPENODE
  632. *****************************************************************************}
  633. constructor ttypenode.create(t : ttype);
  634. begin
  635. inherited create(typen);
  636. restype:=t;
  637. allowed:=false;
  638. end;
  639. function ttypenode.det_resulttype:tnode;
  640. begin
  641. result:=nil;
  642. resulttype:=restype;
  643. end;
  644. function ttypenode.pass_1 : tnode;
  645. begin
  646. result:=nil;
  647. { a typenode can't generate code, so we give here
  648. an error. Else it'll be an abstract error in pass_2.
  649. Only when the allowed flag is set we don't generate
  650. an error }
  651. if not allowed then
  652. Message(parser_e_no_type_not_allowed_here);
  653. end;
  654. function ttypenode.docompare(p: tnode): boolean;
  655. begin
  656. docompare :=
  657. inherited docompare(p);
  658. end;
  659. begin
  660. cloadnode:=tloadnode;
  661. cassignmentnode:=tassignmentnode;
  662. cfuncretnode:=tfuncretnode;
  663. carrayconstructorrangenode:=tarrayconstructorrangenode;
  664. carrayconstructornode:=tarrayconstructornode;
  665. ctypenode:=ttypenode;
  666. end.
  667. {
  668. $Log$
  669. Revision 1.19 2001-06-04 18:07:47 peter
  670. * remove unused typenode for procvar load. Don't know what happened why
  671. this code was not there already with revision 1.17.
  672. Revision 1.18 2001/06/04 11:48:01 peter
  673. * better const to var checking
  674. Revision 1.17 2001/05/19 21:19:57 peter
  675. * remove unused typenode for procvars to prevent error
  676. * typenode.allowed flag to allow a typenode
  677. Revision 1.16 2001/05/09 19:57:51 peter
  678. * typenode doesn't generate code, give error in pass_1 instead of
  679. getting an abstract methode runtime error
  680. Revision 1.15 2001/04/14 14:06:31 peter
  681. * move more code from loadnode.pass_1 to det_resulttype
  682. Revision 1.14 2001/04/13 01:22:10 peter
  683. * symtable change to classes
  684. * range check generation and errors fixed, make cycle DEBUG=1 works
  685. * memory leaks fixed
  686. Revision 1.13 2001/04/05 21:03:08 peter
  687. * array constructor fix
  688. Revision 1.12 2001/04/04 22:42:40 peter
  689. * move constant folding into det_resulttype
  690. Revision 1.11 2001/04/02 21:20:31 peter
  691. * resulttype rewrite
  692. Revision 1.10 2000/12/31 11:14:10 jonas
  693. + implemented/fixed docompare() mathods for all nodes (not tested)
  694. + nopt.pas, nadd.pas, i386/n386opt.pas: optimized nodes for adding strings
  695. and constant strings/chars together
  696. * n386add.pas: don't copy temp strings (of size 256) to another temp string
  697. when adding
  698. Revision 1.9 2000/11/29 00:30:33 florian
  699. * unused units removed from uses clause
  700. * some changes for widestrings
  701. Revision 1.8 2000/11/04 14:25:20 florian
  702. + merged Attila's changes for interfaces, not tested yet
  703. Revision 1.7 2000/10/31 22:02:49 peter
  704. * symtable splitted, no real code changes
  705. Revision 1.6 2000/10/14 10:14:50 peter
  706. * moehrendorf oct 2000 rewrite
  707. Revision 1.5 2000/10/01 19:48:24 peter
  708. * lot of compile updates for cg11
  709. Revision 1.4 2000/09/28 19:49:52 florian
  710. *** empty log message ***
  711. Revision 1.3 2000/09/27 18:14:31 florian
  712. * fixed a lot of syntax errors in the n*.pas stuff
  713. Revision 1.2 2000/09/25 15:37:14 florian
  714. * more fixes
  715. Revision 1.1 2000/09/25 14:55:05 florian
  716. * initial revision
  717. }