Biohazrd icon indicating copy to clipboard operation
Biohazrd copied to clipboard

Enforce protected member access

Open PathogenDavid opened this issue 3 years ago • 1 comments

C# structs do not support inheritance and by extension do not support protected. Right now we emit protected as private, but usually the generator ends up changing protected to public anyway.

Ideally we'd like a way for protected to be enforced as expected. One way to do this would be to have multiple "views" of a struct (one for protected and one for public) and you cast pointers when you know you should have protected access.

The other alternative is to let things be public but use a Roslyn analyzer to enforce proper protected access. The downside to this approach is protected members would clog up Intellisense.

PathogenDavid avatar Nov 28 '20 23:11 PathogenDavid

Semi-related: We also need to enable access to protected inline constructors and methods. They can't be exported using InlineExportHelper. https://github.com/InfectedLibraries/Biohazrd/issues/14 is somewhat related as it will likely be solved in a similar way.

PathogenDavid avatar Feb 21 '21 10:02 PathogenDavid