View Issue Details

IDProjectCategoryView StatusLast Update
0037752pas2jstranspilerpublic2020-09-20 02:04
Reporterhenrique Assigned ToMattias Gaertner  
PrioritynormalSeverityminorReproducibilityalways
Status assignedResolutionopen 
PlatformPas2JsOSWindows 
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

Activities

henrique

2020-09-15 21:57

reporter  

Constructors.patch (317 bytes)   
diff -r packages/pastojs/src/fppas2js.pp (385e7010) packages/pastojs/src/fppas2js.pp (Working Tree)
19524c19524,19525
<       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

henrique

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.

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