瀏覽代碼

* some stuff for procedures of object added
* bug with overridden virtual constructors fixed (reported by Italo Gomes)

florian 27 年之前
父節點
當前提交
df1edc9bc0
共有 6 個文件被更改,包括 82 次插入19 次删除
  1. 26 5
      compiler/cg386ld.pas
  2. 6 1
      compiler/files.pas
  3. 23 6
      compiler/pexpr.pas
  4. 6 2
      compiler/tccnv.pas
  5. 10 3
      compiler/tree.pas
  6. 11 2
      compiler/types.pas

+ 26 - 5
compiler/cg386ld.pas

@@ -233,10 +233,27 @@ implementation
                  end;
               procsym:
                  begin
-                    {!!!!! Be aware, work on virtual methods too }
-                    stringdispose(p^.location.reference.symbol);
-                    p^.location.reference.symbol:=stringdup(pprocsym(p^.symtableentry)^.definition^.mangledname);
-                    maybe_concat_external(p^.symtable,p^.symtableentry^.mangledname);
+                    if p^.is_methodpointer then
+                      begin
+                         secondpass(p^.left);
+                         stringdispose(p^.location.reference.symbol);
+                         { virtual method ? }
+                         if (pprocsym(p^.symtableentry)^.definition^.options and povirtualmethod)<>0 then
+                           begin
+                           end
+                         else
+                           begin
+                              p^.location.reference.symbol:=stringdup(pprocsym(p^.symtableentry)^.definition^.mangledname);
+                              maybe_concat_external(p^.symtable,p^.symtableentry^.mangledname);
+                           end;
+                      end
+                    else
+                      begin
+                         {!!!!! Be aware, work on virtual methods too }
+                         stringdispose(p^.location.reference.symbol);
+                         p^.location.reference.symbol:=stringdup(pprocsym(p^.symtableentry)^.definition^.mangledname);
+                         maybe_concat_external(p^.symtable,p^.symtableentry^.mangledname);
+                      end;
                  end;
               typedconstsym :
                  begin
@@ -692,7 +709,11 @@ implementation
 end.
 {
   $Log$
-  Revision 1.35  1998-11-30 09:43:04  pierre
+  Revision 1.36  1998-12-04 10:18:06  florian
+    * some stuff for procedures of object added
+    * bug with overridden virtual constructors fixed (reported by Italo Gomes)
+
+  Revision 1.35  1998/11/30 09:43:04  pierre
     * some range check bugs fixed (still not working !)
     + added DLL writing support for win32 (also accepts variables)
     + TempAnsi for code that could be used for Temporary ansi strings

+ 6 - 1
compiler/files.pas

@@ -911,6 +911,7 @@ unit files;
          staticlibfilename:=nil;
          sharedlibfilename:=nil;
          exefilename:=nil;
+         outpath:=nil;
          { Dos has the famous 8.3 limit :( }
 {$ifdef tp}
          asmprefix:=stringdup(FixFileName('as'));
@@ -1053,7 +1054,11 @@ unit files;
 end.
 {
   $Log$
-  Revision 1.77  1998-12-02 16:23:37  jonas
+  Revision 1.78  1998-12-04 10:18:07  florian
+    * some stuff for procedures of object added
+    * bug with overridden virtual constructors fixed (reported by Italo Gomes)
+
+  Revision 1.77  1998/12/02 16:23:37  jonas
     * changed "if longintvar in set" to case or "if () or () .." statements
     * tree.pas: changed inlinenumber (and associated constructor/vars) to a byte
 

+ 23 - 6
compiler/pexpr.pas

@@ -1827,12 +1827,25 @@ unit pexpr;
                                  getprocvardef:=pprocvardef(p1^.resulttype);
                               end;
                             p2:=sub_expr(opcompare,true);
-                            if getprocvar and (p2^.treetype=calln) and
-                               (proc_to_procvar_equal(getprocvardef,pprocsym(p2^.symtableentry)^.definition)) then
+                            if getprocvar and (p2^.treetype=calln) then
                               begin
-                                 p2^.treetype:=loadn;
-                                 p2^.resulttype:=pprocsym(p2^.symtableprocentry)^.definition;
-                                 p2^.symtableentry:=p2^.symtableprocentry;
+                                 if ((getprocvardef^.options and pomethodpointer)<>0) then
+                                   begin
+                                      if (p2^.methodpointer^.resulttype^.deftype=objectdef) and
+                                         (proc_to_procvar_equal(getprocvardef,pprocsym(p2^.symtableentry)^.definition)) then
+                                        begin
+                                           p2^.treetype:=loadn;
+                                           p2^.left:=p2^.methodpointer;
+                                           p2^.resulttype:=pprocsym(p2^.symtableprocentry)^.definition;
+                                           p2^.symtableentry:=p2^.symtableprocentry;
+                                        end;
+                                   end
+                                 else if (proc_to_procvar_equal(getprocvardef,pprocsym(p2^.symtableentry)^.definition)) then
+                                   begin
+                                      p2^.treetype:=loadn;
+                                      p2^.resulttype:=pprocsym(p2^.symtableprocentry)^.definition;
+                                      p2^.symtableentry:=p2^.symtableprocentry;
+                                   end;
                               end;
                             getprocvar:=false;
                             p1:=gennode(assignn,p1,p2);
@@ -1914,7 +1927,11 @@ unit pexpr;
 end.
 {
   $Log$
-  Revision 1.76  1998-11-27 14:50:40  peter
+  Revision 1.77  1998-12-04 10:18:09  florian
+    * some stuff for procedures of object added
+    * bug with overridden virtual constructors fixed (reported by Italo Gomes)
+
+  Revision 1.76  1998/11/27 14:50:40  peter
     + open strings, $P switch support
 
   Revision 1.75  1998/11/25 19:12:51  pierre

+ 6 - 2
compiler/tccnv.pas

@@ -777,7 +777,7 @@ implementation
                           firstconvert[p^.convtyp](p);
                           exit;
                        end;
-                     { normal tc_equal-Konvertierung durchf�hren }
+                     { do common tc_equal cast }
                      p^.convtyp:=tc_equal;
                      { wenn Aufz„hltyp nach Ordinal konvertiert werden soll }
                      { dann Aufz„hltyp=s32bit                               }
@@ -955,7 +955,11 @@ implementation
 end.
 {
   $Log$
-  Revision 1.10  1998-11-29 12:40:24  peter
+  Revision 1.11  1998-12-04 10:18:12  florian
+    * some stuff for procedures of object added
+    * bug with overridden virtual constructors fixed (reported by Italo Gomes)
+
+  Revision 1.10  1998/11/29 12:40:24  peter
     * newcnv -> not oldcnv
 
   Revision 1.9  1998/11/26 13:10:43  peter

+ 10 - 3
compiler/tree.pas

@@ -234,7 +234,7 @@ unit tree;
              callparan : (is_colon_para : boolean;exact_match_found : boolean);
              assignn : (assigntyp : tassigntyp;concat_string : boolean);
              loadn : (symtableentry : psym;symtable : psymtable;
-                      is_absolute,is_first : boolean);
+                      is_absolute,is_first,is_methodpointer : boolean);
              calln : (symtableprocentry : psym;
                       symtableproc : psymtable;procdefinition : pprocdef;
                       methodpointer : ptree;
@@ -919,7 +919,10 @@ unit tree;
          p^.symtableentry:=v;
          p^.symtable:=st;
          p^.is_first := False;
-         p^.disposetyp:=dt_nothing;
+         p^.is_methodpointer:=false;
+         { method pointer load nodes can use the left subtree }
+         p^.disposetyp:=dt_left;
+         p^.left:=nil;
          genloadnode:=p;
       end;
 
@@ -1652,7 +1655,11 @@ unit tree;
 end.
 {
   $Log$
-  Revision 1.56  1998-12-02 16:23:32  jonas
+  Revision 1.57  1998-12-04 10:18:13  florian
+    * some stuff for procedures of object added
+    * bug with overridden virtual constructors fixed (reported by Italo Gomes)
+
+  Revision 1.56  1998/12/02 16:23:32  jonas
     * changed "if longintvar in set" to case or "if () or () .." statements
     * tree.pas: changed inlinenumber (and associated constructor/vars) to a byte
 

+ 11 - 2
compiler/types.pas

@@ -883,7 +883,12 @@ unit types;
                                          end;
 
                                        { error, if the return types aren't equal }
-                                       if not(is_equal(procdefcoll^.data^.retdef,hp^.retdef)) then
+                                       if not(is_equal(procdefcoll^.data^.retdef,hp^.retdef)) and
+                                         not((procdefcoll^.data^.retdef^.deftype=objectdef) and
+                                           (hp^.retdef^.deftype=objectdef) and
+                                           (pobjectdef(procdefcoll^.data^.retdef)^.isclass) and
+                                           (pobjectdef(hp^.retdef)^.isclass) and
+                                           (pobjectdef(hp^.retdef)^.isrelated(pobjectdef(procdefcoll^.data^.retdef)))) then
                                          Message1(parser_e_overloaded_methodes_not_same_ret,_c^.name^+'.'+_name);
 
 
@@ -1032,7 +1037,11 @@ unit types;
 end.
 {
   $Log$
-  Revision 1.39  1998-11-27 14:50:55  peter
+  Revision 1.40  1998-12-04 10:18:14  florian
+    * some stuff for procedures of object added
+    * bug with overridden virtual constructors fixed (reported by Italo Gomes)
+
+  Revision 1.39  1998/11/27 14:50:55  peter
     + open strings, $P switch support
 
   Revision 1.38  1998/11/18 15:44:24  peter