Smart pascal source code
type
TRec = record
x, y: Integer;
procedure WriteLnIt;
begin
WriteLn(x);
WriteLn(',');
WriteLn(y);
end;
end;
var r: TRec;
procedure IncX(var r: TRec);
begin
r.x += 1;
end;
function Func(y: Integer): TRec;
begin
Result.x := y;
Result.y := y * 2;
IncX(Result);
end;
function Nested(i: Integer): TRec;
begin
if i = 0 then
Exit(r);
Result := Func(i);
IncX(Result);
end;
IncX(r);
r.WriteLnIt;
r := Func(3);
r.WriteLnIt;
r := Nested(0);
r.WriteLnIt;
r := Nested(1);
r.WriteLnIt;
var r1 := Nested(0);
IncX(r);
r1.WriteLnIt;
r.WriteLnIt;
{<<< RESULT - CONSOLE LOG >>>
-----------------------------
Errors >>>>
Hint: "X" does not match case of declaration ("x") [line: 14, column: 6]
Result >>>>
1,0
4,6
4,6
3,2
3,2
4,2
-----------------------------
{<<<<<<<<< THE END >>>>>>>>>}
var r = {x$1:0,y:0};
var r1 = {x$1:0,y:0};
function Nested(i) {
var Result = {x$1:0,y:0};
if (i==0) {
return Copy$TRec(r,Result);
}
Result = Func(i);
IncX(Result);
return Result
};
function Func(y$1) {
var Result = {x$1:0,y:0};
Result.x$1 = y$1;
Result.y = y$1*2;
IncX(Result);
return Result
};
function IncX(r$1) {
r$1.x$1+=1;
};
/// TRec = record
/// [line: 39, column: 3, file: uMain]
function Copy$TRec(s,d) {
d.x$1=s.x$1;
d.y=s.y;
return d;
}
function Clone$TRec($) {
return {
x$1:$.x$1,
y:$.y
}
}
/// procedure TRec.WriteLnIt(var Self: TRec)
/// [line: 41, column: 15, file: uMain]
function TRec$WriteLnIt(Self$1) {
WriteLn(Self$1.x$1);
WriteLn(",");
WriteLn(Self$1.y);
}
IncX(r);
TRec$WriteLnIt(r);
r = Func(3);
TRec$WriteLnIt(r);
r = Nested(0);
TRec$WriteLnIt(r);
r = Nested(1);
TRec$WriteLnIt(r);
r1 = Nested(0);
IncX(r);
TRec$WriteLnIt(r1);
TRec$WriteLnIt(r);