@@ -608,3 +608,121 @@ struct UnTagged: PeerMacro {
608608 )
609609 }
610610}
611+
612+ /// A declaration macro that generates `Decodable`
613+ /// protocol conformance.
614+ ///
615+ /// This implementation will delegate to the plugin core
616+ /// implementation depending on the type of attached declaration:
617+ /// * `struct`/`class`/`enum`/`actor` types: Expansion of `Decodable`
618+ /// protocol conformance members.
619+ public struct ConformDecodable : MemberMacro , ExtensionMacro {
620+ /// Expand to produce members for `Decodable`.
621+ ///
622+ /// Membership macro expansion for `ConformDecodable` macro
623+ /// will delegate to `PluginCore.ConformDecodable`.
624+ ///
625+ /// - Parameters:
626+ /// - node: The custom attribute describing this attached macro.
627+ /// - declaration: The declaration this macro attribute is attached to.
628+ /// - context: The context in which to perform the macro expansion.
629+ ///
630+ /// - Returns: Delegated member expansion from `PluginCore.ConformDecodable`.
631+ public static func expansion(
632+ of node: AttributeSyntax ,
633+ providingMembersOf declaration: some DeclGroupSyntax ,
634+ in context: some MacroExpansionContext
635+ ) throws -> [ DeclSyntax ] {
636+ return try PluginCore . ConformDecodable. expansion (
637+ of: node, providingMembersOf: declaration, in: context
638+ )
639+ }
640+
641+ /// Expand to produce extensions for `Decodable`.
642+ ///
643+ /// Extension macro expansion for `ConformDecodable` macro
644+ /// will delegate to `PluginCore.ConformDecodable`.
645+ ///
646+ /// - Parameters:
647+ /// - node: The custom attribute describing this attached macro.
648+ /// - declaration: The declaration this macro attribute is attached to.
649+ /// - type: The type to provide extensions of.
650+ /// - protocols: The list of protocols to add conformances to. These will
651+ /// always be protocols that `type` does not already state a conformance
652+ /// to.
653+ /// - context: The context in which to perform the macro expansion.
654+ ///
655+ /// - Returns: Delegated extension expansion from `PluginCore.ConformDecodable`.
656+ public static func expansion(
657+ of node: AttributeSyntax ,
658+ attachedTo declaration: some DeclGroupSyntax ,
659+ providingExtensionsOf type: some TypeSyntaxProtocol ,
660+ conformingTo protocols: [ TypeSyntax ] ,
661+ in context: some MacroExpansionContext
662+ ) throws -> [ ExtensionDeclSyntax ] {
663+ return try PluginCore . ConformDecodable. expansion (
664+ of: node, attachedTo: declaration,
665+ providingExtensionsOf: type, conformingTo: protocols,
666+ in: context
667+ )
668+ }
669+ }
670+
671+ /// A declaration macro that generates `Encodable`
672+ /// protocol conformance.
673+ ///
674+ /// This implementation will delegate to the plugin core
675+ /// implementation depending on the type of attached declaration:
676+ /// * `struct`/`class`/`enum`/`actor` types: Expansion of `Encodable`
677+ /// protocol conformance members.
678+ public struct ConformEncodable : MemberMacro , ExtensionMacro {
679+ /// Expand to produce members for `Encodable`.
680+ ///
681+ /// Membership macro expansion for `ConformEncodable` macro
682+ /// will delegate to `PluginCore.ConformEncodable`.
683+ ///
684+ /// - Parameters:
685+ /// - node: The custom attribute describing this attached macro.
686+ /// - declaration: The declaration this macro attribute is attached to.
687+ /// - context: The context in which to perform the macro expansion.
688+ ///
689+ /// - Returns: Delegated member expansion from `PluginCore.ConformEncodable`.
690+ public static func expansion(
691+ of node: AttributeSyntax ,
692+ providingMembersOf declaration: some DeclGroupSyntax ,
693+ in context: some MacroExpansionContext
694+ ) throws -> [ DeclSyntax ] {
695+ return try PluginCore . ConformEncodable. expansion (
696+ of: node, providingMembersOf: declaration, in: context
697+ )
698+ }
699+
700+ /// Expand to produce extensions for `Encodable`.
701+ ///
702+ /// Extension macro expansion for `ConformEncodable` macro
703+ /// will delegate to `PluginCore.ConformEncodable`.
704+ ///
705+ /// - Parameters:
706+ /// - node: The custom attribute describing this attached macro.
707+ /// - declaration: The declaration this macro attribute is attached to.
708+ /// - type: The type to provide extensions of.
709+ /// - protocols: The list of protocols to add conformances to. These will
710+ /// always be protocols that `type` does not already state a conformance
711+ /// to.
712+ /// - context: The context in which to perform the macro expansion.
713+ ///
714+ /// - Returns: Delegated extension expansion from `PluginCore.ConformEncodable`.
715+ public static func expansion(
716+ of node: AttributeSyntax ,
717+ attachedTo declaration: some DeclGroupSyntax ,
718+ providingExtensionsOf type: some TypeSyntaxProtocol ,
719+ conformingTo protocols: [ TypeSyntax ] ,
720+ in context: some MacroExpansionContext
721+ ) throws -> [ ExtensionDeclSyntax ] {
722+ return try PluginCore . ConformEncodable. expansion (
723+ of: node, attachedTo: declaration,
724+ providingExtensionsOf: type, conformingTo: protocols,
725+ in: context
726+ )
727+ }
728+ }
0 commit comments