pdecobj.pas 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883
  1. {
  2. $Id$
  3. Copyright (c) 1998-2002 by Florian Klaempfl
  4. Does object types for Free Pascal
  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 pdecobj;
  19. {$i fpcdefs.inc}
  20. interface
  21. uses
  22. globtype,symtype,symdef;
  23. { parses a object declaration }
  24. function object_dec(const n : stringid;fd : tobjectdef) : tdef;
  25. implementation
  26. uses
  27. cutils,cclasses,
  28. globals,verbose,systems,tokens,
  29. symconst,symbase,symsym,symtable,defutil,defcmp,
  30. node,nld,nmem,ncon,ncnv,ncal,pass_1,
  31. scanner,
  32. pbase,pexpr,pdecsub,pdecvar,ptype
  33. {$ifdef delphi}
  34. ,dmisc
  35. ,sysutils
  36. {$endif}
  37. ;
  38. const
  39. { Please leave this here, this module should NOT use
  40. these variables.
  41. Declaring it as string here results in an error when compiling (PFV) }
  42. current_procinfo = 'error';
  43. function object_dec(const n : stringid;fd : tobjectdef) : tdef;
  44. { this function parses an object or class declaration }
  45. var
  46. there_is_a_destructor : boolean;
  47. classtype : tobjectdeftype;
  48. childof : tobjectdef;
  49. aktclass : tobjectdef;
  50. function constructor_head:tprocdef;
  51. var
  52. pd : tprocdef;
  53. begin
  54. consume(_CONSTRUCTOR);
  55. { must be at same level as in implementation }
  56. pd:=parse_proc_head(aktclass,potype_constructor);
  57. if (cs_constructor_name in aktglobalswitches) and
  58. (pd.procsym.name<>'INIT') then
  59. Message(parser_e_constructorname_must_be_init);
  60. consume(_SEMICOLON);
  61. include(aktclass.objectoptions,oo_has_constructor);
  62. { Set return type, class constructors return the
  63. created instance, object constructors return boolean }
  64. if is_class(pd._class) then
  65. pd.rettype.setdef(pd._class)
  66. else
  67. pd.rettype:=booltype;
  68. constructor_head:=pd;
  69. end;
  70. procedure property_dec;
  71. var
  72. p : tpropertysym;
  73. begin
  74. { check for a class }
  75. if not((is_class_or_interface(aktclass)) or
  76. ((m_delphi in aktmodeswitches) and (is_object(aktclass)))) then
  77. Message(parser_e_syntax_error);
  78. consume(_PROPERTY);
  79. p:=read_property_dec(aktclass);
  80. consume(_SEMICOLON);
  81. if try_to_consume(_DEFAULT) then
  82. begin
  83. include(p.propoptions,ppo_defaultproperty);
  84. if not(ppo_hasparameters in p.propoptions) then
  85. message(parser_e_property_need_paras);
  86. consume(_SEMICOLON);
  87. end;
  88. end;
  89. function destructor_head:tprocdef;
  90. var
  91. pd : tprocdef;
  92. begin
  93. consume(_DESTRUCTOR);
  94. pd:=parse_proc_head(aktclass,potype_destructor);
  95. if (cs_constructor_name in aktglobalswitches) and
  96. (pd.procsym.name<>'DONE') then
  97. Message(parser_e_destructorname_must_be_done);
  98. if not(pd.maxparacount=0) and
  99. (m_fpc in aktmodeswitches) then
  100. Message(parser_e_no_paras_for_destructor);
  101. consume(_SEMICOLON);
  102. include(aktclass.objectoptions,oo_has_destructor);
  103. { no return value }
  104. pd.rettype:=voidtype;
  105. destructor_head:=pd;
  106. end;
  107. var
  108. hs : string;
  109. pcrd : tclassrefdef;
  110. tt : ttype;
  111. old_object_option : tsymoptions;
  112. oldparse_only : boolean;
  113. storetypecanbeforward : boolean;
  114. procedure setclassattributes;
  115. begin
  116. { publishable }
  117. if classtype in [odt_interfacecom,odt_class] then
  118. begin
  119. aktclass.objecttype:=classtype;
  120. if (cs_generate_rtti in aktlocalswitches) or
  121. (assigned(aktclass.childof) and
  122. (oo_can_have_published in aktclass.childof.objectoptions)) then
  123. begin
  124. include(aktclass.objectoptions,oo_can_have_published);
  125. { in "publishable" classes the default access type is published }
  126. current_object_option:=[sp_published];
  127. end;
  128. end;
  129. end;
  130. procedure setclassparent;
  131. begin
  132. if assigned(fd) then
  133. aktclass:=fd
  134. else
  135. aktclass:=tobjectdef.create(classtype,n,nil);
  136. { is the current class tobject? }
  137. { so you could define your own tobject }
  138. if (cs_compilesystem in aktmoduleswitches) and (classtype=odt_class) and (upper(n)='TOBJECT') then
  139. class_tobject:=aktclass
  140. else if (cs_compilesystem in aktmoduleswitches) and (classtype=odt_interfacecom) and (upper(n)='IUNKNOWN') then
  141. interface_iunknown:=aktclass
  142. else
  143. begin
  144. case classtype of
  145. odt_class:
  146. childof:=class_tobject;
  147. odt_interfacecom:
  148. childof:=interface_iunknown;
  149. end;
  150. if (oo_is_forward in childof.objectoptions) then
  151. Message1(parser_e_forward_declaration_must_be_resolved,childof.objrealname^);
  152. aktclass.set_parent(childof);
  153. end;
  154. end;
  155. procedure setinterfacemethodoptions;
  156. var
  157. i: longint;
  158. defs: TIndexArray;
  159. pd: tprocdef;
  160. begin
  161. include(aktclass.objectoptions,oo_has_virtual);
  162. defs:=aktclass.symtable.defindex;
  163. for i:=1 to defs.count do
  164. begin
  165. pd:=tprocdef(defs.search(i));
  166. if pd.deftype=procdef then
  167. begin
  168. pd.extnumber:=aktclass.lastvtableindex;
  169. inc(aktclass.lastvtableindex);
  170. include(pd.procoptions,po_virtualmethod);
  171. pd.forwarddef:=false;
  172. end;
  173. end;
  174. end;
  175. function readobjecttype : boolean;
  176. begin
  177. readobjecttype:=true;
  178. { distinguish classes and objects }
  179. case token of
  180. _OBJECT:
  181. begin
  182. classtype:=odt_object;
  183. consume(_OBJECT)
  184. end;
  185. _CPPCLASS:
  186. begin
  187. classtype:=odt_cppclass;
  188. consume(_CPPCLASS);
  189. end;
  190. _INTERFACE:
  191. begin
  192. { need extra check here since interface is a keyword
  193. in all pascal modes }
  194. if not(m_class in aktmodeswitches) then
  195. Message(parser_f_need_objfpc_or_delphi_mode);
  196. if aktinterfacetype=it_interfacecom then
  197. classtype:=odt_interfacecom
  198. else {it_interfacecorba}
  199. classtype:=odt_interfacecorba;
  200. consume(_INTERFACE);
  201. { forward declaration }
  202. if not(assigned(fd)) and (token=_SEMICOLON) then
  203. begin
  204. { also anonym objects aren't allow (o : object a : longint; end;) }
  205. if n='' then
  206. Message(parser_f_no_anonym_objects);
  207. aktclass:=tobjectdef.create(classtype,n,nil);
  208. if (cs_compilesystem in aktmoduleswitches) and
  209. (classtype=odt_interfacecom) and (upper(n)='IUNKNOWN') then
  210. interface_iunknown:=aktclass;
  211. include(aktclass.objectoptions,oo_is_forward);
  212. object_dec:=aktclass;
  213. typecanbeforward:=storetypecanbeforward;
  214. readobjecttype:=false;
  215. exit;
  216. end;
  217. end;
  218. _CLASS:
  219. begin
  220. classtype:=odt_class;
  221. consume(_CLASS);
  222. if not(assigned(fd)) and
  223. (token=_OF) and
  224. { Delphi only allows class of in type blocks.
  225. Note that when parsing the type of a variable declaration
  226. the blocktype is bt_type so the check for typecanbeforward
  227. is also necessary (PFV) }
  228. (((block_type=bt_type) and typecanbeforward) or
  229. not(m_delphi in aktmodeswitches)) then
  230. begin
  231. { a hack, but it's easy to handle }
  232. { class reference type }
  233. consume(_OF);
  234. single_type(tt,hs,typecanbeforward);
  235. { accept hp1, if is a forward def or a class }
  236. if (tt.def.deftype=forwarddef) or
  237. is_class(tt.def) then
  238. begin
  239. pcrd:=tclassrefdef.create(tt);
  240. object_dec:=pcrd;
  241. end
  242. else
  243. begin
  244. object_dec:=generrortype.def;
  245. Message1(type_e_class_type_expected,generrortype.def.typename);
  246. end;
  247. typecanbeforward:=storetypecanbeforward;
  248. readobjecttype:=false;
  249. exit;
  250. end
  251. { forward class }
  252. else if not(assigned(fd)) and (token=_SEMICOLON) then
  253. begin
  254. { also anonym objects aren't allow (o : object a : longint; end;) }
  255. if n='' then
  256. Message(parser_f_no_anonym_objects);
  257. aktclass:=tobjectdef.create(odt_class,n,nil);
  258. if (cs_compilesystem in aktmoduleswitches) and (upper(n)='TOBJECT') then
  259. class_tobject:=aktclass;
  260. aktclass.objecttype:=odt_class;
  261. include(aktclass.objectoptions,oo_is_forward);
  262. { all classes must have a vmt !! at offset zero }
  263. if not(oo_has_vmt in aktclass.objectoptions) then
  264. aktclass.insertvmt;
  265. object_dec:=aktclass;
  266. typecanbeforward:=storetypecanbeforward;
  267. readobjecttype:=false;
  268. exit;
  269. end;
  270. end;
  271. else
  272. begin
  273. classtype:=odt_class; { this is error but try to recover }
  274. consume(_OBJECT);
  275. end;
  276. end;
  277. end;
  278. procedure handleimplementedinterface(implintf : tobjectdef);
  279. begin
  280. if not is_interface(implintf) then
  281. begin
  282. Message1(type_e_interface_type_expected,implintf.typename);
  283. exit;
  284. end;
  285. if aktclass.implementedinterfaces.searchintf(implintf)<>-1 then
  286. Message1(sym_e_duplicate_id,implintf.name)
  287. else
  288. begin
  289. { allocate and prepare the GUID only if the class
  290. implements some interfaces.
  291. }
  292. if aktclass.implementedinterfaces.count = 0 then
  293. aktclass.prepareguid;
  294. aktclass.implementedinterfaces.addintf(implintf);
  295. end;
  296. end;
  297. procedure readimplementedinterfaces;
  298. var
  299. tt : ttype;
  300. begin
  301. while try_to_consume(_COMMA) do
  302. begin
  303. id_type(tt,pattern,false);
  304. if (tt.def.deftype<>objectdef) then
  305. begin
  306. Message1(type_e_interface_type_expected,tt.def.typename);
  307. continue;
  308. end;
  309. handleimplementedinterface(tobjectdef(tt.def));
  310. end;
  311. end;
  312. procedure readinterfaceiid;
  313. var
  314. p : tnode;
  315. valid : boolean;
  316. begin
  317. p:=comp_expr(true);
  318. if p.nodetype=stringconstn then
  319. begin
  320. stringdispose(aktclass.iidstr);
  321. aktclass.iidstr:=stringdup(strpas(tstringconstnode(p).value_str)); { or upper? }
  322. p.free;
  323. valid:=string2guid(aktclass.iidstr^,aktclass.iidguid^);
  324. if (classtype=odt_interfacecom) and not assigned(aktclass.iidguid) and not valid then
  325. Message(parser_e_improper_guid_syntax);
  326. end
  327. else
  328. begin
  329. p.free;
  330. Message(cg_e_illegal_expression);
  331. end;
  332. end;
  333. procedure readparentclasses;
  334. var
  335. hp : tobjectdef;
  336. begin
  337. hp:=nil;
  338. { reads the parent class }
  339. if try_to_consume(_LKLAMMER) then
  340. begin
  341. id_type(tt,pattern,false);
  342. childof:=tobjectdef(tt.def);
  343. if (not assigned(childof)) or
  344. (childof.deftype<>objectdef) then
  345. begin
  346. if assigned(childof) then
  347. Message1(type_e_class_type_expected,childof.typename);
  348. childof:=nil;
  349. aktclass:=tobjectdef.create(classtype,n,nil);
  350. end
  351. else
  352. begin
  353. { a mix of class, interfaces, objects and cppclasses
  354. isn't allowed }
  355. case classtype of
  356. odt_class:
  357. if not(is_class(childof)) then
  358. begin
  359. if is_interface(childof) then
  360. begin
  361. { we insert the interface after the child
  362. is set, see below
  363. }
  364. hp:=childof;
  365. childof:=class_tobject;
  366. end
  367. else
  368. Message(parser_e_mix_of_classes_and_objects);
  369. end;
  370. odt_interfacecorba,
  371. odt_interfacecom:
  372. if not(is_interface(childof)) then
  373. Message(parser_e_mix_of_classes_and_objects);
  374. odt_cppclass:
  375. if not(is_cppclass(childof)) then
  376. Message(parser_e_mix_of_classes_and_objects);
  377. odt_object:
  378. if not(is_object(childof)) then
  379. Message(parser_e_mix_of_classes_and_objects);
  380. end;
  381. { the forward of the child must be resolved to get
  382. correct field addresses }
  383. if assigned(fd) then
  384. begin
  385. if (oo_is_forward in childof.objectoptions) then
  386. Message1(parser_e_forward_declaration_must_be_resolved,childof.objrealname^);
  387. aktclass:=fd;
  388. { we must inherit several options !!
  389. this was missing !!
  390. all is now done in set_parent
  391. including symtable datasize setting PM }
  392. fd.set_parent(childof);
  393. end
  394. else
  395. aktclass:=tobjectdef.create(classtype,n,childof);
  396. if aktclass.objecttype=odt_class then
  397. begin
  398. if assigned(hp) then
  399. handleimplementedinterface(hp);
  400. readimplementedinterfaces;
  401. end;
  402. end;
  403. consume(_RKLAMMER);
  404. end
  405. { if no parent class, then a class get tobject as parent }
  406. else if classtype in [odt_class,odt_interfacecom] then
  407. setclassparent
  408. else
  409. aktclass:=tobjectdef.create(classtype,n,nil);
  410. { read GUID }
  411. if (classtype in [odt_interfacecom,odt_interfacecorba]) and
  412. try_to_consume(_LECKKLAMMER) then
  413. begin
  414. readinterfaceiid;
  415. consume(_RECKKLAMMER);
  416. end;
  417. end;
  418. procedure chkcpp(pd:tprocdef);
  419. begin
  420. if is_cppclass(pd._class) then
  421. begin
  422. pd.proccalloption:=pocall_cppdecl;
  423. pd.setmangledname(target_info.Cprefix+pd.cplusplusmangledname);
  424. end;
  425. end;
  426. var
  427. pd : tprocdef;
  428. begin
  429. old_object_option:=current_object_option;
  430. { forward is resolved }
  431. if assigned(fd) then
  432. exclude(fd.objectoptions,oo_is_forward);
  433. { objects and class types can't be declared local }
  434. if not(symtablestack.symtabletype in [globalsymtable,staticsymtable]) then
  435. Message(parser_e_no_local_objects);
  436. storetypecanbeforward:=typecanbeforward;
  437. { for tp7 don't allow forward types }
  438. if (m_tp7 in aktmodeswitches) then
  439. typecanbeforward:=false;
  440. if not(readobjecttype) then
  441. exit;
  442. { also anonym objects aren't allow (o : object a : longint; end;) }
  443. if n='' then
  444. Message(parser_f_no_anonym_objects);
  445. { read list of parent classes }
  446. readparentclasses;
  447. { default access is public }
  448. there_is_a_destructor:=false;
  449. current_object_option:=[sp_public];
  450. { set class flags and inherits published }
  451. setclassattributes;
  452. aktobjectdef:=aktclass;
  453. aktclass.symtable.next:=symtablestack;
  454. symtablestack:=aktclass.symtable;
  455. testcurobject:=1;
  456. curobjectname:=Upper(n);
  457. { short class declaration ? }
  458. if (classtype<>odt_class) or (token<>_SEMICOLON) then
  459. begin
  460. { Parse componenten }
  461. repeat
  462. case token of
  463. _ID :
  464. begin
  465. case idtoken of
  466. _PRIVATE :
  467. begin
  468. if is_interface(aktclass) then
  469. Message(parser_e_no_access_specifier_in_interfaces);
  470. consume(_PRIVATE);
  471. current_object_option:=[sp_private];
  472. include(aktclass.objectoptions,oo_has_private);
  473. end;
  474. _PROTECTED :
  475. begin
  476. if is_interface(aktclass) then
  477. Message(parser_e_no_access_specifier_in_interfaces);
  478. consume(_PROTECTED);
  479. current_object_option:=[sp_protected];
  480. include(aktclass.objectoptions,oo_has_protected);
  481. end;
  482. _PUBLIC :
  483. begin
  484. if is_interface(aktclass) then
  485. Message(parser_e_no_access_specifier_in_interfaces);
  486. consume(_PUBLIC);
  487. current_object_option:=[sp_public];
  488. end;
  489. _PUBLISHED :
  490. begin
  491. { we've to check for a pushlished section in non- }
  492. { publishable classes later, if a real declaration }
  493. { this is the way, delphi does it }
  494. if is_interface(aktclass) then
  495. Message(parser_e_no_access_specifier_in_interfaces);
  496. consume(_PUBLISHED);
  497. current_object_option:=[sp_published];
  498. end;
  499. else
  500. begin
  501. if is_interface(aktclass) then
  502. Message(parser_e_no_vars_in_interfaces);
  503. if (sp_published in current_object_option) and
  504. not(oo_can_have_published in aktclass.objectoptions) then
  505. Message(parser_e_cant_have_published);
  506. read_var_decs(false,true,false);
  507. end;
  508. end;
  509. end;
  510. _PROPERTY :
  511. begin
  512. property_dec;
  513. end;
  514. _PROCEDURE,
  515. _FUNCTION,
  516. _CLASS :
  517. begin
  518. if (sp_published in current_object_option) and
  519. not(oo_can_have_published in aktclass.objectoptions) then
  520. Message(parser_e_cant_have_published);
  521. oldparse_only:=parse_only;
  522. parse_only:=true;
  523. pd:=parse_proc_dec(aktclass);
  524. { this is for error recovery as well as forward }
  525. { interface mappings, i.e. mapping to a method }
  526. { which isn't declared yet }
  527. if assigned(pd) then
  528. begin
  529. parse_object_proc_directives(pd);
  530. handle_calling_convention(pd);
  531. calc_parast(pd);
  532. { add definition to procsym }
  533. proc_add_definition(pd);
  534. { add procdef options to objectdef options }
  535. if (po_msgint in pd.procoptions) then
  536. include(aktclass.objectoptions,oo_has_msgint);
  537. if (po_msgstr in pd.procoptions) then
  538. include(aktclass.objectoptions,oo_has_msgstr);
  539. if (po_virtualmethod in pd.procoptions) then
  540. include(aktclass.objectoptions,oo_has_virtual);
  541. chkcpp(pd);
  542. end;
  543. parse_only:=oldparse_only;
  544. end;
  545. _CONSTRUCTOR :
  546. begin
  547. if (sp_published in current_object_option) and
  548. not(oo_can_have_published in aktclass.objectoptions) then
  549. Message(parser_e_cant_have_published);
  550. if not(sp_public in current_object_option) then
  551. Message(parser_w_constructor_should_be_public);
  552. if is_interface(aktclass) then
  553. Message(parser_e_no_con_des_in_interfaces);
  554. oldparse_only:=parse_only;
  555. parse_only:=true;
  556. pd:=constructor_head;
  557. parse_object_proc_directives(pd);
  558. handle_calling_convention(pd);
  559. calc_parast(pd);
  560. { add definition to procsym }
  561. proc_add_definition(pd);
  562. { add procdef options to objectdef options }
  563. if (po_virtualmethod in pd.procoptions) then
  564. include(aktclass.objectoptions,oo_has_virtual);
  565. chkcpp(pd);
  566. parse_only:=oldparse_only;
  567. end;
  568. _DESTRUCTOR :
  569. begin
  570. if (sp_published in current_object_option) and
  571. not(oo_can_have_published in aktclass.objectoptions) then
  572. Message(parser_e_cant_have_published);
  573. if there_is_a_destructor then
  574. Message(parser_n_only_one_destructor);
  575. if is_interface(aktclass) then
  576. Message(parser_e_no_con_des_in_interfaces);
  577. if not(sp_public in current_object_option) then
  578. Message(parser_w_destructor_should_be_public);
  579. there_is_a_destructor:=true;
  580. oldparse_only:=parse_only;
  581. parse_only:=true;
  582. pd:=destructor_head;
  583. parse_object_proc_directives(pd);
  584. handle_calling_convention(pd);
  585. calc_parast(pd);
  586. { add definition to procsym }
  587. proc_add_definition(pd);
  588. { add procdef options to objectdef options }
  589. if (po_virtualmethod in pd.procoptions) then
  590. include(aktclass.objectoptions,oo_has_virtual);
  591. chkcpp(pd);
  592. parse_only:=oldparse_only;
  593. end;
  594. _END :
  595. begin
  596. consume(_END);
  597. break;
  598. end;
  599. else
  600. consume(_ID); { Give a ident expected message, like tp7 }
  601. end;
  602. until false;
  603. end;
  604. { generate vmt space if needed }
  605. if not(oo_has_vmt in aktclass.objectoptions) and
  606. (([oo_has_virtual,oo_has_constructor,oo_has_destructor]*aktclass.objectoptions<>[]) or
  607. (classtype in [odt_class])
  608. ) then
  609. aktclass.insertvmt;
  610. if is_interface(aktclass) then
  611. setinterfacemethodoptions;
  612. { reset }
  613. testcurobject:=0;
  614. curobjectname:='';
  615. typecanbeforward:=storetypecanbeforward;
  616. { restore old state }
  617. symtablestack:=symtablestack.next;
  618. aktobjectdef:=nil;
  619. current_object_option:=old_object_option;
  620. object_dec:=aktclass;
  621. end;
  622. end.
  623. {
  624. $Log$
  625. Revision 1.75 2003-12-10 16:37:01 peter
  626. * global property support for fpc modes
  627. Revision 1.74 2003/12/04 23:27:49 peter
  628. * missing handle_calling_convention()
  629. Revision 1.73 2003/11/10 18:06:25 florian
  630. + published single properties can have a default value now
  631. Revision 1.72 2003/10/30 16:23:13 peter
  632. * don't search for overloads in parents for constructors
  633. Revision 1.71 2003/10/22 15:22:33 peter
  634. * fixed unitsym-globalsymtable relation so the uses of a unit
  635. is counted correctly
  636. Revision 1.70 2003/10/21 18:16:13 peter
  637. * IncompatibleTypes() added that will include unit names when
  638. the typenames are the same
  639. Revision 1.69 2003/10/07 16:06:30 peter
  640. * tsymlist.def renamed to tsymlist.procdef
  641. * tsymlist.procdef is now only used to store the procdef
  642. Revision 1.68 2003/10/02 21:15:12 peter
  643. * support nil as default value
  644. * when no default property is allowed don't check default value
  645. Revision 1.67 2003/06/13 21:19:30 peter
  646. * current_procdef removed, use current_procinfo.procdef instead
  647. Revision 1.66 2003/05/23 14:27:35 peter
  648. * remove some unit dependencies
  649. * current_procinfo changes to store more info
  650. Revision 1.65 2003/05/09 17:47:02 peter
  651. * self moved to hidden parameter
  652. * removed hdisposen,hnewn,selfn
  653. Revision 1.64 2003/05/05 14:53:16 peter
  654. * vs_hidden replaced by is_hidden boolean
  655. Revision 1.63 2003/04/27 11:21:33 peter
  656. * aktprocdef renamed to current_procinfo.procdef
  657. * procinfo renamed to current_procinfo
  658. * procinfo will now be stored in current_module so it can be
  659. cleaned up properly
  660. * gen_main_procsym changed to create_main_proc and release_main_proc
  661. to also generate a tprocinfo structure
  662. * fixed unit implicit initfinal
  663. Revision 1.62 2003/04/27 07:29:50 peter
  664. * current_procinfo.procdef cleanup, current_procdef is now always nil when parsing
  665. a new procdef declaration
  666. * aktprocsym removed
  667. * lexlevel removed, use symtable.symtablelevel instead
  668. * implicit init/final code uses the normal genentry/genexit
  669. * funcret state checking updated for new funcret handling
  670. Revision 1.61 2003/04/26 00:32:37 peter
  671. * start search for overriden properties in the parent class
  672. Revision 1.60 2003/04/25 20:59:33 peter
  673. * removed funcretn,funcretsym, function result is now in varsym
  674. and aliases for result and function name are added using absolutesym
  675. * vs_hidden parameter for funcret passed in parameter
  676. * vs_hidden fixes
  677. * writenode changed to printnode and released from extdebug
  678. * -vp option added to generate a tree.log with the nodetree
  679. * nicer printnode for statements, callnode
  680. Revision 1.59 2003/04/10 17:57:52 peter
  681. * vs_hidden released
  682. Revision 1.58 2003/01/09 21:52:37 peter
  683. * merged some verbosity options.
  684. * V_LineInfo is a verbosity flag to include line info
  685. Revision 1.57 2002/11/25 17:43:21 peter
  686. * splitted defbase in defutil,symutil,defcmp
  687. * merged isconvertable and is_equal into compare_defs(_ext)
  688. * made operator search faster by walking the list only once
  689. Revision 1.56 2002/11/17 16:31:56 carl
  690. * memory optimization (3-4%) : cleanup of tai fields,
  691. cleanup of tdef and tsym fields.
  692. * make it work for m68k
  693. Revision 1.55 2002/10/05 12:43:25 carl
  694. * fixes for Delphi 6 compilation
  695. (warning : Some features do not work under Delphi)
  696. Revision 1.54 2002/10/02 18:20:20 peter
  697. * don't allow interface without m_class mode
  698. Revision 1.53 2002/09/27 21:13:28 carl
  699. * low-highval always checked if limit ober 2GB is reached (to avoid overflow)
  700. Revision 1.52 2002/09/16 14:11:13 peter
  701. * add argument to equal_paras() to support default values or not
  702. Revision 1.51 2002/09/09 17:34:15 peter
  703. * tdicationary.replace added to replace and item in a dictionary. This
  704. is only allowed for the same name
  705. * varsyms are inserted in symtable before the types are parsed. This
  706. fixes the long standing "var longint : longint" bug
  707. - consume_idlist and idstringlist removed. The loops are inserted
  708. at the callers place and uses the symtable for duplicate id checking
  709. Revision 1.50 2002/09/03 16:26:26 daniel
  710. * Make Tprocdef.defs protected
  711. Revision 1.49 2002/08/17 09:23:38 florian
  712. * first part of procinfo rewrite
  713. Revision 1.48 2002/08/09 07:33:02 florian
  714. * a couple of interface related fixes
  715. Revision 1.47 2002/07/20 11:57:55 florian
  716. * types.pas renamed to defbase.pas because D6 contains a types
  717. unit so this would conflicts if D6 programms are compiled
  718. + Willamette/SSE2 instructions to assembler added
  719. Revision 1.46 2002/07/01 16:23:53 peter
  720. * cg64 patch
  721. * basics for currency
  722. * asnode updates for class and interface (not finished)
  723. Revision 1.45 2002/05/18 13:34:12 peter
  724. * readded missing revisions
  725. Revision 1.44 2002/05/16 19:46:42 carl
  726. + defines.inc -> fpcdefs.inc to avoid conflicts if compiling by hand
  727. + try to fix temp allocation (still in ifdef)
  728. + generic constructor calls
  729. + start of tassembler / tmodulebase class cleanup
  730. Revision 1.42 2002/05/12 16:53:08 peter
  731. * moved entry and exitcode to ncgutil and cgobj
  732. * foreach gets extra argument for passing local data to the
  733. iterator function
  734. * -CR checks also class typecasts at runtime by changing them
  735. into as
  736. * fixed compiler to cycle with the -CR option
  737. * fixed stabs with elf writer, finally the global variables can
  738. be watched
  739. * removed a lot of routines from cga unit and replaced them by
  740. calls to cgobj
  741. * u32bit-s32bit updates for and,or,xor nodes. When one element is
  742. u32bit then the other is typecasted also to u32bit without giving
  743. a rangecheck warning/error.
  744. * fixed pascal calling method with reversing also the high tree in
  745. the parast, detected by tcalcst3 test
  746. Revision 1.41 2002/04/21 19:02:04 peter
  747. * removed newn and disposen nodes, the code is now directly
  748. inlined from pexpr
  749. * -an option that will write the secondpass nodes to the .s file, this
  750. requires EXTDEBUG define to actually write the info
  751. * fixed various internal errors and crashes due recent code changes
  752. Revision 1.40 2002/04/19 15:46:02 peter
  753. * mangledname rewrite, tprocdef.mangledname is now created dynamicly
  754. in most cases and not written to the ppu
  755. * add mangeledname_prefix() routine to generate the prefix of
  756. manglednames depending on the current procedure, object and module
  757. * removed static procprefix since the mangledname is now build only
  758. on demand from tprocdef.mangledname
  759. Revision 1.39 2002/04/04 19:06:00 peter
  760. * removed unused units
  761. * use tlocation.size in cg.a_*loc*() routines
  762. Revision 1.38 2002/01/25 17:38:19 peter
  763. * fixed default value for properties with index values
  764. Revision 1.37 2002/01/24 18:25:48 peter
  765. * implicit result variable generation for assembler routines
  766. * removed m_tp modeswitch, use m_tp7 or not(m_fpc) instead
  767. Revision 1.36 2002/01/06 12:08:15 peter
  768. * removed uauto from orddef, use new range_to_basetype generating
  769. the correct ordinal type for a range
  770. }