Browse Source

* fixed 1238

florian 25 years ago
parent
commit
523fa60d9e
2 changed files with 19 additions and 6 deletions
  1. 3 2
      compiler/errore.msg
  2. 16 4
      compiler/ptype.pas

+ 3 - 2
compiler/errore.msg

@@ -890,7 +890,8 @@ parser_e_interface_id_expected=03169_E_interface identifier expected
 %     ....
 % \end{verbatim}
 % and the \var{interface} before the dot not listed in the inheritance list.
-% \end{description}
+parser_e_type_cant_be_used_in_array_index=03170_E_Type "$1" can't be used as array index type
+% Types like DWord or Int64 aren't allowed as array index type% \end{description}
 #
 # Type Checking
 #
@@ -1930,4 +1931,4 @@ option_help_pages=11025_[
 
 #
 # The End...
-#
+#

+ 16 - 4
compiler/ptype.pas

@@ -337,9 +337,18 @@ implementation
                 end;
               orddef :
                 begin
-                  lowval:=porddef(p)^.low;
-                  highval:=porddef(p)^.high;
-                  arraytype:=p;
+                  if porddef(p)^.typ in [uchar,
+                    u8bit,u16bit,
+                    s8bit,s16bit,s32bit,
+                    bool8bit,bool16bit,bool32bit,
+                    uwidechar] then
+                    begin
+                       lowval:=porddef(p)^.low;
+                       highval:=porddef(p)^.high;
+                       arraytype:=p;
+                    end
+                  else
+                    Message1(parser_e_type_cant_be_used_in_array_index,p^.gettypename);
                 end;
               else
                 Message(sym_e_error_in_type_def);
@@ -581,7 +590,10 @@ implementation
 end.
 {
   $Log$
-  Revision 1.14  2000-11-04 14:25:21  florian
+  Revision 1.15  2000-11-14 23:43:38  florian
+    * fixed 1238
+
+  Revision 1.14  2000/11/04 14:25:21  florian
     + merged Attila's changes for interfaces, not tested yet
 
   Revision 1.13  2000/10/31 22:02:51  peter