pdecobj.pas 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763
  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,
  30. node,nld,nmem,ncon,ncnv,ncal,
  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. parse_proc_head(aktclass,potype_constructor,pd);
  57. if not assigned(pd) then
  58. begin
  59. consume(_SEMICOLON);
  60. exit;
  61. end;
  62. if (cs_constructor_name in aktglobalswitches) and
  63. (pd.procsym.name<>'INIT') then
  64. Message(parser_e_constructorname_must_be_init);
  65. consume(_SEMICOLON);
  66. include(aktclass.objectoptions,oo_has_constructor);
  67. { Set return type, class constructors return the
  68. created instance, object constructors return boolean }
  69. if is_class(pd._class) then
  70. pd.rettype.setdef(pd._class)
  71. else
  72. pd.rettype:=booltype;
  73. constructor_head:=pd;
  74. end;
  75. procedure property_dec;
  76. var
  77. p : tpropertysym;
  78. begin
  79. { check for a class }
  80. if not((is_class_or_interface(aktclass)) or
  81. ((m_delphi in aktmodeswitches) and (is_object(aktclass)))) then
  82. Message(parser_e_syntax_error);
  83. consume(_PROPERTY);
  84. p:=read_property_dec(aktclass);
  85. consume(_SEMICOLON);
  86. if try_to_consume(_DEFAULT) then
  87. begin
  88. if oo_has_default_property in aktclass.objectoptions then
  89. message(parser_e_only_one_default_property);
  90. include(aktclass.objectoptions,oo_has_default_property);
  91. include(p.propoptions,ppo_defaultproperty);
  92. if not(ppo_hasparameters in p.propoptions) then
  93. message(parser_e_property_need_paras);
  94. consume(_SEMICOLON);
  95. end;
  96. { hint directives, these can be separated by semicolons here,
  97. that needs to be handled here with a loop (PFV) }
  98. while try_consume_hintdirective(p.symoptions) do
  99. Consume(_SEMICOLON);
  100. end;
  101. function destructor_head:tprocdef;
  102. var
  103. pd : tprocdef;
  104. begin
  105. consume(_DESTRUCTOR);
  106. parse_proc_head(aktclass,potype_destructor,pd);
  107. if not assigned(pd) then
  108. begin
  109. consume(_SEMICOLON);
  110. exit;
  111. end;
  112. if (cs_constructor_name in aktglobalswitches) and
  113. (pd.procsym.name<>'DONE') then
  114. Message(parser_e_destructorname_must_be_done);
  115. if not(pd.maxparacount=0) and
  116. (m_fpc in aktmodeswitches) then
  117. Message(parser_e_no_paras_for_destructor);
  118. consume(_SEMICOLON);
  119. include(aktclass.objectoptions,oo_has_destructor);
  120. { no return value }
  121. pd.rettype:=voidtype;
  122. destructor_head:=pd;
  123. end;
  124. var
  125. hs : string;
  126. pcrd : tclassrefdef;
  127. tt : ttype;
  128. old_object_option : tsymoptions;
  129. oldparse_only : boolean;
  130. storetypecanbeforward : boolean;
  131. procedure setclassattributes;
  132. begin
  133. { publishable }
  134. if classtype in [odt_interfacecom,odt_class] then
  135. begin
  136. aktclass.objecttype:=classtype;
  137. if (cs_generate_rtti in aktlocalswitches) or
  138. (assigned(aktclass.childof) and
  139. (oo_can_have_published in aktclass.childof.objectoptions)) then
  140. begin
  141. include(aktclass.objectoptions,oo_can_have_published);
  142. { in "publishable" classes the default access type is published }
  143. current_object_option:=[sp_published];
  144. end;
  145. end;
  146. end;
  147. procedure setclassparent;
  148. begin
  149. if assigned(fd) then
  150. aktclass:=fd
  151. else
  152. aktclass:=tobjectdef.create(classtype,n,nil);
  153. { is the current class tobject? }
  154. { so you could define your own tobject }
  155. if (cs_compilesystem in aktmoduleswitches) and (classtype=odt_class) and (upper(n)='TOBJECT') then
  156. class_tobject:=aktclass
  157. else if (cs_compilesystem in aktmoduleswitches) and (classtype=odt_interfacecom) and (upper(n)='IUNKNOWN') then
  158. interface_iunknown:=aktclass
  159. else
  160. begin
  161. case classtype of
  162. odt_class:
  163. childof:=class_tobject;
  164. odt_interfacecom:
  165. childof:=interface_iunknown;
  166. end;
  167. if (oo_is_forward in childof.objectoptions) then
  168. Message1(parser_e_forward_declaration_must_be_resolved,childof.objrealname^);
  169. aktclass.set_parent(childof);
  170. end;
  171. end;
  172. procedure setinterfacemethodoptions;
  173. var
  174. i: longint;
  175. defs: TIndexArray;
  176. pd: tprocdef;
  177. begin
  178. include(aktclass.objectoptions,oo_has_virtual);
  179. defs:=aktclass.symtable.defindex;
  180. for i:=1 to defs.count do
  181. begin
  182. pd:=tprocdef(defs.search(i));
  183. if pd.deftype=procdef then
  184. begin
  185. pd.extnumber:=aktclass.lastvtableindex;
  186. inc(aktclass.lastvtableindex);
  187. include(pd.procoptions,po_virtualmethod);
  188. pd.forwarddef:=false;
  189. end;
  190. end;
  191. end;
  192. function readobjecttype : boolean;
  193. begin
  194. readobjecttype:=true;
  195. { distinguish classes and objects }
  196. case token of
  197. _OBJECT:
  198. begin
  199. classtype:=odt_object;
  200. consume(_OBJECT)
  201. end;
  202. _CPPCLASS:
  203. begin
  204. classtype:=odt_cppclass;
  205. consume(_CPPCLASS);
  206. end;
  207. _INTERFACE:
  208. begin
  209. { need extra check here since interface is a keyword
  210. in all pascal modes }
  211. if not(m_class in aktmodeswitches) then
  212. Message(parser_f_need_objfpc_or_delphi_mode);
  213. if aktinterfacetype=it_interfacecom then
  214. classtype:=odt_interfacecom
  215. else {it_interfacecorba}
  216. classtype:=odt_interfacecorba;
  217. consume(_INTERFACE);
  218. { forward declaration }
  219. if not(assigned(fd)) and (token=_SEMICOLON) then
  220. begin
  221. { also anonym objects aren't allow (o : object a : longint; end;) }
  222. if n='' then
  223. Message(parser_f_no_anonym_objects);
  224. aktclass:=tobjectdef.create(classtype,n,nil);
  225. if (cs_compilesystem in aktmoduleswitches) and
  226. (classtype=odt_interfacecom) and (upper(n)='IUNKNOWN') then
  227. interface_iunknown:=aktclass;
  228. include(aktclass.objectoptions,oo_is_forward);
  229. object_dec:=aktclass;
  230. typecanbeforward:=storetypecanbeforward;
  231. readobjecttype:=false;
  232. exit;
  233. end;
  234. end;
  235. _CLASS:
  236. begin
  237. classtype:=odt_class;
  238. consume(_CLASS);
  239. if not(assigned(fd)) and
  240. (token=_OF) and
  241. { Delphi only allows class of in type blocks.
  242. Note that when parsing the type of a variable declaration
  243. the blocktype is bt_type so the check for typecanbeforward
  244. is also necessary (PFV) }
  245. (((block_type=bt_type) and typecanbeforward) or
  246. not(m_delphi in aktmodeswitches)) then
  247. begin
  248. { a hack, but it's easy to handle }
  249. { class reference type }
  250. consume(_OF);
  251. single_type(tt,hs,typecanbeforward);
  252. { accept hp1, if is a forward def or a class }
  253. if (tt.def.deftype=forwarddef) or
  254. is_class(tt.def) then
  255. begin
  256. pcrd:=tclassrefdef.create(tt);
  257. object_dec:=pcrd;
  258. end
  259. else
  260. begin
  261. object_dec:=generrortype.def;
  262. Message1(type_e_class_type_expected,generrortype.def.typename);
  263. end;
  264. typecanbeforward:=storetypecanbeforward;
  265. readobjecttype:=false;
  266. exit;
  267. end
  268. { forward class }
  269. else if not(assigned(fd)) and (token=_SEMICOLON) then
  270. begin
  271. { also anonym objects aren't allow (o : object a : longint; end;) }
  272. if n='' then
  273. Message(parser_f_no_anonym_objects);
  274. aktclass:=tobjectdef.create(odt_class,n,nil);
  275. if (cs_compilesystem in aktmoduleswitches) and (upper(n)='TOBJECT') then
  276. class_tobject:=aktclass;
  277. aktclass.objecttype:=odt_class;
  278. include(aktclass.objectoptions,oo_is_forward);
  279. { all classes must have a vmt !! at offset zero }
  280. if not(oo_has_vmt in aktclass.objectoptions) then
  281. aktclass.insertvmt;
  282. object_dec:=aktclass;
  283. typecanbeforward:=storetypecanbeforward;
  284. readobjecttype:=false;
  285. exit;
  286. end;
  287. end;
  288. else
  289. begin
  290. classtype:=odt_class; { this is error but try to recover }
  291. consume(_OBJECT);
  292. end;
  293. end;
  294. end;
  295. procedure handleimplementedinterface(implintf : tobjectdef);
  296. begin
  297. if not is_interface(implintf) then
  298. begin
  299. Message1(type_e_interface_type_expected,implintf.typename);
  300. exit;
  301. end;
  302. if aktclass.implementedinterfaces.searchintf(implintf)<>-1 then
  303. Message1(sym_e_duplicate_id,implintf.name)
  304. else
  305. begin
  306. { allocate and prepare the GUID only if the class
  307. implements some interfaces.
  308. }
  309. if aktclass.implementedinterfaces.count = 0 then
  310. aktclass.prepareguid;
  311. aktclass.implementedinterfaces.addintf(implintf);
  312. end;
  313. end;
  314. procedure readimplementedinterfaces;
  315. var
  316. tt : ttype;
  317. begin
  318. while try_to_consume(_COMMA) do
  319. begin
  320. id_type(tt,pattern,false);
  321. if (tt.def.deftype<>objectdef) then
  322. begin
  323. Message1(type_e_interface_type_expected,tt.def.typename);
  324. continue;
  325. end;
  326. handleimplementedinterface(tobjectdef(tt.def));
  327. end;
  328. end;
  329. procedure readinterfaceiid;
  330. var
  331. p : tnode;
  332. valid : boolean;
  333. begin
  334. p:=comp_expr(true);
  335. if p.nodetype=stringconstn then
  336. begin
  337. stringdispose(aktclass.iidstr);
  338. aktclass.iidstr:=stringdup(strpas(tstringconstnode(p).value_str)); { or upper? }
  339. p.free;
  340. valid:=string2guid(aktclass.iidstr^,aktclass.iidguid^);
  341. if (classtype=odt_interfacecom) and not assigned(aktclass.iidguid) and not valid then
  342. Message(parser_e_improper_guid_syntax);
  343. end
  344. else
  345. begin
  346. p.free;
  347. Message(parser_e_illegal_expression);
  348. end;
  349. end;
  350. procedure readparentclasses;
  351. var
  352. hp : tobjectdef;
  353. begin
  354. hp:=nil;
  355. { reads the parent class }
  356. if try_to_consume(_LKLAMMER) then
  357. begin
  358. id_type(tt,pattern,false);
  359. childof:=tobjectdef(tt.def);
  360. if (not assigned(childof)) or
  361. (childof.deftype<>objectdef) then
  362. begin
  363. if assigned(childof) then
  364. Message1(type_e_class_type_expected,childof.typename);
  365. childof:=nil;
  366. aktclass:=tobjectdef.create(classtype,n,nil);
  367. end
  368. else
  369. begin
  370. { a mix of class, interfaces, objects and cppclasses
  371. isn't allowed }
  372. case classtype of
  373. odt_class:
  374. if not(is_class(childof)) then
  375. begin
  376. if is_interface(childof) then
  377. begin
  378. { we insert the interface after the child
  379. is set, see below
  380. }
  381. hp:=childof;
  382. childof:=class_tobject;
  383. end
  384. else
  385. Message(parser_e_mix_of_classes_and_objects);
  386. end;
  387. odt_interfacecorba,
  388. odt_interfacecom:
  389. if not(is_interface(childof)) then
  390. Message(parser_e_mix_of_classes_and_objects);
  391. odt_cppclass:
  392. if not(is_cppclass(childof)) then
  393. Message(parser_e_mix_of_classes_and_objects);
  394. odt_object:
  395. if not(is_object(childof)) then
  396. Message(parser_e_mix_of_classes_and_objects);
  397. end;
  398. { the forward of the child must be resolved to get
  399. correct field addresses }
  400. if assigned(fd) then
  401. begin
  402. if (oo_is_forward in childof.objectoptions) then
  403. Message1(parser_e_forward_declaration_must_be_resolved,childof.objrealname^);
  404. aktclass:=fd;
  405. { we must inherit several options !!
  406. this was missing !!
  407. all is now done in set_parent
  408. including symtable datasize setting PM }
  409. fd.set_parent(childof);
  410. end
  411. else
  412. aktclass:=tobjectdef.create(classtype,n,childof);
  413. if aktclass.objecttype=odt_class then
  414. begin
  415. if assigned(hp) then
  416. handleimplementedinterface(hp);
  417. readimplementedinterfaces;
  418. end;
  419. end;
  420. consume(_RKLAMMER);
  421. end
  422. { if no parent class, then a class get tobject as parent }
  423. else if classtype in [odt_class,odt_interfacecom] then
  424. setclassparent
  425. else
  426. aktclass:=tobjectdef.create(classtype,n,nil);
  427. { read GUID }
  428. if (classtype in [odt_interfacecom,odt_interfacecorba]) and
  429. try_to_consume(_LECKKLAMMER) then
  430. begin
  431. readinterfaceiid;
  432. consume(_RECKKLAMMER);
  433. end;
  434. end;
  435. procedure chkcpp(pd:tprocdef);
  436. begin
  437. if is_cppclass(pd._class) then
  438. begin
  439. pd.proccalloption:=pocall_cppdecl;
  440. pd.setmangledname(target_info.Cprefix+pd.cplusplusmangledname);
  441. end;
  442. end;
  443. var
  444. pd : tprocdef;
  445. dummysymoptions : tsymoptions;
  446. begin
  447. old_object_option:=current_object_option;
  448. { forward is resolved }
  449. if assigned(fd) then
  450. exclude(fd.objectoptions,oo_is_forward);
  451. { objects and class types can't be declared local }
  452. if not(symtablestack.symtabletype in [globalsymtable,staticsymtable]) then
  453. Message(parser_e_no_local_objects);
  454. storetypecanbeforward:=typecanbeforward;
  455. { for tp7 don't allow forward types }
  456. if (m_tp7 in aktmodeswitches) then
  457. typecanbeforward:=false;
  458. if not(readobjecttype) then
  459. exit;
  460. { also anonym objects aren't allow (o : object a : longint; end;) }
  461. if n='' then
  462. Message(parser_f_no_anonym_objects);
  463. { read list of parent classes }
  464. readparentclasses;
  465. { default access is public }
  466. there_is_a_destructor:=false;
  467. current_object_option:=[sp_public];
  468. { set class flags and inherits published }
  469. setclassattributes;
  470. aktobjectdef:=aktclass;
  471. aktclass.symtable.next:=symtablestack;
  472. symtablestack:=aktclass.symtable;
  473. testcurobject:=1;
  474. curobjectname:=Upper(n);
  475. { short class declaration ? }
  476. if (classtype<>odt_class) or (token<>_SEMICOLON) then
  477. begin
  478. { Parse componenten }
  479. repeat
  480. case token of
  481. _ID :
  482. begin
  483. case idtoken of
  484. _PRIVATE :
  485. begin
  486. if is_interface(aktclass) then
  487. Message(parser_e_no_access_specifier_in_interfaces);
  488. consume(_PRIVATE);
  489. current_object_option:=[sp_private];
  490. include(aktclass.objectoptions,oo_has_private);
  491. end;
  492. _PROTECTED :
  493. begin
  494. if is_interface(aktclass) then
  495. Message(parser_e_no_access_specifier_in_interfaces);
  496. consume(_PROTECTED);
  497. current_object_option:=[sp_protected];
  498. include(aktclass.objectoptions,oo_has_protected);
  499. end;
  500. _PUBLIC :
  501. begin
  502. if is_interface(aktclass) then
  503. Message(parser_e_no_access_specifier_in_interfaces);
  504. consume(_PUBLIC);
  505. current_object_option:=[sp_public];
  506. end;
  507. _PUBLISHED :
  508. begin
  509. { we've to check for a pushlished section in non- }
  510. { publishable classes later, if a real declaration }
  511. { this is the way, delphi does it }
  512. if is_interface(aktclass) then
  513. Message(parser_e_no_access_specifier_in_interfaces);
  514. consume(_PUBLISHED);
  515. current_object_option:=[sp_published];
  516. end;
  517. else
  518. begin
  519. if is_interface(aktclass) then
  520. Message(parser_e_no_vars_in_interfaces);
  521. if (sp_published in current_object_option) and
  522. not(oo_can_have_published in aktclass.objectoptions) then
  523. Message(parser_e_cant_have_published);
  524. read_var_decs(false,true,false);
  525. end;
  526. end;
  527. end;
  528. _PROPERTY :
  529. begin
  530. property_dec;
  531. end;
  532. _PROCEDURE,
  533. _FUNCTION,
  534. _CLASS :
  535. begin
  536. if (sp_published in current_object_option) and
  537. not(oo_can_have_published in aktclass.objectoptions) then
  538. Message(parser_e_cant_have_published);
  539. oldparse_only:=parse_only;
  540. parse_only:=true;
  541. pd:=parse_proc_dec(aktclass);
  542. { this is for error recovery as well as forward }
  543. { interface mappings, i.e. mapping to a method }
  544. { which isn't declared yet }
  545. if assigned(pd) then
  546. begin
  547. parse_object_proc_directives(pd);
  548. handle_calling_convention(pd);
  549. calc_parast(pd);
  550. { add definition to procsym }
  551. proc_add_definition(pd);
  552. { add procdef options to objectdef options }
  553. if (po_msgint in pd.procoptions) then
  554. include(aktclass.objectoptions,oo_has_msgint);
  555. if (po_msgstr in pd.procoptions) then
  556. include(aktclass.objectoptions,oo_has_msgstr);
  557. if (po_virtualmethod in pd.procoptions) then
  558. include(aktclass.objectoptions,oo_has_virtual);
  559. chkcpp(pd);
  560. end;
  561. { Support hint directives }
  562. dummysymoptions:=[];
  563. while try_consume_hintdirective(dummysymoptions) do
  564. Consume(_SEMICOLON);
  565. if assigned(pd) then
  566. pd.symoptions:=pd.symoptions+dummysymoptions;
  567. parse_only:=oldparse_only;
  568. end;
  569. _CONSTRUCTOR :
  570. begin
  571. if (sp_published in current_object_option) and
  572. not(oo_can_have_published in aktclass.objectoptions) then
  573. Message(parser_e_cant_have_published);
  574. if not(sp_public in current_object_option) and
  575. not(sp_published in current_object_option) then
  576. Message(parser_w_constructor_should_be_public);
  577. if is_interface(aktclass) then
  578. Message(parser_e_no_con_des_in_interfaces);
  579. oldparse_only:=parse_only;
  580. parse_only:=true;
  581. pd:=constructor_head;
  582. parse_object_proc_directives(pd);
  583. handle_calling_convention(pd);
  584. calc_parast(pd);
  585. { add definition to procsym }
  586. proc_add_definition(pd);
  587. { add procdef options to objectdef options }
  588. if (po_virtualmethod in pd.procoptions) then
  589. include(aktclass.objectoptions,oo_has_virtual);
  590. chkcpp(pd);
  591. { Support hint directives }
  592. dummysymoptions:=[];
  593. while try_consume_hintdirective(dummysymoptions) do
  594. Consume(_SEMICOLON);
  595. if assigned(pd) then
  596. pd.symoptions:=pd.symoptions+dummysymoptions;
  597. parse_only:=oldparse_only;
  598. end;
  599. _DESTRUCTOR :
  600. begin
  601. if (sp_published in current_object_option) and
  602. not(oo_can_have_published in aktclass.objectoptions) then
  603. Message(parser_e_cant_have_published);
  604. if there_is_a_destructor then
  605. Message(parser_n_only_one_destructor);
  606. if is_interface(aktclass) then
  607. Message(parser_e_no_con_des_in_interfaces);
  608. if not(sp_public in current_object_option) then
  609. Message(parser_w_destructor_should_be_public);
  610. there_is_a_destructor:=true;
  611. oldparse_only:=parse_only;
  612. parse_only:=true;
  613. pd:=destructor_head;
  614. parse_object_proc_directives(pd);
  615. handle_calling_convention(pd);
  616. calc_parast(pd);
  617. { add definition to procsym }
  618. proc_add_definition(pd);
  619. { add procdef options to objectdef options }
  620. if (po_virtualmethod in pd.procoptions) then
  621. include(aktclass.objectoptions,oo_has_virtual);
  622. chkcpp(pd);
  623. { Support hint directives }
  624. dummysymoptions:=[];
  625. while try_consume_hintdirective(dummysymoptions) do
  626. Consume(_SEMICOLON);
  627. if assigned(pd) then
  628. pd.symoptions:=pd.symoptions+dummysymoptions;
  629. parse_only:=oldparse_only;
  630. end;
  631. _END :
  632. begin
  633. consume(_END);
  634. break;
  635. end;
  636. else
  637. consume(_ID); { Give a ident expected message, like tp7 }
  638. end;
  639. until false;
  640. end;
  641. { generate vmt space if needed }
  642. if not(oo_has_vmt in aktclass.objectoptions) and
  643. (([oo_has_virtual,oo_has_constructor,oo_has_destructor]*aktclass.objectoptions<>[]) or
  644. (classtype in [odt_class])
  645. ) then
  646. aktclass.insertvmt;
  647. if is_interface(aktclass) then
  648. setinterfacemethodoptions;
  649. { reset }
  650. testcurobject:=0;
  651. curobjectname:='';
  652. typecanbeforward:=storetypecanbeforward;
  653. { restore old state }
  654. symtablestack:=symtablestack.next;
  655. aktobjectdef:=nil;
  656. current_object_option:=old_object_option;
  657. object_dec:=aktclass;
  658. end;
  659. end.
  660. {
  661. $Log$
  662. Revision 1.81 2004-08-29 11:28:10 peter
  663. allow published for constructors
  664. Revision 1.80 2004/08/25 15:57:04 peter
  665. * allow only 1 default property
  666. Revision 1.79 2004/08/22 11:23:45 peter
  667. * support hint directives in object declarations
  668. Revision 1.78 2004/06/20 08:55:30 florian
  669. * logs truncated
  670. Revision 1.77 2004/06/16 20:07:09 florian
  671. * dwarf branch merged
  672. Revision 1.76.2.1 2004/04/28 19:55:52 peter
  673. * new warning for ordinal-pointer when size is different
  674. * fixed some cg_e_ messages to the correct section type_e_ or parser_e_
  675. Revision 1.76 2004/02/26 16:13:25 peter
  676. * fix crash when method is not declared in object declaration
  677. * fix parsing of mapped interface functions
  678. }