pdecobj.pas 29 KB

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