View Issue Details

IDProjectCategoryView StatusLast Update
0037752pas2jstranspilerpublic2020-10-28 22:13
Reporterhenrique Assigned ToMattias Gaertner  
Status assignedResolutionopen 
Summary0037752: Constructors in RTTI
DescriptionI modified the publishing control in RTTI to add the public constructors of the classes, because it cannot be set to published.
TagsNo tags attached.
Fixed in Revision
Attached Files



2020-09-15 21:57


Constructors.patch (317 bytes)   
diff -r packages/pastojs/src/fppas2js.pp (385e7010) packages/pastojs/src/fppas2js.pp (Working Tree)
<       if P.Visibility<>visPublished then continue;
>       if (P.Visibility<>visPublished) and ((P.Visibility<>visPublic) or not P.InheritsFrom(TPasConstructor)) then
>         Continue;
Constructors.patch (317 bytes)   

Sven Barth

2020-09-15 22:44

developer   ~0125557

Please note that this is an incorrect fix. The correct fix is to add support for the $Rtti directive which allows to control the generation of RTTI for non-published types


2020-09-15 23:32

reporter   ~0125560

Hmmm... can you give me an example of how to do it?

Sven Barth

2020-09-16 09:09

developer   ~0125566

Last edited: 2020-09-16 09:10

View 2 revisions

Not really, as I'm working on FPC, not pas2js.

But in essence it boils down to this:
- parse $Rtti directive in the scanner
- generate appropriate RTTI data for this “Extended RTTI”
- adjust Rtti unit to use this Extended RTTI

At least in Delphi (and once FPC supports it there as well) the “Extended RTTI” for methods is part of the method table (though in a separate part from the “Legacy RTTI”) that is accessible from an instance's VMT, I don't know how it's implemented in pas2js.

Yes, this is more involved than your patch, but in my opinion this is the right way considering that pas2js is supposed to be compatible to FPC/Delphi.


2020-10-06 13:37

reporter   ~0126114

I understand, but I don't now how do this.

I find a easier solution, just this :D.

Mattias Gaertner

2020-10-28 22:06

manager   ~0126620

pas2js will probably follow fpc, .i.e. constructors need extended RTTI. There is no plan yet for implementing extended RTTI.


2020-10-28 22:13

reporter   ~0126622


Issue History

Date Modified Username Field Change
2020-09-15 21:57 henrique New Issue
2020-09-15 21:57 henrique File Added: Constructors.patch
2020-09-15 22:44 Sven Barth Note Added: 0125557
2020-09-15 23:32 henrique Note Added: 0125560
2020-09-16 09:09 Sven Barth Note Added: 0125566
2020-09-16 09:10 Sven Barth Note Edited: 0125566 View Revisions
2020-09-20 02:04 Mattias Gaertner Assigned To => Mattias Gaertner
2020-09-20 02:04 Mattias Gaertner Status new => assigned
2020-10-06 13:37 henrique Note Added: 0126114
2020-10-28 22:06 Mattias Gaertner Note Added: 0126620
2020-10-28 22:13 henrique Note Added: 0126622