瀏覽代碼

* fixed firstpass when det_resulttype returns an error

peter 24 年之前
父節點
當前提交
7edaf1332f
共有 1 個文件被更改,包括 34 次插入11 次删除
  1. 34 11
      compiler/pass_1.pas

+ 34 - 11
compiler/pass_1.pas

@@ -137,27 +137,47 @@ implementation
               { determine the resulttype if not done }
               { determine the resulttype if not done }
               if (p.resulttype.def=nil) then
               if (p.resulttype.def=nil) then
                begin
                begin
+                 aktfilepos:=p.fileinfo;
+                 aktlocalswitches:=p.localswitches;
                  hp:=p.det_resulttype;
                  hp:=p.det_resulttype;
                  { should the node be replaced? }
                  { should the node be replaced? }
                  if assigned(hp) then
                  if assigned(hp) then
                   begin
                   begin
                      p.free;
                      p.free;
+                     { run resulttypepass }
+                     resulttypepass(hp);
+                     { switch to new node }
                      p:=hp;
                      p:=hp;
                   end;
                   end;
+                 if codegenerror then
+                  begin
+                    include(p.flags,nf_error);
+                    { default to errortype if no type is set yet }
+                    if p.resulttype.def=nil then
+                     p.resulttype:=generrortype;
+                  end;
+                 aktlocalswitches:=oldlocalswitches;
+                 aktfilepos:=oldpos;
+                 codegenerror:=codegenerror or oldcodegenerror;
                end;
                end;
               { first pass }
               { first pass }
-              hp:=p.pass_1;
-              { should the node be replaced? }
-              if assigned(hp) then
-                begin
-                   p.free;
-                   p:=hp;
-                end;
+              if not(nf_error in p.flags) then
+               begin
+                 aktfilepos:=p.fileinfo;
+                 aktlocalswitches:=p.localswitches;
+                 hp:=p.pass_1;
+                 { should the node be replaced? }
+                 if assigned(hp) then
+                  begin
+                    p.free;
+                    p:=hp;
+                  end;
+                 if codegenerror then
+                  include(p.flags,nf_error);
+               end;
+              codegenerror:=codegenerror or oldcodegenerror;
               aktlocalswitches:=oldlocalswitches;
               aktlocalswitches:=oldlocalswitches;
               aktfilepos:=oldpos;
               aktfilepos:=oldpos;
-              if codegenerror then
-                include(p.flags,nf_error);
-              codegenerror:=codegenerror or oldcodegenerror;
            end
            end
          else
          else
            codegenerror:=true;
            codegenerror:=true;
@@ -178,7 +198,10 @@ implementation
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.17  2001-09-02 21:18:28  peter
+  Revision 1.18  2001-10-20 17:23:43  peter
+    * fixed firstpass when det_resulttype returns an error
+
+  Revision 1.17  2001/09/02 21:18:28  peter
     * split constsym.value in valueord,valueordptr,valueptr. The valueordptr
     * split constsym.value in valueord,valueordptr,valueptr. The valueordptr
       is used for holding target platform pointer values. As those can be
       is used for holding target platform pointer values. As those can be
       bigger than the source platform.
       bigger than the source platform.