Browse Source

* overload directive checking for methods is now done
when the vmt is generated

peter 21 years ago
parent
commit
4f913922fa
2 changed files with 25 additions and 5 deletions
  1. 17 1
      compiler/nobj.pas
  2. 8 4
      compiler/pdecsub.pas

+ 17 - 1
compiler/nobj.pas

@@ -623,6 +623,18 @@ implementation
                                { compare only if the definition is not hidden }
                                if not procdefcoll^.hidden then
                                 begin
+                                  { check that all methods have overload directive } 
+                                  if not(m_fpc in aktmodeswitches) and
+                                     (_class=pd._class) and
+                                     (procdefcoll^.data._class=pd._class) and
+                                     ((po_overload in pd.procoptions)<>(po_overload in procdefcoll^.data.procoptions)) then
+                                    begin
+                                      MessagePos1(pd.fileinfo,parser_e_no_overload_for_all_procs,pd.procsym.realname);
+                                      { recover }
+                                      include(procdefcoll^.data.procoptions,po_overload);
+                                      include(pd.procoptions,po_overload);
+                                    end;
+                                    
                                   { check if one of the two methods has virtual }
                                   if (po_virtualmethod in procdefcoll^.data.procoptions) or
                                      (po_virtualmethod in pd.procoptions) then
@@ -1367,7 +1379,11 @@ initialization
 end.
 {
   $Log$
-  Revision 1.60  2004-02-08 23:30:43  florian
+  Revision 1.61  2004-02-13 15:41:24  peter
+    * overload directive checking for methods is now done
+      when the vmt is generated
+
+  Revision 1.60  2004/02/08 23:30:43  florian
     * web bug 2942 fixed: reintroduce isn't necessary in methods of child classes of course
 
   Revision 1.59  2004/01/28 20:30:18  peter

+ 8 - 4
compiler/pdecsub.pas

@@ -2099,10 +2099,10 @@ const
               if ((po_overload in pd.procoptions) or
                   (po_overload in hd.procoptions)) then
                begin
-                 { check if all procs have overloading, but not if the proc was
-                   already declared forward or abstract, then the check is already done }
+                 { check if all procs have overloading, but not if the proc is a method or
+                   already declared forward, then the check is already done }
                  if not(hd.hasforward or
-                        (po_abstractmethod in hd.procoptions) or
+                        assigned(pd._class) or
                         (pd.forwarddef<>hd.forwarddef) or
                         ((po_overload in pd.procoptions) and
                          (po_overload in hd.procoptions))) then
@@ -2139,7 +2139,11 @@ const
 end.
 {
   $Log$
-  Revision 1.161  2004-02-05 14:13:53  daniel
+  Revision 1.162  2004-02-13 15:41:24  peter
+    * overload directive checking for methods is now done
+      when the vmt is generated
+
+  Revision 1.161  2004/02/05 14:13:53  daniel
     *  Tvarsym.highvarsym removed
 
   Revision 1.160  2004/02/04 22:54:57  daniel