Smart pascal source code
type
TSubRec = record
A, B: Integer;
end;
type
TRec = record
S: TSubRec;
C: Integer;
procedure WriteLnIt;
begin
WriteLn(S.A);
WriteLn(S.B);
WriteLn(C);
end;
end;
var r1, r2: TRec;
r1.S.A := 1;
r1.S.B := 2;
r1.C := 3;
r2.WriteLnIt;
r2 := r1;
r2.WriteLnIt;
procedure Test(r: TRec);
begin
r.WriteLnIt;
end;
r1.S.A := 10;
r1.C := 30;
Test(r1);
Test(r2);
{<<< RESULT - CONSOLE LOG >>>
-----------------------------
Errors >>>>
Hint: "s" does not match case of declaration ("S") [line: 19, column: 4]
Hint: "s" does not match case of declaration ("S") [line: 20, column: 4]
Hint: "b" does not match case of declaration ("B") [line: 20, column: 6]
Hint: "c" does not match case of declaration ("C") [line: 21, column: 4]
Result >>>>
000
123
10230
123
-----------------------------
{<<<<<<<<< THE END >>>>>>>>>}
function Copy$TSubRec(s,d) {
d.A$1=s.A$1;
d.B=s.B;
return d;
}
function Clone$TSubRec($) {
return {
A$1:$.A$1,
B:$.B
}
}
function Copy$TRec(s,d) {
Copy$TSubRec(s.S,d.S);
d.C=s.C;
return d;
}
function Clone$TRec($) {
return {
S:Clone$TSubRec($.S),
C:$.C
}
}
function TRec$WriteLnIt(Self$1) {
WriteLn(Self$1.S.A$1);
WriteLn(Self$1.S.B);
WriteLn(Self$1.C);
}
function Test(r) {
TRec$WriteLnIt(r);
};
var r1 = {S:{A$1:0,B:0},C:0};
var r2 = {S:{A$1:0,B:0},C:0};
/* <<< main JS >>> */
r1.S.A$1 = 1;
r1.S.B = 2;
r1.C = 3;
TRec$WriteLnIt(r2);
Copy$TRec(r1,r2);
TRec$WriteLnIt(r2);
r1.S.A$1 = 10;
r1.C = 30;
Test(Clone$TRec(r1));
Test(Clone$TRec(r2));