ソースを参照

* fixed arrayconstruct->set conversion which didn't work for enum sets

peter 26 年 前
コミット
ef66ed259d
3 ファイル変更22 行追加9 行削除
  1. 5 2
      compiler/htypechk.pas
  2. 11 6
      compiler/tccal.pas
  3. 6 1
      compiler/tccnv.pas

+ 5 - 2
compiler/htypechk.pas

@@ -333,7 +333,7 @@ implementation
            setdef :
            setdef :
              begin
              begin
                { automatic arrayconstructor -> set conversion }
                { automatic arrayconstructor -> set conversion }
-               if (def_from^.deftype=arraydef) and (parraydef(def_from)^.IsConstructor) then
+               if is_array_constructor(def_from) then
                 begin
                 begin
                   doconv:=tc_arrayconstructor_2_set;
                   doconv:=tc_arrayconstructor_2_set;
                   b:=1;
                   b:=1;
@@ -649,7 +649,10 @@ implementation
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.25  1999-05-19 20:40:12  florian
+  Revision 1.26  1999-05-20 14:58:26  peter
+    * fixed arrayconstruct->set conversion which didn't work for enum sets
+
+  Revision 1.25  1999/05/19 20:40:12  florian
     * fixed a couple of array related bugs:
     * fixed a couple of array related bugs:
       - var a : array[0..1] of char;   p : pchar;  p:=a+123; works now
       - var a : array[0..1] of char;   p : pchar;  p:=a+123; works now
       - open arrays with an odd size doesn't work: movsb wasn't generated
       - open arrays with an odd size doesn't work: movsb wasn't generated

+ 11 - 6
compiler/tccal.pas

@@ -170,6 +170,13 @@ implementation
          { conversions are inserted                              }
          { conversions are inserted                              }
          else
          else
            begin
            begin
+              { Do we need arrayconstructor -> set conversion, then insert
+                it here before the arrayconstructor node breaks the tree
+                with its conversions of enum->ord }
+              if (p^.left^.treetype=arrayconstructn) and
+                 (defcoll^.data^.deftype=setdef) then
+                p^.left:=gentypeconvnode(p^.left,defcoll^.data);
+
               if count_ref then
               if count_ref then
                begin
                begin
                  { not completly proper, but avoids some warnings }
                  { not completly proper, but avoids some warnings }
@@ -260,11 +267,6 @@ implementation
                     begin
                     begin
                       p^.left:=gentypeconvnode(p^.left,defcoll^.data);
                       p^.left:=gentypeconvnode(p^.left,defcoll^.data);
                       firstpass(p^.left);
                       firstpass(p^.left);
-                      { this is necessary if an arrayconstruct -> set is done
-                        first, then the set generation tree needs to be passed
-                        to get the end resulttype (PFV) }
-                      if not assigned(p^.left^.resulttype) then
-                       firstpass(p^.left);
                     end;
                     end;
                    if codegenerror then
                    if codegenerror then
                      begin
                      begin
@@ -1164,7 +1166,10 @@ implementation
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.45  1999-05-19 10:31:54  florian
+  Revision 1.46  1999-05-20 14:58:27  peter
+    * fixed arrayconstruct->set conversion which didn't work for enum sets
+
+  Revision 1.45  1999/05/19 10:31:54  florian
     * two bugs reported by Romio (bugs 13) are fixed:
     * two bugs reported by Romio (bugs 13) are fixed:
         - empty array constructors are now handled correctly (e.g. for sysutils.format)
         - empty array constructors are now handled correctly (e.g. for sysutils.format)
         - comparsion of ansistrings was sometimes coded wrong
         - comparsion of ansistrings was sometimes coded wrong

+ 6 - 1
compiler/tccnv.pas

@@ -533,6 +533,8 @@ implementation
         putnode(hp);
         putnode(hp);
       { create a set constructor tree }
       { create a set constructor tree }
         arrayconstructor_to_set(p);
         arrayconstructor_to_set(p);
+      { now firstpass the set }
+        firstpass(p);
       end;
       end;
 
 
 
 
@@ -929,7 +931,10 @@ implementation
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.31  1999-05-13 21:59:52  peter
+  Revision 1.32  1999-05-20 14:58:28  peter
+    * fixed arrayconstruct->set conversion which didn't work for enum sets
+
+  Revision 1.31  1999/05/13 21:59:52  peter
     * removed oldppu code
     * removed oldppu code
     * warning if objpas is loaded from uses
     * warning if objpas is loaded from uses
     * first things for new deref writing
     * first things for new deref writing