浏览代码

* new introduded problem with classes fix, the parent class wasn't set
correct, if the class was defined forward before

florian 27 年之前
父节点
当前提交
eadcc6ad1a
共有 7 个文件被更改,包括 65 次插入17 次删除
  1. 6 3
      compiler/cg386flw.pas
  2. 6 2
      compiler/compiler.pas
  3. 26 3
      compiler/hcodegen.pas
  4. 7 2
      compiler/pass_2.pas
  5. 6 2
      compiler/pdecl.pas
  6. 7 2
      compiler/symdef.inc
  7. 7 3
      compiler/tpexcept.pas

+ 6 - 3
compiler/cg386flw.pas

@@ -77,8 +77,7 @@ implementation
          aktbreaklabel:=lbreak;
          cleartempgen;
          if assigned(p^.right) then
-          secondpass(p^.right);
-
+           secondpass(p^.right);
          emitl(A_LABEL,lcont);
          otlabel:=truelabel;
          oflabel:=falselabel;
@@ -738,7 +737,11 @@ do_jmp:
 end.
 {
   $Log$
-  Revision 1.20  1998-10-06 17:16:42  pierre
+  Revision 1.21  1998-10-26 22:58:16  florian
+    * new introduded problem with classes fix, the parent class wasn't set
+      correct, if the class was defined forward before
+
+  Revision 1.20  1998/10/06 17:16:42  pierre
     * some memory leaks fixed (thanks to Peter for heaptrc !)
 
   Revision 1.19  1998/09/28 12:13:53  peter

+ 6 - 2
compiler/compiler.pas

@@ -104,7 +104,7 @@ var
 
 procedure RecoverStop;{$ifndef FPC}far;{$endif}
 begin
-  if assigned(recoverpospointer) then
+  if recoverpospointer<>nil then
     LongJmp(recoverpospointer^,1)
   else
     Halt(1);
@@ -242,7 +242,11 @@ end;
 end.
 {
   $Log$
-  Revision 1.13  1998-10-26 17:15:17  pierre
+  Revision 1.14  1998-10-26 22:58:17  florian
+    * new introduded problem with classes fix, the parent class wasn't set
+      correct, if the class was defined forward before
+
+  Revision 1.13  1998/10/26 17:15:17  pierre
     + added two level of longjump to
       allow clean freeing of used memory on errors
 

+ 26 - 3
compiler/hcodegen.pas

@@ -25,7 +25,7 @@ unit hcodegen;
   interface
 
     uses
-      verbose,aasm,tree,symtable
+      verbose,aasm,tree,symtable,cobjects
 {$ifdef i386}
       ,i386
 {$endif}
@@ -93,6 +93,15 @@ unit hcodegen;
           { local data is used for smartlink }
        end;
 
+       { some kind of temp. types needs to be destructed }
+       { for example ansistring, this is done using this }
+       { list                                            }
+       ttemptodestroy = object(tlinkedlist_item)
+          typ : tdef;
+          address : treference;
+          constructor init(const a : treference;t : tdef);
+       end;
+
     var
        { info about the current sub routine }
        procinfo : tprocinfo;
@@ -158,10 +167,13 @@ unit hcodegen;
     const
        make_const_global : boolean = false;
 
+    var
+       temptoremove : tlinkedlist;
+
 implementation
 
      uses
-        systems,comphook,cobjects,globals,files,strings;
+        systems,comphook,globals,files,strings;
 
 {*****************************************************************************
             override the message calls to set codegenerror
@@ -379,12 +391,23 @@ implementation
            end;
       end;
 
+    constructor ttemptodestroy.init(const a : treference;t : tdef);
+
+      begin
+         inherited init;
+         address:=a;
+         typ:=t;
+      end;
 
 end.
 
 {
   $Log$
-  Revision 1.18  1998-10-06 17:16:50  pierre
+  Revision 1.19  1998-10-26 22:58:18  florian
+    * new introduded problem with classes fix, the parent class wasn't set
+      correct, if the class was defined forward before
+
+  Revision 1.18  1998/10/06 17:16:50  pierre
     * some memory leaks fixed (thanks to Peter for heaptrc !)
 
   Revision 1.17  1998/09/17 09:42:37  peter

+ 7 - 2
compiler/pass_2.pas

@@ -67,11 +67,12 @@ implementation
        secondpassproc = procedure(var p : ptree);
 
     procedure secondnothing(var p : ptree);
+
       begin
       end;
 
-
     procedure seconderror(var p : ptree);
+
       begin
          p^.error:=true;
          codegenerror:=true;
@@ -485,7 +486,11 @@ implementation
 end.
 {
   $Log$
-  Revision 1.6  1998-09-23 09:58:52  peter
+  Revision 1.7  1998-10-26 22:58:19  florian
+    * new introduded problem with classes fix, the parent class wasn't set
+      correct, if the class was defined forward before
+
+  Revision 1.6  1998/09/23 09:58:52  peter
     * first working array of const things
 
   Revision 1.5  1998/09/21 10:01:06  peter

+ 6 - 2
compiler/pdecl.pas

@@ -1121,7 +1121,7 @@ unit pdecl;
                         class_tobject:=aktclass;
                      end
                    else
-                     aktclass:=new(pobjectdef,init(n,class_tobject));
+                     aktclass:=new(pobjectdef,init(n,nil));
                    aktclass^.options:=aktclass^.options or oo_is_class or oo_isforward;
                    object_dec:=aktclass;
                    exit;
@@ -2082,7 +2082,11 @@ unit pdecl;
 end.
 {
   $Log$
-  Revision 1.76  1998-10-25 23:31:18  peter
+  Revision 1.77  1998-10-26 22:58:20  florian
+    * new introduded problem with classes fix, the parent class wasn't set
+      correct, if the class was defined forward before
+
+  Revision 1.76  1998/10/25 23:31:18  peter
     * procvar parsing updated just like psub.pas routine
 
   Revision 1.75  1998/10/21 08:39:59  florian

+ 7 - 2
compiler/symdef.inc

@@ -2573,6 +2573,7 @@
         tdef.init;
         deftype:=objectdef;
         options:=0;
+        childof:=nil;
         publicsyms:=new(psymtable,init(objectsymtable));
         publicsyms^.name := stringdup(n);
         { create space for vmt !! }
@@ -2613,7 +2614,7 @@
                publicsyms^.datasize:=publicsyms^.datasize-target_os.size_of_pointer;
              { if parent has a vmt field then
                the offset is the same for the child PM }
-             if ((c^.options and oo_hasvmt)<>0) then
+             if ((c^.options and oo_hasvmt)<>0) or isclass then
                begin
                   vmt_offset:=c^.vmt_offset;
                   options:=options or oo_hasvmt;
@@ -3199,7 +3200,11 @@
 
 {
   $Log$
-  Revision 1.65  1998-10-26 14:19:28  pierre
+  Revision 1.66  1998-10-26 22:58:22  florian
+    * new introduded problem with classes fix, the parent class wasn't set
+      correct, if the class was defined forward before
+
+  Revision 1.65  1998/10/26 14:19:28  pierre
     + added options -lS and -lT for source and target os output
       (to have a easier way to test OS_SOURCE abd OS_TARGET in makefiles)
     * several problems with rtti data

+ 7 - 3
compiler/tpexcept.pas

@@ -49,8 +49,8 @@ type
   procedure longjmp(const rec : jmp_buf;return_value : longint);
 {$endif TP}
 
-  var
-     recoverpospointer : pjmp_buf;
+  const
+     recoverpospointer : pjmp_buf = nil;
 
 implementation
 
@@ -335,7 +335,11 @@ implementation
 end.
 {
   $Log$
-  Revision 1.3  1998-10-26 17:15:19  pierre
+  Revision 1.4  1998-10-26 22:58:24  florian
+    * new introduded problem with classes fix, the parent class wasn't set
+      correct, if the class was defined forward before
+
+  Revision 1.3  1998/10/26 17:15:19  pierre
     + added two level of longjump to
       allow clean freeing of used memory on errors