pdecobj.pas 28 KB

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