Smart pascal source code
type
TRecord = record
F: Integer;
A: array of TRecord;
procedure WriteLnMe;
end;
procedure TRecord.WriteLnMe;
var i: Integer;
begin
WriteLn(F);
for i := A.Low to A.High do
A[i].WriteLnMe;
end;
var r: TRecord;
var r2: TRecord;
r.F := 1;
r2.F := 2;
r.A.Add(r2);
r2.F := 3;
r.A.Add(r2);
r.A.Add(r2);
r.WriteLnMe;
{<<< RESULT - CONSOLE LOG >>>
-----------------------------
1
2
3
3
-----------------------------
{<<<<<<<<< THE END >>>>>>>>>}
function Copy$TRecord(s,d) {
d.F=s.F;
d.A$1=s.A$1;
return d;
}
function Clone$TRecord($) {
return {
F:$.F,
A$1:$.A$1
}
}
function TRecord$WriteLnMe(Self$1) {
var i = 0;
WriteLn(Self$1.F);
var $temp1;
for(i=0,$temp1=Self$1.A$1.length;i<$temp1;i++) {
TRecord$WriteLnMe($DIdxR(Self$1.A$1,i,""));
}
}
var r = {F:0,A$1:[]};
var r2 = {F:0,A$1:[]};
/* <<< main JS >>> */
r.F = 1;
r2.F = 2;
r.A$1.push(Clone$TRecord(r2));
r2.F = 3;
r.A$1.push(Clone$TRecord(r2));
r.A$1.push(Clone$TRecord(r2));
TRecord$WriteLnMe(r);