This commit is contained in:
parent
abec09d436
commit
46a4f5d766
24
TestSuite/foreach9.pas
Normal file
24
TestSuite/foreach9.pas
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
var i: integer;
|
||||
|
||||
type
|
||||
t1 = record
|
||||
private function InitA: integer;
|
||||
begin
|
||||
Inc(i);
|
||||
end;
|
||||
|
||||
public a := InitA;
|
||||
public b: integer;
|
||||
|
||||
public constructor(b: integer) := self.b := b;
|
||||
|
||||
end;
|
||||
|
||||
begin
|
||||
var l := new List<t1>;
|
||||
l += new t1(2);
|
||||
l += new t1(3);
|
||||
foreach var o in l do
|
||||
;
|
||||
assert(i = 2);
|
||||
end.
|
||||
|
|
@ -161,8 +161,10 @@ namespace PascalABCCompiler.TreeConverter
|
|||
check_for_type_allowed(tn, get_location(_foreach_stmt.type_name));
|
||||
check_using_static_class(tn, get_location(_foreach_stmt.type_name));
|
||||
}
|
||||
|
||||
context.close_var_definition_list(tn, null);
|
||||
if (tn.is_value_type && !tn.is_standard_type)
|
||||
context.close_var_definition_list(tn, new default_operator_node(tn, foreachVariable.location));
|
||||
else
|
||||
context.close_var_definition_list(tn, null);
|
||||
}
|
||||
|
||||
if (/*!(foreachVariable.type is compiled_generic_instance_type_node) &&*/ !sys_coll_ienum) // SSM 16.09.18 - закомментировал это ограничение для фиксации бага #1184
|
||||
|
|
|
|||
Loading…
Reference in a new issue