mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-13 00:09:32 +02:00
* create_for_in_loop: if there's a choice between iterating an array and a set then prefer the set for backwards compatibility
git-svn-id: trunk@36097 -
This commit is contained in:
parent
a8b1d340c7
commit
c6f19b9888
@ -925,6 +925,15 @@ implementation
|
||||
end
|
||||
else
|
||||
begin
|
||||
{ prefer set if loop var could be a set var and the loop
|
||||
expression can indeed be a set }
|
||||
if (expr.nodetype=arrayconstructorn) and
|
||||
(hloopvar.resultdef.typ in [enumdef,orddef]) and
|
||||
arrayconstructor_can_be_set(expr) then
|
||||
begin
|
||||
expr:=arrayconstructor_to_set(expr,false);
|
||||
typecheckpass(expr);
|
||||
end;
|
||||
case expr.resultdef.typ of
|
||||
stringdef: result:=create_string_for_in_loop(hloopvar, hloopbody, expr);
|
||||
arraydef: result:=create_array_for_in_loop(hloopvar, hloopbody, expr);
|
||||
|
Loading…
Reference in New Issue
Block a user