From cadf4cc024a8ed7bf16b1044229d6dd1c4c7b13e Mon Sep 17 00:00:00 2001 From: pierre Date: Tue, 14 Mar 2000 16:37:25 +0000 Subject: [PATCH] * destructor can have args in TP mode only (bug825 and 839) --- compiler/pstatmnt.pas | 38 +++++++++++++++++++++++++------------- compiler/ptype.pas | 8 ++++++-- 2 files changed, 31 insertions(+), 15 deletions(-) diff --git a/compiler/pstatmnt.pas b/compiler/pstatmnt.pas index fb83c44403..979cedb093 100644 --- a/compiler/pstatmnt.pas +++ b/compiler/pstatmnt.pas @@ -920,17 +920,26 @@ unit pstatmnt; end else begin - p2:=genmethodcallnode(pprocsym(sym),srsymtable,p2); - { support dispose(p,done()); } - if try_to_consume(_LKLAMMER) then - begin - if not try_to_consume(_RKLAMMER) then - begin - Message(parser_e_no_paras_for_destructor); - consume_all_until(_RKLAMMER); - consume(_RKLAMMER); - end; - end; + if (m_tp in aktmodeswitches) then + begin + { Constructors can take parameters.} + p2^.resulttype:=ppointerdef(pd)^.pointertype.def; + do_member_read(false,sym,p2,pd,again); + end + else + begin + p2:=genmethodcallnode(pprocsym(sym),srsymtable,p2); + { support dispose(p,done()); } + if try_to_consume(_LKLAMMER) then + begin + if not try_to_consume(_RKLAMMER) then + begin + Message(parser_e_no_paras_for_destructor); + consume_all_until(_RKLAMMER); + consume(_RKLAMMER); + end; + end; + end; end; { we need the real called method } @@ -1349,7 +1358,10 @@ unit pstatmnt; end. { $Log$ - Revision 1.123 2000-02-29 23:59:47 pierre + Revision 1.124 2000-03-14 16:37:25 pierre + * destructor can have args in TP mode only (bug825 and 839) + + Revision 1.123 2000/02/29 23:59:47 pierre Use $GOTO ON Revision 1.122 2000/02/09 13:22:59 peter @@ -1427,4 +1439,4 @@ end. Revision 1.102 1999/09/16 23:05:54 florian * m68k compiler is again compilable (only gas writer, no assembler reader) -} +} \ No newline at end of file diff --git a/compiler/ptype.pas b/compiler/ptype.pas index c874869859..222636812f 100644 --- a/compiler/ptype.pas +++ b/compiler/ptype.pas @@ -707,7 +707,8 @@ uses {$endif} consume(_SEMICOLON); if not(aktprocsym^.definition^.para^.empty) then - Message(parser_e_no_paras_for_destructor); + if not (m_tp in aktmodeswitches) then + Message(parser_e_no_paras_for_destructor); { no return value } aktprocsym^.definition^.rettype.def:=voiddef; end; @@ -1548,7 +1549,10 @@ uses end. { $Log$ - Revision 1.21 2000-03-11 21:11:24 daniel + Revision 1.22 2000-03-14 16:37:26 pierre + * destructor can have args in TP mode only (bug825 and 839) + + Revision 1.21 2000/03/11 21:11:24 daniel * Ported hcgdata to new symtable. * Alignment code changed as suggested by Peter + Usage of my is operator replacement, is_object