You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
var res := 0;
// Обязательно отдельная подпрограмма в которую передаётся лямбда
// Если присваивать лямбду переменной - не воспроизведётся
procedure p1(a: ()->()) := a();
type t0 = class end;
// Обязательно p2 - extensionmethod
// С обычным методом не воспроизведётся
procedure p2(self: t0; x: byte); extensionmethod := res += 1;
type
t1 = class
o: t0;
procedure p3;
begin
// Обязательно захватить локальную переменную
var x := default(byte);
// Обязательно короткая лямбда
// Если сделать ей тело "begin-end" - не воспроизводится
// OK
p1(()->self.o.p2(x));
//Ошибка: Неизвестное имя 'o'
p1(()-> o.p2(x));
end;
end;
begin
t1.Create.p3;
Assert(res=2);
end.
The text was updated successfully, but these errors were encountered:
The text was updated successfully, but these errors were encountered: