At the moment there is nothing shared between the toolkit's declaration wrappers; StructDecl, EnumDecl, VariableDecl, and maybe others by the time someone gets to this issue. A protocol would enable much more powerful generic programming to enable developers to create more flexible macros. Here's a rough idea of what such a protocol might look like (pretty simple for now);
public protocol DeclProtocol {
var identifier: String { get }
var accessLevel: AccessLevel? { get }
}
public enum AccessLevel {
case public
case private
case internal
}
Once you've created the protocol, make sure to update existing declaration wrappers (including Decl) to conform to the protocol. Additionally, if DeclGroupProtocol exists by the time that someone is tackling this issue, it should be updated to inherit from DeclProtocol as well.
At the moment there is nothing shared between the toolkit's declaration wrappers;
StructDecl,EnumDecl,VariableDecl, and maybe others by the time someone gets to this issue. A protocol would enable much more powerful generic programming to enable developers to create more flexible macros. Here's a rough idea of what such a protocol might look like (pretty simple for now);Once you've created the protocol, make sure to update existing declaration wrappers (including
Decl) to conform to the protocol. Additionally, ifDeclGroupProtocolexists by the time that someone is tackling this issue, it should be updated to inherit fromDeclProtocolas well.