Compare commits

...

2 Commits

Author SHA1 Message Date
Henrique Gottardi Werlang
8a171c8fdd Merge branch 'RecordInfoRTTI' into 'main'
Generated record info to allow creation of a record by RTTI information.

See merge request freepascal.org/fpc/source!573
2025-04-03 14:39:22 -03:00
Henrique Gottardi Werlang
70a28ccc26 Generated record info to allow creation of a record by RTTI information. 2025-03-24 11:17:41 -03:00

View File

@ -19043,6 +19043,7 @@ var
ObjLit: TJSObjectLiteral;
Call: TJSCallExpression;
HasRTTIMembers: Boolean;
RecordInfo: TJSObjectLiteralElement;
begin
// module.$rtti.$Record("typename",{});
Call:=CreateRTTINewType(El,GetBIName(pbifnRTTINewRecord),false,FuncContext,ObjLit);
@ -19054,7 +19055,13 @@ begin
end;
HasRTTIMembers:=CreateRTTIMembers(El,Src,FuncContext,MembersSrc,MembersFuncContext,Call,false);
if not HasRTTIMembers then
if HasRTTIMembers then
begin
RecordInfo := ObjLit.Elements.AddElement;
RecordInfo.Name := GetBIName(pbivnPtrRecord);
RecordInfo.Expr := CreatePrimitiveDotExpr('this', El);
end
else
begin
// no published members, add "module.$rtti.$Record..."
if Src=MembersSrc then