nld.pas 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769
  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 : psym;
  27. symtable : psymtable;
  28. constructor create(v : psym;st : psymtable);virtual;
  29. function getcopy : tnode;override;
  30. function pass_1 : tnode;override;
  31. end;
  32. { different assignment types }
  33. tassigntype = (at_normal,at_plus,at_minus,at_star,at_slash);
  34. tassignmentnode = class(tbinarynode)
  35. assigntype : tassigntype;
  36. constructor create(l,r : tnode);virtual;
  37. function getcopy : tnode;override;
  38. function pass_1 : tnode;override;
  39. end;
  40. tfuncretnode = class(tnode)
  41. funcretprocinfo : pointer;
  42. rettype : ttype;
  43. constructor create;virtual;
  44. function getcopy : tnode;override;
  45. function pass_1 : tnode;override;
  46. end;
  47. tarrayconstructorrangenode = class(tbinarynode)
  48. constructor create(l,r : tnode);virtual;
  49. function pass_1 : tnode;override;
  50. end;
  51. tarrayconstructornode = class(tbinarynode)
  52. constructordef : pdef;
  53. constructor create(l,r : tnode);virtual;
  54. function getcopy : tnode;override;
  55. function pass_1 : tnode;override;
  56. end;
  57. ttypenode = class(tnode)
  58. typenodetype : pdef;
  59. typenodesym:ptypesym;
  60. constructor create(t : pdef;sym:ptypesym);virtual;
  61. function getcopy : tnode;override;
  62. function pass_1 : tnode;override;
  63. end;
  64. var
  65. cloadnode : class of tloadnode;
  66. cassignmentnode : class of tassignmentnode;
  67. cfuncretnode : class of tfuncretnode;
  68. carrayconstructorrangenode : class of tarrayconstructorrangenode;
  69. carrayconstructornode : class of tarrayconstructornode;
  70. ctypenode : class of ttypenode;
  71. function genloadnode(v : pvarsym;st : psymtable) : tloadnode;
  72. function gentypenode(t : pdef;sym:ptypesym) : ttypenode;
  73. function genloadcallnode(v: pprocsym;st: psymtable): tloadnode;
  74. function genloadmethodcallnode(v: pprocsym;st: psymtable; mp: tnode): tloadnode;
  75. function gentypedconstloadnode(sym : ptypedconstsym;st : psymtable) : tloadnode;
  76. implementation
  77. uses
  78. cutils,cobjects,verbose,globtype,globals,systems,
  79. symconst,symdef,symtable,aasm,types,
  80. htypechk,pass_1,
  81. ncnv,nmem,cpubase
  82. {$ifdef newcg}
  83. ,cgbase
  84. ,tgobj
  85. ,tgcpu
  86. {$else newcg}
  87. ,hcodegen
  88. {$ifdef i386}
  89. ,tgeni386
  90. {$endif}
  91. {$endif newcg}
  92. ;
  93. function genloadnode(v : pvarsym;st : psymtable) : tloadnode;
  94. var
  95. n : tloadnode;
  96. begin
  97. n:=cloadnode.create(v,st);
  98. n.resulttype:=v^.vartype.def;
  99. genloadnode:=n;
  100. end;
  101. function genloadcallnode(v: pprocsym;st: psymtable): tloadnode;
  102. var
  103. n : tloadnode;
  104. begin
  105. n:=cloadnode.create(v,st);
  106. n.resulttype:=v^.definition;
  107. genloadcallnode:=n;
  108. end;
  109. function genloadmethodcallnode(v: pprocsym;st: psymtable; mp: tnode): tloadnode;
  110. var
  111. n : tloadnode;
  112. begin
  113. n:=cloadnode.create(v,st);
  114. n.resulttype:=v^.definition;
  115. n.left:=mp;
  116. genloadmethodcallnode:=n;
  117. end;
  118. function gentypedconstloadnode(sym : ptypedconstsym;st : psymtable) : tloadnode;
  119. var
  120. n : tloadnode;
  121. begin
  122. n:=cloadnode.create(sym,st);
  123. n.resulttype:=sym^.typedconsttype.def;
  124. gentypedconstloadnode:=n;
  125. end;
  126. function gentypenode(t : pdef;sym:ptypesym) : ttypenode;
  127. begin
  128. gentypenode:=ctypenode.create(t,sym);
  129. end;
  130. {*****************************************************************************
  131. TLOADNODE
  132. *****************************************************************************}
  133. constructor tloadnode.create(v : psym;st : psymtable);
  134. begin
  135. inherited create(loadn,nil);
  136. symtableentry:=v;
  137. symtable:=st;
  138. end;
  139. function tloadnode.getcopy : tnode;
  140. var
  141. n : tloadnode;
  142. begin
  143. n:=tloadnode(inherited getcopy);
  144. n.symtable:=symtable;
  145. n.symtableentry:=symtableentry;
  146. result:=n;
  147. end;
  148. function tloadnode.pass_1 : tnode;
  149. var
  150. p1 : tnode;
  151. begin
  152. result:=nil;
  153. if (symtable^.symtabletype=withsymtable) and
  154. (pwithsymtable(symtable)^.direct_with) and
  155. (symtableentry^.typ=varsym) then
  156. begin
  157. p1:=tnode(pwithsymtable(symtable)^.withrefnode).getcopy;
  158. p1:=gensubscriptnode(pvarsym(symtableentry),p1);
  159. left:=nil;
  160. firstpass(p1);
  161. result:=p1;
  162. exit;
  163. end;
  164. location.loc:=LOC_REFERENCE;
  165. registers32:=0;
  166. registersfpu:=0;
  167. {$ifdef SUPPORT_MMX}
  168. registersmmx:=0;
  169. {$endif SUPPORT_MMX}
  170. { handle first absolute as it will replace the symtableentry }
  171. if symtableentry^.typ=absolutesym then
  172. begin
  173. resulttype:=pabsolutesym(symtableentry)^.vartype.def;
  174. { replace the symtableentry when it points to a var, else
  175. we are finished }
  176. if pabsolutesym(symtableentry)^.abstyp=tovar then
  177. begin
  178. symtableentry:=pabsolutesym(symtableentry)^.ref;
  179. symtable:=symtableentry^.owner;
  180. include(flags,nf_absolute);
  181. end
  182. else
  183. exit;
  184. end;
  185. case symtableentry^.typ of
  186. funcretsym :
  187. begin
  188. p1:=cfuncretnode.create;
  189. tfuncretnode(p1).funcretprocinfo:=pprocinfo(pfuncretsym(symtableentry)^.funcretprocinfo);
  190. tfuncretnode(p1).rettype:=pfuncretsym(symtableentry)^.rettype;
  191. firstpass(p1);
  192. { if it's refered as absolute then we need to have the
  193. type of the absolute instead of the function return,
  194. the function return is then also assigned }
  195. if nf_absolute in flags then
  196. begin
  197. pprocinfo(tfuncretnode(p1).funcretprocinfo)^.funcret_state:=vs_assigned;
  198. p1.resulttype:=resulttype;
  199. end;
  200. left:=nil;
  201. result:=p1;
  202. end;
  203. constsym:
  204. begin
  205. if pconstsym(symtableentry)^.consttyp=constresourcestring then
  206. begin
  207. resulttype:=cansistringdef;
  208. { we use ansistrings so no fast exit here }
  209. if assigned(procinfo) then
  210. procinfo^.no_fast_exit:=true;
  211. location.loc:=LOC_MEM;
  212. end
  213. else
  214. internalerror(22799);
  215. end;
  216. varsym :
  217. begin
  218. { if it's refered by absolute then it's used }
  219. if nf_absolute in flags then
  220. pvarsym(symtableentry)^.varstate:=vs_used
  221. else
  222. if (resulttype=nil) then
  223. resulttype:=pvarsym(symtableentry)^.vartype.def;
  224. if (symtable^.symtabletype in [parasymtable,localsymtable]) and
  225. (lexlevel>symtable^.symtablelevel) then
  226. begin
  227. { if the variable is in an other stackframe then we need
  228. a register to dereference }
  229. if (symtable^.symtablelevel)>0 then
  230. begin
  231. registers32:=1;
  232. { further, the variable can't be put into a register }
  233. pvarsym(symtableentry)^.varoptions:=
  234. pvarsym(symtableentry)^.varoptions-[vo_fpuregable,vo_regable];
  235. end;
  236. end;
  237. if (pvarsym(symtableentry)^.varspez=vs_const) then
  238. location.loc:=LOC_MEM;
  239. { we need a register for call by reference parameters }
  240. if (pvarsym(symtableentry)^.varspez in [vs_var,vs_out]) or
  241. ((pvarsym(symtableentry)^.varspez=vs_const) and
  242. push_addr_param(pvarsym(symtableentry)^.vartype.def)) or
  243. { call by value open arrays are also indirect addressed }
  244. is_open_array(pvarsym(symtableentry)^.vartype.def) then
  245. registers32:=1;
  246. if symtable^.symtabletype=withsymtable then
  247. inc(registers32);
  248. if ([vo_is_thread_var,vo_is_dll_var]*pvarsym(symtableentry)^.varoptions)<>[] then
  249. registers32:=1;
  250. { count variable references }
  251. { this will create problem with local var set by
  252. under_procedures
  253. if (assigned(pvarsym(symtableentry)^.owner) and assigned(aktprocsym)
  254. and ((pvarsym(symtableentry)^.owner = aktprocsym^.definition^.localst)
  255. or (pvarsym(symtableentry)^.owner = aktprocsym^.definition^.localst))) then }
  256. if t_times<1 then
  257. inc(pvarsym(symtableentry)^.refs)
  258. else
  259. inc(pvarsym(symtableentry)^.refs,t_times);
  260. end;
  261. typedconstsym :
  262. if not(nf_absolute in flags) then
  263. resulttype:=ptypedconstsym(symtableentry)^.typedconsttype.def;
  264. procsym :
  265. begin
  266. if assigned(pprocsym(symtableentry)^.definition^.nextoverloaded) then
  267. CGMessage(parser_e_no_overloaded_procvars);
  268. resulttype:=pprocsym(symtableentry)^.definition;
  269. { if the owner of the procsym is a object, }
  270. { left must be set, if left isn't set }
  271. { it can be only self }
  272. { this code is only used in TP procvar mode }
  273. if (m_tp_procvar in aktmodeswitches) and
  274. not(assigned(left)) and
  275. (pprocsym(symtableentry)^.owner^.symtabletype=objectsymtable) then
  276. left:=genselfnode(pobjectdef(symtableentry^.owner^.defowner));
  277. { method pointer ? }
  278. if assigned(left) then
  279. begin
  280. firstpass(left);
  281. registers32:=max(registers32,left.registers32);
  282. registersfpu:=max(registersfpu,left.registersfpu);
  283. {$ifdef SUPPORT_MMX}
  284. registersmmx:=max(registersmmx,left.registersmmx);
  285. {$endif SUPPORT_MMX}
  286. end;
  287. end;
  288. else
  289. internalerror(3);
  290. end;
  291. end;
  292. {*****************************************************************************
  293. TASSIGNMENTNODE
  294. *****************************************************************************}
  295. constructor tassignmentnode.create(l,r : tnode);
  296. begin
  297. inherited create(assignn,l,r);
  298. assigntype:=at_normal;
  299. end;
  300. function tassignmentnode.getcopy : tnode;
  301. var
  302. n : tassignmentnode;
  303. begin
  304. n:=tassignmentnode(inherited getcopy);
  305. n.assigntype:=assigntype;
  306. getcopy:=n;
  307. end;
  308. function tassignmentnode.pass_1 : tnode;
  309. {$ifdef newoptimizations2}
  310. var
  311. hp : tnode;
  312. {$endif newoptimizations2}
  313. begin
  314. result:=nil;
  315. { must be made unique }
  316. if assigned(left) then
  317. begin
  318. set_unique(left);
  319. { set we the function result? }
  320. set_funcret_is_valid(left);
  321. end;
  322. firstpass(left);
  323. set_varstate(left,false);
  324. if codegenerror then
  325. exit;
  326. { assignements to open arrays aren't allowed }
  327. if is_open_array(left.resulttype) then
  328. CGMessage(type_e_mismatch);
  329. { test if we can avoid copying string to temp
  330. as in s:=s+...; (PM) }
  331. {$ifdef dummyi386}
  332. if ((right.treetype=addn) or (right.treetype=subn)) and
  333. equal_trees(left,right.left) and
  334. (ret_in_acc(left.resulttype)) and
  335. (not cs_rangechecking in aktmoduleswitches^) then
  336. begin
  337. disposetree(right.left);
  338. hp:=right;
  339. right:=right.right;
  340. if hp.treetype=addn then
  341. assigntyp:=at_plus
  342. else
  343. assigntyp:=at_minus;
  344. putnode(hp);
  345. end;
  346. if assigntyp<>at_normal then
  347. begin
  348. { for fpu type there is no faster way }
  349. if is_fpu(left.resulttype) then
  350. case assigntyp of
  351. at_plus : right:=gennode(addn,getcopy(left),right);
  352. at_minus : right:=gennode(subn,getcopy(left),right);
  353. at_star : right:=gennode(muln,getcopy(left),right);
  354. at_slash : right:=gennode(slashn,getcopy(left),right);
  355. end;
  356. end;
  357. {$endif i386}
  358. firstpass(right);
  359. set_varstate(right,true);
  360. if codegenerror then
  361. exit;
  362. { some string functions don't need conversion, so treat them separatly }
  363. if is_shortstring(left.resulttype) and (assigned(right.resulttype)) then
  364. begin
  365. if not (is_shortstring(right.resulttype) or
  366. is_ansistring(right.resulttype) or
  367. is_char(right.resulttype)) then
  368. begin
  369. right:=gentypeconvnode(right,left.resulttype);
  370. firstpass(right);
  371. if codegenerror then
  372. exit;
  373. end;
  374. { we call STRCOPY }
  375. procinfo^.flags:=procinfo^.flags or pi_do_call;
  376. { test for s:=s+anything ... }
  377. { the problem is for
  378. s:=s+s+s;
  379. this is broken here !! }
  380. {$ifdef newoptimizations2}
  381. { the above is fixed now, but still problem with s := s + f(); if }
  382. { f modifies s (bad programming, so only enable if uncertain }
  383. { optimizations are on) (JM) }
  384. if (cs_UncertainOpts in aktglobalswitches) then
  385. begin
  386. hp := right;
  387. while hp.treetype=addn do hp:=hp.left;
  388. if equal_trees(left,hp) and
  389. not multiple_uses(left,right) then
  390. begin
  391. concat_string:=true;
  392. hp:=right;
  393. while hp.treetype=addn do
  394. begin
  395. hp.use_strconcat:=true;
  396. hp:=hp.left;
  397. end;
  398. end;
  399. end;
  400. {$endif newoptimizations2}
  401. end
  402. else
  403. begin
  404. right:=gentypeconvnode(right,left.resulttype);
  405. firstpass(right);
  406. if codegenerror then
  407. exit;
  408. end;
  409. { test if node can be assigned, properties are allowed }
  410. valid_for_assign(left,true);
  411. { check if local proc/func is assigned to procvar }
  412. if right.resulttype^.deftype=procvardef then
  413. test_local_to_procvar(pprocvardef(right.resulttype),left.resulttype);
  414. resulttype:=voiddef;
  415. {
  416. registers32:=max(left.registers32,right.registers32);
  417. registersfpu:=max(left.registersfpu,right.registersfpu);
  418. }
  419. registers32:=left.registers32+right.registers32;
  420. registersfpu:=max(left.registersfpu,right.registersfpu);
  421. {$ifdef SUPPORT_MMX}
  422. registersmmx:=max(left.registersmmx,right.registersmmx);
  423. {$endif SUPPORT_MMX}
  424. end;
  425. {*****************************************************************************
  426. TFUNCRETNODE
  427. *****************************************************************************}
  428. constructor tfuncretnode.create;
  429. begin
  430. inherited create(funcretn);
  431. funcretprocinfo:=nil;
  432. end;
  433. function tfuncretnode.getcopy : tnode;
  434. var
  435. n : tfuncretnode;
  436. begin
  437. n:=tfuncretnode(inherited getcopy);
  438. n.funcretprocinfo:=funcretprocinfo;
  439. n.rettype:=rettype;
  440. getcopy:=n;
  441. end;
  442. function tfuncretnode.pass_1 : tnode;
  443. begin
  444. result:=nil;
  445. resulttype:=rettype.def;
  446. location.loc:=LOC_REFERENCE;
  447. if ret_in_param(rettype.def) or
  448. (procinfo<>pprocinfo(funcretprocinfo)) then
  449. registers32:=1;
  450. end;
  451. {*****************************************************************************
  452. TARRAYCONSTRUCTORRANGENODE
  453. *****************************************************************************}
  454. constructor tarrayconstructorrangenode.create(l,r : tnode);
  455. begin
  456. inherited create(arrayconstructorrangen,l,r);
  457. end;
  458. function tarrayconstructorrangenode.pass_1 : tnode;
  459. begin
  460. result:=nil;
  461. firstpass(left);
  462. set_varstate(left,true);
  463. firstpass(right);
  464. set_varstate(right,true);
  465. calcregisters(self,0,0,0);
  466. resulttype:=left.resulttype;
  467. end;
  468. {****************************************************************************
  469. TARRAYCONSTRUCTORNODE
  470. *****************************************************************************}
  471. constructor tarrayconstructornode.create(l,r : tnode);
  472. begin
  473. inherited create(arrayconstructorn,l,r);
  474. constructordef:=nil;
  475. end;
  476. function tarrayconstructornode.getcopy : tnode;
  477. var
  478. n : tarrayconstructornode;
  479. begin
  480. n:=tarrayconstructornode(inherited getcopy);
  481. n.constructordef:=constructordef;
  482. result:=n;
  483. end;
  484. function tarrayconstructornode.pass_1 : tnode;
  485. var
  486. pd : pdef;
  487. thp,
  488. chp,
  489. hp : tarrayconstructornode;
  490. len : longint;
  491. varia : boolean;
  492. procedure postprocess(t : tnode);
  493. begin
  494. calcregisters(tbinarynode(t),0,0,0);
  495. { looks a little bit dangerous to me }
  496. { len-1 gives problems with is_open_array if len=0, }
  497. { is_open_array checks now for isconstructor (FK) }
  498. { if no type is set then we set the type to voiddef to overcome a
  499. 0 addressing }
  500. if not assigned(pd) then
  501. pd:=voiddef;
  502. { skip if already done ! (PM) }
  503. if not assigned(t.resulttype) or
  504. (t.resulttype^.deftype<>arraydef) or
  505. not parraydef(t.resulttype)^.IsConstructor or
  506. (parraydef(t.resulttype)^.lowrange<>0) or
  507. (parraydef(t.resulttype)^.highrange<>len-1) then
  508. t.resulttype:=new(parraydef,init(0,len-1,s32bitdef));
  509. parraydef(t.resulttype)^.elementtype.def:=pd;
  510. parraydef(t.resulttype)^.IsConstructor:=true;
  511. parraydef(t.resulttype)^.IsVariant:=varia;
  512. t.location.loc:=LOC_MEM;
  513. end;
  514. begin
  515. result:=nil;
  516. { are we allowing array constructor? Then convert it to a set }
  517. if not allow_array_constructor then
  518. begin
  519. hp:=tarrayconstructornode(getcopy);
  520. arrayconstructor_to_set(hp);
  521. firstpass(hp);
  522. pass_1:=hp;
  523. exit;
  524. end;
  525. { only pass left tree, right tree contains next construct if any }
  526. pd:=constructordef;
  527. len:=0;
  528. varia:=false;
  529. if assigned(left) then
  530. begin
  531. hp:=self;
  532. while assigned(hp) do
  533. begin
  534. firstpass(hp.left);
  535. set_varstate(hp.left,true);
  536. if (not get_para_resulttype) and
  537. (not(nf_novariaallowed in flags)) then
  538. begin
  539. case hp.left.resulttype^.deftype of
  540. enumdef :
  541. begin
  542. hp.left:=gentypeconvnode(hp.left,s32bitdef);
  543. firstpass(hp.left);
  544. end;
  545. orddef :
  546. begin
  547. if is_integer(hp.left.resulttype) and
  548. not(is_64bitint(hp.left.resulttype)) then
  549. begin
  550. hp.left:=gentypeconvnode(hp.left,s32bitdef);
  551. firstpass(hp.left);
  552. end;
  553. end;
  554. floatdef :
  555. begin
  556. hp.left:=gentypeconvnode(hp.left,bestrealdef^);
  557. firstpass(hp.left);
  558. end;
  559. stringdef :
  560. begin
  561. if nf_cargs in flags then
  562. begin
  563. hp.left:=gentypeconvnode(hp.left,charpointerdef);
  564. firstpass(hp.left);
  565. end;
  566. end;
  567. procvardef :
  568. begin
  569. hp.left:=gentypeconvnode(hp.left,voidpointerdef);
  570. firstpass(hp.left);
  571. end;
  572. pointerdef,
  573. classrefdef,
  574. objectdef : ;
  575. else
  576. CGMessagePos1(hp.left.fileinfo,type_e_wrong_type_in_array_constructor,hp.left.resulttype^.typename);
  577. end;
  578. end;
  579. if (pd=nil) then
  580. pd:=hp.left.resulttype
  581. else
  582. begin
  583. if ((nf_novariaallowed in flags) or (not varia)) and
  584. (not is_equal(pd,hp.left.resulttype)) then
  585. begin
  586. { if both should be equal try inserting a conversion }
  587. if nf_novariaallowed in flags then
  588. begin
  589. hp.left:=gentypeconvnode(hp.left,pd);
  590. firstpass(hp.left);
  591. end;
  592. varia:=true;
  593. end;
  594. end;
  595. inc(len);
  596. hp:=tarrayconstructornode(hp.right);
  597. end;
  598. { swap the tree for cargs }
  599. if (nf_cargs in flags) and (not(nf_cargswap in flags)) then
  600. begin
  601. chp:=nil;
  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. postprocess(chp);
  615. pass_1:=chp;
  616. exit;
  617. end;
  618. end;
  619. postprocess(self);
  620. end;
  621. {*****************************************************************************
  622. TTYPENODE
  623. *****************************************************************************}
  624. constructor ttypenode.create(t : pdef;sym:ptypesym);
  625. begin
  626. inherited create(typen);
  627. resulttype:=generrordef;
  628. typenodetype:=t;
  629. typenodesym:=sym;
  630. end;
  631. function ttypenode.getcopy : tnode;
  632. var
  633. n : ttypenode;
  634. begin
  635. n:=ttypenode(inherited getcopy);
  636. n.typenodetype:=typenodetype;
  637. n.typenodesym:=typenodesym;
  638. result:=n;
  639. end;
  640. function ttypenode.pass_1 : tnode;
  641. begin
  642. pass_1:=nil;
  643. { do nothing, resulttype is already set }
  644. end;
  645. begin
  646. cloadnode:=tloadnode;
  647. cassignmentnode:=tassignmentnode;
  648. cfuncretnode:=tfuncretnode;
  649. carrayconstructorrangenode:=tarrayconstructorrangenode;
  650. carrayconstructornode:=tarrayconstructornode;
  651. ctypenode:=ttypenode;
  652. end.
  653. {
  654. $Log$
  655. Revision 1.8 2000-11-04 14:25:20 florian
  656. + merged Attila's changes for interfaces, not tested yet
  657. Revision 1.7 2000/10/31 22:02:49 peter
  658. * symtable splitted, no real code changes
  659. Revision 1.6 2000/10/14 10:14:50 peter
  660. * moehrendorf oct 2000 rewrite
  661. Revision 1.5 2000/10/01 19:48:24 peter
  662. * lot of compile updates for cg11
  663. Revision 1.4 2000/09/28 19:49:52 florian
  664. *** empty log message ***
  665. Revision 1.3 2000/09/27 18:14:31 florian
  666. * fixed a lot of syntax errors in the n*.pas stuff
  667. Revision 1.2 2000/09/25 15:37:14 florian
  668. * more fixes
  669. Revision 1.1 2000/09/25 14:55:05 florian
  670. * initial revision
  671. }