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