Browse Source

* in delphi mode const sets from enumerations with values > 255 are allowed if these elements aren't used

florian 20 years ago
parent
commit
a2a4985896
1 changed files with 18 additions and 3 deletions
  1. 18 3
      compiler/ncnv.pas

+ 18 - 3
compiler/ncnv.pas

@@ -427,11 +427,23 @@ implementation
                        end
                        end
                       else
                       else
                        begin
                        begin
-                      { Single value }
+                         { Single value }
                          if p2.nodetype=ordconstn then
                          if p2.nodetype=ordconstn then
                           begin
                           begin
                             if not(is_integer(p2.resulttype.def)) then
                             if not(is_integer(p2.resulttype.def)) then
-                              update_constsethi(p2.resulttype)
+                              begin
+                                { for constant set elements, delphi allows the usage of elements of enumerations which
+                                  have value>255 if there is no element with a value > 255 used }
+                                if (m_delphi in aktmodeswitches) and (p2.resulttype.def.deftype=enumdef) then
+                                  begin
+                                    if tordconstnode(p2).value>constsethi then
+                                      constsethi:=tordconstnode(p2).value;
+                                    if htype.def=nil then
+                                      htype:=p2.resulttype;
+                                  end
+                                else
+                                  update_constsethi(p2.resulttype)
+                              end
                             else
                             else
                               inserttypeconv(p2,u8inttype);
                               inserttypeconv(p2,u8inttype);
 
 
@@ -2583,7 +2595,10 @@ begin
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.175  2005-01-30 11:26:40  peter
+  Revision 1.176  2005-02-03 18:43:59  florian
+    * in delphi mode const sets from enumerations with values > 255 are allowed if these elements aren't used
+
+  Revision 1.175  2005/01/30 11:26:40  peter
     * add info that a procedure is local in error messages
     * add info that a procedure is local in error messages
 
 
   Revision 1.174  2005/01/09 15:04:36  peter
   Revision 1.174  2005/01/09 15:04:36  peter