Bläddra i källkod

* problems when calling class methods fixed

florian 27 år sedan
förälder
incheckning
16af381be8
2 ändrade filer med 17 tillägg och 7 borttagningar
  1. 8 4
      compiler/cg386cal.pas
  2. 9 3
      compiler/pdecl.pas

+ 8 - 4
compiler/cg386cal.pas

@@ -902,8 +902,9 @@ implementation
                                               end;
                                             else
                                               begin
-                                                 if (p^.methodpointer^.resulttype^.deftype=objectdef) and
-                                                   pobjectdef(p^.methodpointer^.resulttype)^.isclass then
+                                                 if (p^.methodpointer^.resulttype^.deftype=classrefdef) or
+                                                    ((p^.methodpointer^.resulttype^.deftype=objectdef) and
+                                                   pobjectdef(p^.methodpointer^.resulttype)^.isclass) then
                                                    exprasmlist^.concat(new(pai386,op_ref_reg(A_MOV,S_L,
                                                      newreference(p^.methodpointer^.location.reference),R_ESI)))
                                                  else
@@ -918,7 +919,7 @@ implementation
                                       But that's wrong, if we call a class method via self
                                     }
                                     if ((p^.procdefinition^.options and poclassmethod)<>0)
-                                       and not(p^.methodpointer^.treetype=selfn) then
+                                       and not(p^.methodpointer^.resulttype^.deftype=classrefdef) then
                                       begin
                                          { class method needs current VMT }
                                          new(r);
@@ -1435,7 +1436,10 @@ implementation
 end.
 {
   $Log$
-  Revision 1.28  1998-09-24 14:27:37  peter
+  Revision 1.29  1998-09-25 00:04:00  florian
+    * problems when calling class methods fixed
+
+  Revision 1.28  1998/09/24 14:27:37  peter
     * some better support for openarray
 
   Revision 1.27  1998/09/24 09:02:13  peter

+ 9 - 3
compiler/pdecl.pas

@@ -1177,10 +1177,13 @@ unit pdecl;
                           aktclass^.publicsyms^.datasize-4+childof^.publicsyms^.datasize;
                      end
                    else
-                     aktclass:=new(pobjectdef,init(n,childof));
+                     begin
+                        aktclass:=new(pobjectdef,init(n,childof));
+                     end;
                 end;
            end
-         else aktclass:=new(pobjectdef,init(n,nil));
+         else
+           aktclass:=new(pobjectdef,init(n,nil));
 
          { set the class attribute }
          if is_a_class then
@@ -2056,7 +2059,10 @@ unit pdecl;
 end.
 {
   $Log$
-  Revision 1.57  1998-09-24 23:49:09  peter
+  Revision 1.58  1998-09-25 00:04:01  florian
+    * problems when calling class methods fixed
+
+  Revision 1.57  1998/09/24 23:49:09  peter
     + aktmodeswitches
 
   Revision 1.56  1998/09/23 15:39:09  pierre