Browse Source

* destructor can have args in TP mode only (bug825 and 839)

pierre 25 years ago
parent
commit
cadf4cc024
2 changed files with 31 additions and 15 deletions
  1. 25 13
      compiler/pstatmnt.pas
  2. 6 2
      compiler/ptype.pas

+ 25 - 13
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)
 
-}
+}

+ 6 - 2
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