* allow nil initialization of dynamic array

This commit is contained in:
peter 2003-03-17 21:42:32 +00:00
parent 5e45fbb32e
commit 4be7d9ddeb

View File

@ -620,9 +620,8 @@ implementation
end; end;
arraydef: arraydef:
begin begin
if token=_LKLAMMER then if try_to_consume(_LKLAMMER) then
begin begin
consume(_LKLAMMER);
for l:=tarraydef(t.def).lowrange to tarraydef(t.def).highrange-1 do for l:=tarraydef(t.def).lowrange to tarraydef(t.def).highrange-1 do
begin begin
readtypedconst(tarraydef(t.def).elementtype,nil,writable); readtypedconst(tarraydef(t.def).elementtype,nil,writable);
@ -672,6 +671,14 @@ implementation
end; end;
p.free; p.free;
end end
else
{ dynamic array nil }
if is_dynamic_array(t.def) then
begin
{ Only allow nil initialization }
consume(_NIL);
curconstSegment.concat(Tai_const.Create_32bit(0));
end
else else
begin begin
{ we want the ( } { we want the ( }
@ -988,7 +995,10 @@ implementation
end. end.
{ {
$Log$ $Log$
Revision 1.64 2003-01-02 20:45:08 peter Revision 1.65 2003-03-17 21:42:32 peter
* allow nil initialization of dynamic array
Revision 1.64 2003/01/02 20:45:08 peter
* fix uninited var * fix uninited var
Revision 1.63 2002/12/26 12:34:54 florian Revision 1.63 2002/12/26 12:34:54 florian