ソースを参照

* procvar fixes again

peter 26 年 前
コミット
8df213da5f
2 ファイル変更46 行追加39 行削除
  1. 10 5
      compiler/pexpr.pas
  2. 36 34
      compiler/tccal.pas

+ 10 - 5
compiler/pexpr.pas

@@ -113,7 +113,7 @@ unit pexpr;
       var
          p1 : ptree;
          Store_valid : boolean;
-         
+
       begin
          if (m_tp_procvar in aktmodeswitches) and
 {            (not afterassignment) and }
@@ -1803,9 +1803,11 @@ unit pexpr;
         { generate error node if no node is created }
         if not assigned(p1) then
           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;
         check_tokenpos;
       end;
@@ -2042,7 +2044,10 @@ unit pexpr;
 end.
 {
   $Log$
-  Revision 1.112.2.5  1999-07-01 15:17:17  peter
+  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

+ 36 - 34
compiler/tccal.pas

@@ -485,7 +485,8 @@ implementation
                 end;
               if assigned(pt) or assigned(pdc) then
                 begin
-                   aktfilepos:=pt^.fileinfo;
+                   if assigned(pt) then
+                     aktfilepos:=pt^.fileinfo;
                    CGMessage(parser_e_illegal_parameter_list);
                 end;
               { insert type conversions }
@@ -587,15 +588,28 @@ implementation
 
                    { no procedures found? then there is something wrong
                      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
-                       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;
 
                 { now we can compare parameter after parameter }
@@ -707,33 +721,18 @@ implementation
                     begin
                       { there is an error, must be wrong type, because
                         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
                         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;
-                       goto errorexit;
+                      aktcallprocsym^.write_parameter_lists;
+                      goto errorexit;
                     end;
 
                    { if there are several choices left then for orddef }
@@ -1184,7 +1183,10 @@ implementation
 end.
 {
   $Log$
-  Revision 1.51.2.2  1999-06-29 12:12:13  pierre
+  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
    * fix for bug0272
 
   Revision 1.51.2.1  1999/06/28 00:33:47  pierre