peter 26 years ago
parent
commit
e303022851
2 changed files with 55 additions and 39 deletions
  1. 16 5
      compiler/pexpr.pas
  2. 39 34
      compiler/tccal.pas

+ 16 - 5
compiler/pexpr.pas

@@ -113,7 +113,7 @@ unit pexpr;
       var
       var
          p1 : ptree;
          p1 : ptree;
          Store_valid : boolean;
          Store_valid : boolean;
-         
+
       begin
       begin
          if (m_tp_procvar in aktmodeswitches) and
          if (m_tp_procvar in aktmodeswitches) and
 {            (not afterassignment) and }
 {            (not afterassignment) and }
@@ -1803,9 +1803,11 @@ unit pexpr;
         { generate error node if no node is created }
         { generate error node if no node is created }
         if not assigned(p1) then
         if not assigned(p1) then
           p1:=genzeronode(errorn);
           p1:=genzeronode(errorn);
-         { tp7 procvar handling }
-         if (m_tp_procvar in aktmodeswitches) then
-           check_tp_procvar(p1);
+        { tp7 procvar handling, but not if the next token
+          will be a := }
+        if (m_tp_procvar in aktmodeswitches) and
+           (token<>ASSIGNMENT) then
+          check_tp_procvar(p1);
         factor:=p1;
         factor:=p1;
         check_tokenpos;
         check_tokenpos;
       end;
       end;
@@ -2042,7 +2044,10 @@ unit pexpr;
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.117  1999-06-30 15:43:20  florian
+  Revision 1.118  1999-07-01 21:33:57  peter
+    * merged
+
+  Revision 1.117  1999/06/30 15:43:20  florian
     * two bugs regarding method variables fixed
     * two bugs regarding method variables fixed
       - if you take in a method the address of another method
       - if you take in a method the address of another method
         don't need self anymore
         don't need self anymore
@@ -2052,6 +2057,12 @@ end.
   Revision 1.116  1999/06/26 00:24:53  pierre
   Revision 1.116  1999/06/26 00:24:53  pierre
    * mereg from fixes-0_99_12 branch
    * mereg from fixes-0_99_12 branch
 
 
+  Revision 1.112.2.6  1999/07/01 21:31:59  peter
+    * procvar fixes again
+
+  Revision 1.112.2.5  1999/07/01 15:17:17  peter
+    * methoidpointer fixes from florian
+
   Revision 1.112.2.4  1999/06/26 00:22:30  pierre
   Revision 1.112.2.4  1999/06/26 00:22:30  pierre
    * wrong warnings in -So mode suppressed
    * wrong warnings in -So mode suppressed
 
 

+ 39 - 34
compiler/tccal.pas

@@ -485,7 +485,8 @@ implementation
                 end;
                 end;
               if assigned(pt) or assigned(pdc) then
               if assigned(pt) or assigned(pdc) then
                 begin
                 begin
-                   aktfilepos:=pt^.fileinfo;
+                   if assigned(pt) then
+                     aktfilepos:=pt^.fileinfo;
                    CGMessage(parser_e_illegal_parameter_list);
                    CGMessage(parser_e_illegal_parameter_list);
                 end;
                 end;
               { insert type conversions }
               { insert type conversions }
@@ -587,15 +588,28 @@ implementation
 
 
                    { no procedures found? then there is something wrong
                    { no procedures found? then there is something wrong
                      with the parameter size }
                      with the parameter size }
-                   if not assigned(procs) and
-                      ((parsing_para_level=0) or assigned(p^.left)) and
-                      (nextprocsym=nil) then
+                   if not assigned(procs) then
                     begin
                     begin
-                       if assigned(p^.left) then
-                         aktfilepos:=p^.left^.fileinfo;
-                       CGMessage(parser_e_wrong_parameter_size);
-                       aktcallprocsym^.write_parameter_lists;
-                       goto errorexit;
+                      { in tp mode we can try to convert to procvar if
+                        there are no parameters specified }
+                      if not(assigned(p^.left)) and
+                         (m_tp_procvar in aktmodeswitches) then
+                        begin
+                          p^.treetype:=loadn;
+                          p^.resulttype:=pprocsym(p^.symtableprocentry)^.definition;
+                          p^.symtableentry:=p^.symtableprocentry;
+                          p^.is_first:=false;
+                          p^.disposetyp:=dt_nothing;
+                          firstpass(p);
+                        end
+                      else
+                        begin
+                          if assigned(p^.left) then
+                           aktfilepos:=p^.left^.fileinfo;
+                          CGMessage(parser_e_wrong_parameter_size);
+                          aktcallprocsym^.write_parameter_lists;
+                        end;
+                      goto errorexit;
                     end;
                     end;
 
 
                 { now we can compare parameter after parameter }
                 { now we can compare parameter after parameter }
@@ -707,33 +721,18 @@ implementation
                     begin
                     begin
                       { there is an error, must be wrong type, because
                       { there is an error, must be wrong type, because
                         wrong size is already checked (PFV) }
                         wrong size is already checked (PFV) }
-                      {if ((parsing_para_level=0) or (p^.left<>nil)) and
-                         (nextprocsym=nil) then }
-                      if (parsing_para_level>0) and
-                         (m_tp_procvar in aktmodeswitches) then
-                        begin
-                          { try to convert to procvar }
-                          p^.treetype:=loadn;
-                          p^.resulttype:=pprocsym(p^.symtableprocentry)^.definition;
-                          p^.symtableentry:=p^.symtableprocentry;
-                          p^.is_first:=false;
-                          p^.disposetyp:=dt_nothing;
-                          firstpass(p);
-                        end
+                      if (not assigned(lastparatype)) or
+                         (not assigned(pt)) or
+                         (not assigned(pt^.resulttype)) then
+                        internalerror(39393)
                       else
                       else
                         begin
                         begin
-                          if (not assigned(lastparatype)) or (not assigned(pt)) or
-                             (not assigned(pt^.resulttype)) then
-                            internalerror(39393)
-                          else
-                            begin
-                               aktfilepos:=pt^.fileinfo;
-                               CGMessage3(type_e_wrong_parameter_type,tostr(lastpara),
-                                 pt^.resulttype^.typename,lastparatype^.typename);
-                            end;
-                          aktcallprocsym^.write_parameter_lists;
+                          aktfilepos:=pt^.fileinfo;
+                          CGMessage3(type_e_wrong_parameter_type,tostr(lastpara),
+                            pt^.resulttype^.typename,lastparatype^.typename);
                         end;
                         end;
-                       goto errorexit;
+                      aktcallprocsym^.write_parameter_lists;
+                      goto errorexit;
                     end;
                     end;
 
 
                    { if there are several choices left then for orddef }
                    { if there are several choices left then for orddef }
@@ -1184,12 +1183,18 @@ implementation
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.53  1999-06-29 14:02:33  peter
+  Revision 1.54  1999-07-01 21:33:58  peter
+    * merged
+
+  Revision 1.53  1999/06/29 14:02:33  peter
     * merged file pos fixes
     * merged file pos fixes
 
 
   Revision 1.52  1999/06/29 12:16:22  pierre
   Revision 1.52  1999/06/29 12:16:22  pierre
    * mereg from fixes-0_99_12
    * mereg from fixes-0_99_12
 
 
+  Revision 1.51.2.3  1999/07/01 21:32:01  peter
+    * procvar fixes again
+
   Revision 1.51.2.2  1999/06/29 12:12:13  pierre
   Revision 1.51.2.2  1999/06/29 12:12:13  pierre
    * fix for bug0272
    * fix for bug0272