Explorar o código

* @procvar support in tp7 mode works again

peter %!s(int64=26) %!d(string=hai) anos
pai
achega
12019771ff
Modificáronse 3 ficheiros con 47 adicións e 10 borrados
  1. 11 4
      compiler/pexpr.pas
  2. 19 1
      compiler/tcadd.pas
  3. 17 5
      compiler/tcmem.pas

+ 11 - 4
compiler/pexpr.pas

@@ -60,7 +60,9 @@ unit pexpr;
 {$endif}
        ;
 
-    const allow_type : boolean = true;
+    const
+      allow_type : boolean = true;
+      got_addrn  : boolean = false;
 
     function parse_paras(_colon,in_prop_paras : boolean) : ptree;
 
@@ -116,9 +118,9 @@ unit pexpr;
 
       begin
          if (m_tp_procvar in aktmodeswitches) and
-{            (not afterassignment) and }
+            (not got_addrn) and
             (not in_args) and
-            (p^.treetype in [loadn]) then
+            (p^.treetype=loadn) then
             begin
                { support if procvar then for tp7 and many other expression like this }
                Store_valid:=Must_be_valid;
@@ -1743,7 +1745,9 @@ unit pexpr;
                end;
  KLAMMERAFFE : begin
                  consume(KLAMMERAFFE);
+                 got_addrn:=true;
                  p1:=factor(true);
+                 got_addrn:=false;
                  p1:=gensinglenode(addrn,p1);
                end;
     LKLAMMER : begin
@@ -2044,7 +2048,10 @@ unit pexpr;
 end.
 {
   $Log$
-  Revision 1.112.2.7  1999-07-07 07:53:10  michael
+  Revision 1.112.2.8  1999-07-16 09:54:57  peter
+    * @procvar support in tp7 mode works again
+
+  Revision 1.112.2.7  1999/07/07 07:53:10  michael
   + Merged patches from florian
 
   Revision 1.120  1999/07/06 22:38:11  florian

+ 19 - 1
compiler/tcadd.pas

@@ -926,6 +926,21 @@ implementation
            end
          else
 
+         { support procvar=nil,procvar<>nil }
+           if ((ld^.deftype=procvardef) and (rt=niln)) or
+              ((rd^.deftype=procvardef) and (lt=niln)) then
+            begin
+              calcregisters(p,1,0,0);
+              p^.location.loc:=LOC_REGISTER;
+              case p^.treetype of
+                 equaln,unequaln : ;
+              else
+                CGMessage(type_e_mismatch);
+              end;
+              convdone:=true;
+            end
+         else
+
            if (rd^.deftype=pointerdef) or
              is_zero_based_array(rd) then
             begin
@@ -1102,7 +1117,10 @@ implementation
 end.
 {
   $Log$
-  Revision 1.34.2.2  1999-06-17 15:25:07  pierre
+  Revision 1.34.2.3  1999-07-16 09:54:58  peter
+    * @procvar support in tp7 mode works again
+
+  Revision 1.34.2.2  1999/06/17 15:25:07  pierre
    * for arrays of char operators can not be overloaded
 
   Revision 1.34.2.1  1999/06/17 12:35:23  pierre

+ 17 - 5
compiler/tcmem.pas

@@ -185,9 +185,18 @@ implementation
               { proc/procvar 2 procvar ? }
               if p^.left^.treetype=calln then
                 begin
-                     { it could also be a procvar, not only pprocsym ! }
-                     if p^.left^.symtableprocentry^.typ=varsym then
-                        hp:=genloadnode(pvarsym(p^.left^.symtableentry),p^.left^.symtableproc)
+                     { is it a procvar, this is needed for @procvar in tp mode ! }
+                     if assigned(p^.left^.right) then
+                       begin
+                         { just return the load of the procvar, remove the
+                           addrn and calln nodes }
+                         hp:=p^.left^.right;
+                         putnode(p^.left);
+                         putnode(p);
+                         firstpass(hp);
+                         p:=hp;
+                         exit;
+                       end
                      else
                         begin
                           { generate a methodcallnode or proccallnode }
@@ -274,7 +283,7 @@ implementation
          if is_constnode(p^.left) then
           begin
             aktfilepos:=p^.left^.fileinfo;
-	    CGMessage(type_e_no_addr_of_constant);
+            CGMessage(type_e_no_addr_of_constant);
           end
          else
            begin
@@ -588,7 +597,10 @@ implementation
 end.
 {
   $Log$
-  Revision 1.18.2.3  1999-07-05 20:06:47  peter
+  Revision 1.18.2.4  1999-07-16 09:54:59  peter
+    * @procvar support in tp7 mode works again
+
+  Revision 1.18.2.3  1999/07/05 20:06:47  peter
     * give error instead of warning for ln(0) and sqrt(0)
 
   Revision 1.18.2.2  1999/07/05 16:22:56  peter