From 70a28ccc26482b835861c817301ec23a3cd54390 Mon Sep 17 00:00:00 2001 From: Henrique Gottardi Werlang Date: Tue, 16 Jan 2024 17:17:22 -0300 Subject: [PATCH] Generated record info to allow creation of a record by RTTI information. --- packages/pastojs/src/fppas2js.pp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/pastojs/src/fppas2js.pp b/packages/pastojs/src/fppas2js.pp index 51fa46b71a..d91d01910b 100644 --- a/packages/pastojs/src/fppas2js.pp +++ b/packages/pastojs/src/fppas2js.pp @@ -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