Copy/Cloning of inlined nested records broken for JS
Issue #106
new
With this piece of code:
unit Test;
interface
type
RMasterRecord = record
Info: string = 'Test';
RSubRecord = record
Info: Integer = 10;
Flag: Boolean = false;
end;
end;
implementation
var gRec: RMasterRecord;
function Copy(const aRec: RMasterRecord): RMasterRecord;
begin
Result := aRec;
end;
initialization
Copy(gRec);
end.
i get the following JS output:
/// RMasterRecord = record
function Copy$RMasterRecord(s,d) {
d.Info$1=s.Info$1;
Copy$a$1(s.RSubRecord,d.RSubRecord);
return d;
}
function Clone$RMasterRecord($) {
return {
Info$1:$.Info$1,
RSubRecord:Clone$a$1($.RSubRecord)
}
}
function Copy$1(aRec) {
return Clone$RMasterRecord(aRec);
};
var gRec = {Info$1:"Test",RSubRecord:{Info:10,Flag:false}};
Copy$1(gRec);
As you can see Copy$a$1 and Clone$a$1 did not make it into the output.
This worked fine in my deployed project at the commit of 16 march.
Regards,
/Dany
Comments (5)
-
reporter -
reporter The exact comitt this changed was [06aa6a1].
-
reporter - changed title to Copy/Cloning of inlined nested records broken for JS
-
reporter A workaround that does not imply changing all references is to declare the nested records separately.
type RSubRecord = record Member1.Integer = 0; end; RMasterRecord = record Member1: string = 'Init'; Member2: RSubRecord; end;
-
reporter - marked as minor
- Log in to comment
Feels a lot like issue
#96. Tested with and w/o smart linking. Same result.