* create_for_in_loop: explicitely convert "for ... in [] do" to a nothing-node including an unreachable code warning (avoids code conversions that are for naught anyway)

git-svn-id: trunk@36096 -
This commit is contained in:
svenbarth 2017-05-04 21:37:12 +00:00
parent df893b4a30
commit a8b1d340c7

View File

@ -872,6 +872,14 @@ implementation
hloopbody.free;
end;
end
{ "for x in [] do ..." always results in a never executed loop body }
else if (is_array_constructor(expr.resultdef) and
(tarraydef(expr.resultdef).elementdef=voidtype)) then
begin
if assigned(hloopbody) then
MessagePos(hloopbody.fileinfo,cg_w_unreachable_code);
result:=cnothingnode.create;
end
else
begin
// search for operator first