This commit is contained in:
parent
970f5827a0
commit
6764768a02
|
|
@ -11599,7 +11599,10 @@ namespace PascalABCCompiler.NETGenerator
|
|||
}
|
||||
LocalBuilder lb = il.DeclareLocal(return_type);
|
||||
if (save_debug_info) lb.SetLocalSymInfo("$enumer$" + uid++);
|
||||
|
||||
value.InWhatExpr.visit(this);
|
||||
if (value.InWhatExpr.type.is_value_type)
|
||||
il.Emit(OpCodes.Box, in_what_type);
|
||||
il.Emit(OpCodes.Callvirt, enumer_mi);
|
||||
il.Emit(OpCodes.Stloc, lb);
|
||||
Label exl = il.BeginExceptionBlock();
|
||||
|
|
|
|||
18
TestSuite/foreach13.pas
Normal file
18
TestSuite/foreach13.pas
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
type
|
||||
// Обязательно запись
|
||||
r1 = record(IEnumerable<Exception>)
|
||||
res := new Exception[](new System.InvalidOperationException('OK'));
|
||||
|
||||
function GetEnumerator: IEnumerator<Exception> := res.AsEnumerable.GetEnumerator;
|
||||
function System.Collections.IEnumerable.GetEnumerator: System.Collections.IEnumerator := self.GetEnumerator;
|
||||
|
||||
end;
|
||||
|
||||
begin
|
||||
var ex: Exception;
|
||||
foreach var e in new r1 do
|
||||
begin
|
||||
ex := e;
|
||||
end;
|
||||
assert(ex.Message = 'OK');
|
||||
end.
|
||||
Loading…
Reference in a new issue