mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-07 22:47:59 +02:00
pastojs: extended rtti: strict private, protected
This commit is contained in:
parent
212b0fb7a8
commit
671079789c
@ -794,7 +794,7 @@ type
|
||||
public
|
||||
PackMode: TPackMode;
|
||||
Members: TFPList;
|
||||
RTTIVisibility: TRTTIVisibility;
|
||||
RTTIVisibility: TRTTIVisibility; // set by $RTTI directive
|
||||
Constructor Create(const AName: TPasTreeString; AParent: TPasElement); override;
|
||||
Destructor Destroy; override;
|
||||
procedure FreeChildren(Prepare: boolean); override;
|
||||
|
@ -567,6 +567,8 @@ const
|
||||
ExtRTTIVisPublic = 2;
|
||||
ExtRTTIVisPublished = 3;
|
||||
ExtRTTIVisPublicPublished = 4; // in source published, in RTTI public
|
||||
ExtRTTIVisStrictPrivate = 5;
|
||||
ExtRTTIVisStrictProtected = 6;
|
||||
ExtRTTIVisDefaultField = ExtRTTIVisPublic;
|
||||
ExtRTTIVisDefaultMethod = ExtRTTIVisPublic;
|
||||
ExtRTTIVisDefaultProperty = ExtRTTIVisPublicPublished;
|
||||
@ -20762,8 +20764,16 @@ var
|
||||
begin
|
||||
ExtVis:=TPasMembersType.VisibilityToExtRTTI[El.Visibility];
|
||||
case ExtVis of
|
||||
vcPrivate: Result:=ExtRTTIVisPrivate;
|
||||
vcProtected: Result:=ExtRTTIVisProtected;
|
||||
vcPrivate:
|
||||
if El.Visibility=visStrictPrivate then
|
||||
Result:=ExtRTTIVisStrictPrivate
|
||||
else
|
||||
Result:=ExtRTTIVisPrivate;
|
||||
vcProtected:
|
||||
if El.Visibility=visStrictProtected then
|
||||
Result:=ExtRTTIVisStrictProtected
|
||||
else
|
||||
Result:=ExtRTTIVisProtected;
|
||||
vcPublic: Result:=ExtRTTIVisPublic;
|
||||
vcPublished:
|
||||
if not (vcPublished in Vis) then
|
||||
|
@ -31726,10 +31726,14 @@ begin
|
||||
Add('type');
|
||||
Add('{$RTTI explicit fields([vcPrivate,vcProtected,vcPublic,vcPublished])}');
|
||||
Add(' TObject = class');
|
||||
Add(' strict private');
|
||||
Add(' A1: word;');
|
||||
Add(' private');
|
||||
Add(' A: word;');
|
||||
Add(' A2: word;');
|
||||
Add(' strict protected');
|
||||
Add(' B1: word;');
|
||||
Add(' protected');
|
||||
Add(' B1, B2: word;');
|
||||
Add(' B2, B3: word;');
|
||||
Add(' public');
|
||||
Add(' C: word;');
|
||||
Add(' published');
|
||||
@ -31741,18 +31745,22 @@ begin
|
||||
LinesToStr([ // statements
|
||||
'rtl.createClass(this, "TObject", null, function () {',
|
||||
' this.$init = function () {',
|
||||
' this.A = 0;',
|
||||
' this.A1 = 0;',
|
||||
' this.A2 = 0;',
|
||||
' this.B1 = 0;',
|
||||
' this.B2 = 0;',
|
||||
' this.B3 = 0;',
|
||||
' this.C = 0;',
|
||||
' this.D = 0;',
|
||||
' };',
|
||||
' this.$final = function () {',
|
||||
' };',
|
||||
' var $r = this.$rtti;',
|
||||
' $r.addField("A", rtl.word, 0);',
|
||||
' $r.addField("B1", rtl.word, 1);',
|
||||
' $r.addField("A1", rtl.word, 5);',
|
||||
' $r.addField("A2", rtl.word, 0);',
|
||||
' $r.addField("B1", rtl.word, 6);',
|
||||
' $r.addField("B2", rtl.word, 1);',
|
||||
' $r.addField("B3", rtl.word, 1);',
|
||||
' $r.addField("C", rtl.word);',
|
||||
' $r.addField("D", rtl.word, 3);',
|
||||
'});',
|
||||
|
Loading…
Reference in New Issue
Block a user