Browse Source

* readd to many remove p. for tcallnode.is_equal()

peter 25 years ago
parent
commit
182552a82b
1 changed files with 42 additions and 38 deletions
  1. 42 38
      compiler/ncal.pas

+ 42 - 38
compiler/ncal.pas

@@ -534,7 +534,8 @@ interface
          pd : pprocdef;
          pd : pprocdef;
          oldcallprocsym : pprocsym;
          oldcallprocsym : pprocsym;
          def_from,def_to,conv_to : pdef;
          def_from,def_to,conv_to : pdef;
-         hpt,pt,inlinecode : tnode;
+         hpt,inlinecode : tnode;
+         pt : tcallparanode;
          exactmatch,inlined : boolean;
          exactmatch,inlined : boolean;
          paralength,lastpara : longint;
          paralength,lastpara : longint;
          lastparatype : pdef;
          lastparatype : pdef;
@@ -555,7 +556,7 @@ interface
 
 
       { check if the resulttype from tree p is equal with def, needed
       { check if the resulttype from tree p is equal with def, needed
         for stringconstn and formaldef }
         for stringconstn and formaldef }
-      function is_equal(p:tnode;def:pdef) : boolean;
+      function is_equal(p:tcallparanode;def:pdef) : boolean;
 
 
         begin
         begin
            { safety check }
            { safety check }
@@ -571,11 +572,11 @@ interface
              the specified value matches the range }
              the specified value matches the range }
              or
              or
              (
              (
-              (left.nodetype=ordconstn) and
+              (tbinarynode(p).left.nodetype=ordconstn) and
               is_integer(p.resulttype) and
               is_integer(p.resulttype) and
               is_integer(def) and
               is_integer(def) and
-              (tordconstnode(left).value>=porddef(def)^.low) and
-              (tordconstnode(left).value<=porddef(def)^.high)
+              (tordconstnode(p.left).value>=porddef(def)^.low) and
+              (tordconstnode(p.left).value<=porddef(def)^.high)
              )
              )
            { to support ansi/long/wide strings in a proper way }
            { to support ansi/long/wide strings in a proper way }
            { string and string[10] are assumed as equal }
            { string and string[10] are assumed as equal }
@@ -587,12 +588,12 @@ interface
              )
              )
              or
              or
              (
              (
-              (left.nodetype=stringconstn) and
+              (p.left.nodetype=stringconstn) and
               (is_ansistring(p.resulttype) and is_pchar(def))
               (is_ansistring(p.resulttype) and is_pchar(def))
              )
              )
              or
              or
              (
              (
-              (left.nodetype=ordconstn) and
+              (p.left.nodetype=ordconstn) and
               (is_char(p.resulttype) and (is_shortstring(def) or is_ansistring(def)))
               (is_char(p.resulttype) and (is_shortstring(def) or is_ansistring(def)))
              )
              )
            { set can also be a not yet converted array constructor }
            { set can also be a not yet converted array constructor }
@@ -605,8 +606,8 @@ interface
              or
              or
              (
              (
               (m_tp_procvar in aktmodeswitches) and
               (m_tp_procvar in aktmodeswitches) and
-              (def^.deftype=procvardef) and (left.nodetype=calln) and
-              (proc_to_procvar_equal(pprocdef(tcallnode(left).procdefinition),pprocvardef(def)))
+              (def^.deftype=procvardef) and (p.left.nodetype=calln) and
+              (proc_to_procvar_equal(pprocdef(tcallnode(p.left).procdefinition),pprocvardef(def)))
              )
              )
              ;
              ;
         end;
         end;
@@ -679,10 +680,10 @@ interface
 
 
               { check the parameters }
               { check the parameters }
               pdc:=pparaitem(pprocvardef(right.resulttype)^.para^.first);
               pdc:=pparaitem(pprocvardef(right.resulttype)^.para^.first);
-              pt:=left;
+              pt:=tcallparanode(left);
               while assigned(pdc) and assigned(pt) do
               while assigned(pdc) and assigned(pt) do
                 begin
                 begin
-                   pt:=tcallparanode(pt).right;
+                   pt:=tcallparanode(pt.right);
                    pdc:=pparaitem(pdc^.next);
                    pdc:=pparaitem(pdc^.next);
                 end;
                 end;
               if assigned(pt) or assigned(pdc) then
               if assigned(pt) or assigned(pdc) then
@@ -745,12 +746,12 @@ interface
                   end;
                   end;
 {$endif TEST_PROCSYMS}
 {$endif TEST_PROCSYMS}
                    { determine length of parameter list }
                    { determine length of parameter list }
-                   pt:=left;
+                   pt:=tcallparanode(left);
                    paralength:=0;
                    paralength:=0;
                    while assigned(pt) do
                    while assigned(pt) do
                      begin
                      begin
                         inc(paralength);
                         inc(paralength);
-                        pt:=tcallparanode(pt).right;
+                        pt:=tcallparanode(pt.right);
                      end;
                      end;
 
 
                    { link all procedures which have the same # of parameters }
                    { link all procedures which have the same # of parameters }
@@ -804,7 +805,7 @@ interface
                     end;
                     end;
 
 
                 { now we can compare parameter after parameter }
                 { now we can compare parameter after parameter }
-                   pt:=left;
+                   pt:=tcallparanode(left);
                    { we start with the last parameter }
                    { we start with the last parameter }
                    lastpara:=paralength+1;
                    lastpara:=paralength+1;
                    lastparatype:=nil;
                    lastparatype:=nil;
@@ -828,7 +829,7 @@ interface
                                begin
                                begin
                                   if hp^.nextpara^.paratype.def=pt.resulttype then
                                   if hp^.nextpara^.paratype.def=pt.resulttype then
                                     begin
                                     begin
-                                       include(tcallparanode(pt).callparaflags,cpf_exact_match_found);
+                                       include(pt.callparaflags,cpf_exact_match_found);
                                        hp^.nextpara^.argconvtyp:=act_exact;
                                        hp^.nextpara^.argconvtyp:=act_exact;
                                     end
                                     end
                                   else
                                   else
@@ -839,10 +840,10 @@ interface
                                begin
                                begin
                                  hp^.nextpara^.argconvtyp:=act_convertable;
                                  hp^.nextpara^.argconvtyp:=act_convertable;
                                  hp^.nextpara^.convertlevel:=isconvertable(pt.resulttype,hp^.nextpara^.paratype.def,
                                  hp^.nextpara^.convertlevel:=isconvertable(pt.resulttype,hp^.nextpara^.paratype.def,
-                                     hcvt,tcallparanode(pt).left.nodetype,false);
+                                     hcvt,pt.left.nodetype,false);
                                  case hp^.nextpara^.convertlevel of
                                  case hp^.nextpara^.convertlevel of
-                                  1 : include(tcallparanode(pt).callparaflags,cpf_convlevel1found);
-                                  2 : include(tcallparanode(pt).callparaflags,cpf_convlevel2found);
+                                  1 : include(pt.callparaflags,cpf_convlevel1found);
+                                  2 : include(pt.callparaflags,cpf_convlevel2found);
                                  end;
                                  end;
                                end;
                                end;
 
 
@@ -901,7 +902,7 @@ interface
                           end;
                           end;
                         { load next parameter or quit loop if no procs left }
                         { load next parameter or quit loop if no procs left }
                         if assigned(procs) then
                         if assigned(procs) then
-                          pt:=tcallparanode(pt).right
+                          pt:=tcallparanode(pt.right)
                         else
                         else
                           break;
                           break;
                      end;
                      end;
@@ -942,7 +943,7 @@ interface
                             hp^.nextpara:=hp^.firstpara;
                             hp^.nextpara:=hp^.firstpara;
                             hp:=hp^.next;
                             hp:=hp^.next;
                           end;
                           end;
-                        pt:=left;
+                        pt:=tcallparanode(left);
                         while assigned(pt) do
                         while assigned(pt) do
                           begin
                           begin
                              { matches a parameter of one procedure exact ? }
                              { matches a parameter of one procedure exact ? }
@@ -1010,7 +1011,7 @@ interface
                                   hp^.nextpara:=pparaitem(hp^.nextpara^.next);
                                   hp^.nextpara:=pparaitem(hp^.nextpara^.next);
                                   hp:=hp^.next;
                                   hp:=hp^.next;
                                end;
                                end;
-                             pt:=tcallparanode(pt).right;
+                             pt:=tcallparanode(pt.right);
                           end;
                           end;
                      end;
                      end;
 
 
@@ -1026,10 +1027,10 @@ interface
                            hp:=hp^.next;
                            hp:=hp^.next;
                          end;
                          end;
 
 
-                        pt:=left;
+                        pt:=tcallparanode(left);
                         while assigned(pt) do
                         while assigned(pt) do
                           begin
                           begin
-                             if cpf_exact_match_found in tcallparanode(pt).callparaflags then
+                             if cpf_exact_match_found in pt.callparaflags then
                                begin
                                begin
                                  hp:=procs;
                                  hp:=procs;
                                  procs:=nil;
                                  procs:=nil;
@@ -1054,7 +1055,7 @@ interface
                                   hp^.nextpara:=pparaitem(hp^.nextpara^.next);
                                   hp^.nextpara:=pparaitem(hp^.nextpara^.next);
                                   hp:=hp^.next;
                                   hp:=hp^.next;
                                end;
                                end;
-                             pt:=tcallparanode(pt).right;
+                             pt:=tcallparanode(pt.right);
                           end;
                           end;
                      end;
                      end;
 
 
@@ -1072,11 +1073,11 @@ interface
                            hp:=hp^.next;
                            hp:=hp^.next;
                          end;
                          end;
 
 
-                        pt:=left;
+                        pt:=tcallparanode(left);
                         while assigned(pt) do
                         while assigned(pt) do
                           begin
                           begin
                             bestord:=nil;
                             bestord:=nil;
-                            if (tcallparanode(pt).left.nodetype=ordconstn) and
+                            if (pt.left.nodetype=ordconstn) and
                                is_integer(pt.resulttype) then
                                is_integer(pt.resulttype) then
                              begin
                              begin
                                hp:=procs;
                                hp:=procs;
@@ -1123,7 +1124,7 @@ interface
                                hp^.nextpara:=pparaitem(hp^.nextpara^.next);
                                hp^.nextpara:=pparaitem(hp^.nextpara^.next);
                                hp:=hp^.next;
                                hp:=hp^.next;
                              end;
                              end;
-                            pt:=tcallparanode(pt).right;
+                            pt:=tcallparanode(pt.right);
                           end;
                           end;
                      end;
                      end;
 
 
@@ -1142,11 +1143,11 @@ interface
                            hp:=hp^.next;
                            hp:=hp^.next;
                          end;
                          end;
 
 
-                        pt:=left;
+                        pt:=tcallparanode(left);
                         while assigned(pt) do
                         while assigned(pt) do
                           begin
                           begin
-                             if (cpf_convlevel1found in tcallparanode(pt).callparaflags) and
-                               (cpf_convlevel2found in tcallparanode(pt).callparaflags) then
+                             if (cpf_convlevel1found in pt.callparaflags) and
+                               (cpf_convlevel2found in pt.callparaflags) then
                                begin
                                begin
                                  hp:=procs;
                                  hp:=procs;
                                  procs:=nil;
                                  procs:=nil;
@@ -1172,7 +1173,7 @@ interface
                                   hp^.nextpara:=pparaitem(hp^.nextpara^.next);
                                   hp^.nextpara:=pparaitem(hp^.nextpara^.next);
                                   hp:=hp^.next;
                                   hp:=hp^.next;
                                end;
                                end;
-                             pt:=tcallparanode(pt).right;
+                             pt:=tcallparanode(pt.right);
                           end;
                           end;
                      end;
                      end;
 
 
@@ -1233,11 +1234,11 @@ interface
                      begin
                      begin
                      { settextbuf needs two args }
                      { settextbuf needs two args }
                        if assigned(tcallparanode(left).right) then
                        if assigned(tcallparanode(left).right) then
-                         pt:=geninlinenode(pprocdef(procdefinition)^.extnumber,is_const,left)
+                        hpt:=geninlinenode(pprocdef(procdefinition)^.extnumber,is_const,left)
                        else
                        else
                          begin
                          begin
-                           pt:=geninlinenode(pprocdef(procdefinition)^.extnumber,is_const,
-                             tcallparanode(left).left);
+                           hpt:=geninlinenode(pprocdef(procdefinition)^.extnumber,is_const,
+                                              tcallparanode(left).left);
                            tcallparanode(left).left:=nil;
                            tcallparanode(left).left:=nil;
                            left.free;
                            left.free;
                            left:=nil;
                            left:=nil;
@@ -1245,10 +1246,10 @@ interface
                      end
                      end
                    else
                    else
                      begin
                      begin
-                       pt:=geninlinenode(pprocdef(procdefinition)^.extnumber,is_const,nil);
+                       hpt:=geninlinenode(pprocdef(procdefinition)^.extnumber,is_const,nil);
                      end;
                      end;
-                   firstpass(pt);
-                   pass_1:=pt;
+                   firstpass(hpt);
+                   pass_1:=hpt;
                    goto errorexit;
                    goto errorexit;
                 end
                 end
               else
               else
@@ -1529,7 +1530,10 @@ begin
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.10  2000-10-14 21:52:55  peter
+  Revision 1.11  2000-10-21 14:35:27  peter
+    * readd to many remove p. for tcallnode.is_equal()
+
+  Revision 1.10  2000/10/14 21:52:55  peter
     * fixed memory leaks
     * fixed memory leaks
 
 
   Revision 1.9  2000/10/14 10:14:50  peter
   Revision 1.9  2000/10/14 10:14:50  peter