nld.pas 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819
  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. { method pointer ? }
  197. if assigned(left) then
  198. resulttypepass(left);
  199. end;
  200. else
  201. internalerror(200104141);
  202. end;
  203. end;
  204. function tloadnode.pass_1 : tnode;
  205. begin
  206. result:=nil;
  207. location.loc:=LOC_REFERENCE;
  208. registers32:=0;
  209. registersfpu:=0;
  210. {$ifdef SUPPORT_MMX}
  211. registersmmx:=0;
  212. {$endif SUPPORT_MMX}
  213. case symtableentry.typ of
  214. absolutesym :
  215. ;
  216. funcretsym :
  217. internalerror(200104142);
  218. constsym:
  219. begin
  220. if tconstsym(symtableentry).consttyp=constresourcestring then
  221. begin
  222. { we use ansistrings so no fast exit here }
  223. if assigned(procinfo) then
  224. procinfo^.no_fast_exit:=true;
  225. location.loc:=LOC_MEM;
  226. end;
  227. end;
  228. varsym :
  229. begin
  230. if (symtable.symtabletype in [parasymtable,localsymtable]) and
  231. (lexlevel>symtable.symtablelevel) then
  232. begin
  233. { if the variable is in an other stackframe then we need
  234. a register to dereference }
  235. if (symtable.symtablelevel)>0 then
  236. begin
  237. registers32:=1;
  238. { further, the variable can't be put into a register }
  239. tvarsym(symtableentry).varoptions:=
  240. tvarsym(symtableentry).varoptions-[vo_fpuregable,vo_regable];
  241. end;
  242. end;
  243. if (tvarsym(symtableentry).varspez=vs_const) then
  244. location.loc:=LOC_MEM;
  245. { we need a register for call by reference parameters }
  246. if (tvarsym(symtableentry).varspez in [vs_var,vs_out]) or
  247. ((tvarsym(symtableentry).varspez=vs_const) and
  248. push_addr_param(tvarsym(symtableentry).vartype.def)) or
  249. { call by value open arrays are also indirect addressed }
  250. is_open_array(tvarsym(symtableentry).vartype.def) then
  251. registers32:=1;
  252. if symtable.symtabletype=withsymtable then
  253. inc(registers32);
  254. if ([vo_is_thread_var,vo_is_dll_var]*tvarsym(symtableentry).varoptions)<>[] then
  255. registers32:=1;
  256. { count variable references }
  257. { this will create problem with local var set by
  258. under_procedures
  259. if (assigned(tvarsym(symtableentry).owner) and assigned(aktprocsym)
  260. and ((tvarsym(symtableentry).owner = aktprocsym.definition.localst)
  261. or (tvarsym(symtableentry).owner = aktprocsym.definition.localst))) then }
  262. if t_times<1 then
  263. inc(tvarsym(symtableentry).refs)
  264. else
  265. inc(tvarsym(symtableentry).refs,t_times);
  266. end;
  267. typedconstsym :
  268. ;
  269. procsym :
  270. begin
  271. { method pointer ? }
  272. if assigned(left) then
  273. begin
  274. firstpass(left);
  275. registers32:=max(registers32,left.registers32);
  276. registersfpu:=max(registersfpu,left.registersfpu);
  277. {$ifdef SUPPORT_MMX}
  278. registersmmx:=max(registersmmx,left.registersmmx);
  279. {$endif SUPPORT_MMX}
  280. end;
  281. end;
  282. else
  283. internalerror(200104143);
  284. end;
  285. end;
  286. function tloadnode.docompare(p: tnode): boolean;
  287. begin
  288. docompare :=
  289. inherited docompare(p) and
  290. (symtableentry = tloadnode(p).symtableentry) and
  291. (symtable = tloadnode(p).symtable);
  292. end;
  293. {*****************************************************************************
  294. TASSIGNMENTNODE
  295. *****************************************************************************}
  296. constructor tassignmentnode.create(l,r : tnode);
  297. begin
  298. inherited create(assignn,l,r);
  299. assigntype:=at_normal;
  300. end;
  301. function tassignmentnode.getcopy : tnode;
  302. var
  303. n : tassignmentnode;
  304. begin
  305. n:=tassignmentnode(inherited getcopy);
  306. n.assigntype:=assigntype;
  307. getcopy:=n;
  308. end;
  309. function tassignmentnode.det_resulttype:tnode;
  310. begin
  311. result:=nil;
  312. resulttype:=voidtype;
  313. { must be made unique }
  314. if assigned(left) then
  315. begin
  316. set_unique(left);
  317. { set we the function result? }
  318. set_funcret_is_valid(left);
  319. end;
  320. resulttypepass(left);
  321. resulttypepass(right);
  322. set_varstate(left,false);
  323. set_varstate(right,true);
  324. if codegenerror then
  325. exit;
  326. { assignments to open arrays aren't allowed }
  327. if is_open_array(left.resulttype.def) then
  328. CGMessage(type_e_mismatch);
  329. { some string functions don't need conversion, so treat them separatly }
  330. if not (
  331. is_shortstring(left.resulttype.def) and
  332. (
  333. is_shortstring(right.resulttype.def) or
  334. is_ansistring(right.resulttype.def) or
  335. is_char(right.resulttype.def)
  336. )
  337. ) then
  338. inserttypeconv(right,left.resulttype);
  339. { test if node can be assigned, properties are allowed }
  340. valid_for_assign(left,true);
  341. { check if local proc/func is assigned to procvar }
  342. if right.resulttype.def.deftype=procvardef then
  343. test_local_to_procvar(tprocvardef(right.resulttype.def),left.resulttype.def);
  344. end;
  345. function tassignmentnode.pass_1 : tnode;
  346. begin
  347. result:=nil;
  348. firstpass(left);
  349. firstpass(right);
  350. if codegenerror then
  351. exit;
  352. { some string functions don't need conversion, so treat them separatly }
  353. if is_shortstring(left.resulttype.def) and
  354. (
  355. is_shortstring(right.resulttype.def) or
  356. is_ansistring(right.resulttype.def) or
  357. is_char(right.resulttype.def)
  358. ) then
  359. begin
  360. { we call STRCOPY }
  361. procinfo^.flags:=procinfo^.flags or pi_do_call;
  362. { test for s:=s+anything ... }
  363. { the problem is for
  364. s:=s+s+s;
  365. this is broken here !! }
  366. {$ifdef newoptimizations2}
  367. { the above is fixed now, but still problem with s := s + f(); if }
  368. { f modifies s (bad programming, so only enable if uncertain }
  369. { optimizations are on) (JM) }
  370. if (cs_UncertainOpts in aktglobalswitches) then
  371. begin
  372. hp := right;
  373. while hp.treetype=addn do hp:=hp.left;
  374. if equal_trees(left,hp) and
  375. not multiple_uses(left,right) then
  376. begin
  377. concat_string:=true;
  378. hp:=right;
  379. while hp.treetype=addn do
  380. begin
  381. hp.use_strconcat:=true;
  382. hp:=hp.left;
  383. end;
  384. end;
  385. end;
  386. {$endif newoptimizations2}
  387. end;
  388. registers32:=left.registers32+right.registers32;
  389. registersfpu:=max(left.registersfpu,right.registersfpu);
  390. {$ifdef SUPPORT_MMX}
  391. registersmmx:=max(left.registersmmx,right.registersmmx);
  392. {$endif SUPPORT_MMX}
  393. end;
  394. function tassignmentnode.docompare(p: tnode): boolean;
  395. begin
  396. docompare :=
  397. inherited docompare(p) and
  398. (assigntype = tassignmentnode(p).assigntype);
  399. end;
  400. {*****************************************************************************
  401. TFUNCRETNODE
  402. *****************************************************************************}
  403. constructor tfuncretnode.create(p:pointer);
  404. begin
  405. inherited create(funcretn);
  406. funcretprocinfo:=p;
  407. end;
  408. function tfuncretnode.getcopy : tnode;
  409. var
  410. n : tfuncretnode;
  411. begin
  412. n:=tfuncretnode(inherited getcopy);
  413. n.funcretprocinfo:=funcretprocinfo;
  414. getcopy:=n;
  415. end;
  416. function tfuncretnode.det_resulttype:tnode;
  417. begin
  418. result:=nil;
  419. resulttype:=pprocinfo(funcretprocinfo)^.returntype;
  420. end;
  421. function tfuncretnode.pass_1 : tnode;
  422. begin
  423. result:=nil;
  424. location.loc:=LOC_REFERENCE;
  425. if ret_in_param(resulttype.def) or
  426. (procinfo<>pprocinfo(funcretprocinfo)) then
  427. registers32:=1;
  428. end;
  429. function tfuncretnode.docompare(p: tnode): boolean;
  430. begin
  431. docompare :=
  432. inherited docompare(p) and
  433. (funcretprocinfo = tfuncretnode(p).funcretprocinfo);
  434. end;
  435. {*****************************************************************************
  436. TARRAYCONSTRUCTORRANGENODE
  437. *****************************************************************************}
  438. constructor tarrayconstructorrangenode.create(l,r : tnode);
  439. begin
  440. inherited create(arrayconstructorrangen,l,r);
  441. end;
  442. function tarrayconstructorrangenode.det_resulttype:tnode;
  443. begin
  444. result:=nil;
  445. resulttypepass(left);
  446. resulttypepass(right);
  447. set_varstate(left,true);
  448. set_varstate(right,true);
  449. if codegenerror then
  450. exit;
  451. resulttype:=left.resulttype;
  452. end;
  453. function tarrayconstructorrangenode.pass_1 : tnode;
  454. begin
  455. firstpass(left);
  456. firstpass(right);
  457. calcregisters(self,0,0,0);
  458. result:=nil;
  459. end;
  460. {****************************************************************************
  461. TARRAYCONSTRUCTORNODE
  462. *****************************************************************************}
  463. constructor tarrayconstructornode.create(l,r : tnode);
  464. begin
  465. inherited create(arrayconstructorn,l,r);
  466. constructortype.reset;
  467. end;
  468. function tarrayconstructornode.getcopy : tnode;
  469. var
  470. n : tarrayconstructornode;
  471. begin
  472. n:=tarrayconstructornode(inherited getcopy);
  473. n.constructortype:=constructortype;
  474. result:=n;
  475. end;
  476. function tarrayconstructornode.det_resulttype:tnode;
  477. var
  478. htype : ttype;
  479. hp : tarrayconstructornode;
  480. len : longint;
  481. varia : boolean;
  482. begin
  483. result:=nil;
  484. { are we allowing array constructor? Then convert it to a set }
  485. if not allow_array_constructor then
  486. begin
  487. hp:=tarrayconstructornode(getcopy);
  488. arrayconstructor_to_set(hp);
  489. resulttypepass(hp);
  490. result:=hp;
  491. exit;
  492. end;
  493. { only pass left tree, right tree contains next construct if any }
  494. htype:=constructortype;
  495. len:=0;
  496. varia:=false;
  497. if assigned(left) then
  498. begin
  499. hp:=self;
  500. while assigned(hp) do
  501. begin
  502. resulttypepass(hp.left);
  503. set_varstate(hp.left,true);
  504. if (htype.def=nil) then
  505. htype:=hp.left.resulttype
  506. else
  507. begin
  508. if ((nf_novariaallowed in flags) or (not varia)) and
  509. (not is_equal(htype.def,hp.left.resulttype.def)) then
  510. begin
  511. varia:=true;
  512. end;
  513. end;
  514. inc(len);
  515. hp:=tarrayconstructornode(hp.right);
  516. end;
  517. end;
  518. if not assigned(htype.def) then
  519. htype:=voidtype;
  520. resulttype.setdef(tarraydef.create(0,len-1,s32bittype));
  521. tarraydef(resulttype.def).elementtype:=htype;
  522. tarraydef(resulttype.def).IsConstructor:=true;
  523. tarraydef(resulttype.def).IsVariant:=varia;
  524. end;
  525. function tarrayconstructornode.pass_1 : tnode;
  526. var
  527. thp,
  528. chp,
  529. hp : tarrayconstructornode;
  530. dovariant : boolean;
  531. htype : ttype;
  532. begin
  533. dovariant:=(nf_forcevaria in flags) or tarraydef(resulttype.def).isvariant;
  534. result:=nil;
  535. { only pass left tree, right tree contains next construct if any }
  536. if assigned(left) then
  537. begin
  538. hp:=self;
  539. while assigned(hp) do
  540. begin
  541. firstpass(hp.left);
  542. { Insert typeconvs for array of const }
  543. if dovariant then
  544. begin
  545. case hp.left.resulttype.def.deftype of
  546. enumdef :
  547. begin
  548. hp.left:=ctypeconvnode.create(hp.left,s32bittype);
  549. firstpass(hp.left);
  550. end;
  551. orddef :
  552. begin
  553. if is_integer(hp.left.resulttype.def) and
  554. not(is_64bitint(hp.left.resulttype.def)) then
  555. begin
  556. hp.left:=ctypeconvnode.create(hp.left,s32bittype);
  557. firstpass(hp.left);
  558. end;
  559. end;
  560. floatdef :
  561. begin
  562. hp.left:=ctypeconvnode.create(hp.left,pbestrealtype^);
  563. firstpass(hp.left);
  564. end;
  565. stringdef :
  566. begin
  567. if nf_cargs in flags then
  568. begin
  569. hp.left:=ctypeconvnode.create(hp.left,charpointertype);
  570. firstpass(hp.left);
  571. end;
  572. end;
  573. procvardef :
  574. begin
  575. hp.left:=ctypeconvnode.create(hp.left,voidpointertype);
  576. firstpass(hp.left);
  577. end;
  578. pointerdef,
  579. classrefdef,
  580. objectdef : ;
  581. else
  582. CGMessagePos1(hp.left.fileinfo,type_e_wrong_type_in_array_constructor,hp.left.resulttype.def.typename);
  583. end;
  584. end;
  585. hp:=tarrayconstructornode(hp.right);
  586. end;
  587. { swap the tree for cargs }
  588. if (nf_cargs in flags) and (not(nf_cargswap in flags)) then
  589. begin
  590. chp:=nil;
  591. { save resulttype }
  592. htype:=resulttype;
  593. { we need a copy here, because self is destroyed }
  594. { by firstpass later }
  595. hp:=tarrayconstructornode(getcopy);
  596. while assigned(hp) do
  597. begin
  598. thp:=tarrayconstructornode(hp.right);
  599. hp.right:=chp;
  600. chp:=hp;
  601. hp:=thp;
  602. end;
  603. include(chp.flags,nf_cargs);
  604. include(chp.flags,nf_cargswap);
  605. calcregisters(chp,0,0,0);
  606. chp.location.loc:=LOC_MEM;
  607. chp.resulttype:=htype;
  608. result:=chp;
  609. exit;
  610. end;
  611. end;
  612. calcregisters(self,0,0,0);
  613. location.loc:=LOC_MEM;
  614. end;
  615. function tarrayconstructornode.docompare(p: tnode): boolean;
  616. begin
  617. docompare :=
  618. inherited docompare(p) and
  619. (constructortype.def = tarrayconstructornode(p).constructortype.def);
  620. end;
  621. {*****************************************************************************
  622. TTYPENODE
  623. *****************************************************************************}
  624. constructor ttypenode.create(t : ttype);
  625. begin
  626. inherited create(typen);
  627. restype:=t;
  628. allowed:=false;
  629. end;
  630. function ttypenode.det_resulttype:tnode;
  631. begin
  632. result:=nil;
  633. resulttype:=restype;
  634. end;
  635. function ttypenode.pass_1 : tnode;
  636. begin
  637. result:=nil;
  638. { a typenode can't generate code, so we give here
  639. an error. Else it'll be an abstract error in pass_2.
  640. Only when the allowed flag is set we don't generate
  641. an error }
  642. if not allowed then
  643. Message(parser_e_no_type_not_allowed_here);
  644. end;
  645. function ttypenode.docompare(p: tnode): boolean;
  646. begin
  647. docompare :=
  648. inherited docompare(p);
  649. end;
  650. begin
  651. cloadnode:=tloadnode;
  652. cassignmentnode:=tassignmentnode;
  653. cfuncretnode:=tfuncretnode;
  654. carrayconstructorrangenode:=tarrayconstructorrangenode;
  655. carrayconstructornode:=tarrayconstructornode;
  656. ctypenode:=ttypenode;
  657. end.
  658. {
  659. $Log$
  660. Revision 1.17 2001-05-19 21:19:57 peter
  661. * remove unused typenode for procvars to prevent error
  662. * typenode.allowed flag to allow a typenode
  663. Revision 1.16 2001/05/09 19:57:51 peter
  664. * typenode doesn't generate code, give error in pass_1 instead of
  665. getting an abstract methode runtime error
  666. Revision 1.15 2001/04/14 14:06:31 peter
  667. * move more code from loadnode.pass_1 to det_resulttype
  668. Revision 1.14 2001/04/13 01:22:10 peter
  669. * symtable change to classes
  670. * range check generation and errors fixed, make cycle DEBUG=1 works
  671. * memory leaks fixed
  672. Revision 1.13 2001/04/05 21:03:08 peter
  673. * array constructor fix
  674. Revision 1.12 2001/04/04 22:42:40 peter
  675. * move constant folding into det_resulttype
  676. Revision 1.11 2001/04/02 21:20:31 peter
  677. * resulttype rewrite
  678. Revision 1.10 2000/12/31 11:14:10 jonas
  679. + implemented/fixed docompare() mathods for all nodes (not tested)
  680. + nopt.pas, nadd.pas, i386/n386opt.pas: optimized nodes for adding strings
  681. and constant strings/chars together
  682. * n386add.pas: don't copy temp strings (of size 256) to another temp string
  683. when adding
  684. Revision 1.9 2000/11/29 00:30:33 florian
  685. * unused units removed from uses clause
  686. * some changes for widestrings
  687. Revision 1.8 2000/11/04 14:25:20 florian
  688. + merged Attila's changes for interfaces, not tested yet
  689. Revision 1.7 2000/10/31 22:02:49 peter
  690. * symtable splitted, no real code changes
  691. Revision 1.6 2000/10/14 10:14:50 peter
  692. * moehrendorf oct 2000 rewrite
  693. Revision 1.5 2000/10/01 19:48:24 peter
  694. * lot of compile updates for cg11
  695. Revision 1.4 2000/09/28 19:49:52 florian
  696. *** empty log message ***
  697. Revision 1.3 2000/09/27 18:14:31 florian
  698. * fixed a lot of syntax errors in the n*.pas stuff
  699. Revision 1.2 2000/09/25 15:37:14 florian
  700. * more fixes
  701. Revision 1.1 2000/09/25 14:55:05 florian
  702. * initial revision
  703. }