Open
Description
Problem
Currently, all methods generated with [Query]
are, by default, public
, regardless of the accessibility of the method.
This causes several problems:
- Private, class-local types cannot be used in a query method header, even if the method is only called within the system. For example, if a
private struct SomeLocalInfo {}
is defined within theBaseSystem
, that can never be used as a[Data]
parameter within a query without exposing it to the public. - Systems can never be
public
in a module, unless you want all your queries to be exposed to the public API. Instead, a module must manually wrap all systems and make all systemsinternal
(extremely bad, if you're making a game engine with drop-in systems!)
Solution
Instead, provide a parameter to the [Query]
attribute:
public enum QueryAccessibility
{
CopyMethod, // copy the source method's accessibility
// fill in attributes from Microsoft.CodeAnalysis.Accessibility
}
public class QueryAttribute : Attribute
{
QueryAccessibility Accessibility = QueryAccessibility.CopyMethod;
}
By default, the query could either be public, or copy the source method's accessibility, depending on whether it's super important to maintain API.
Metadata
Metadata
Assignees
Labels
No labels