@@ -35,26 +35,6 @@ public struct TypeAlias: CodeBlock, Sendable {
3535 private let existingType : String
3636 private var attributes : [ AttributeInfo ] = [ ]
3737
38- /// Creates a `typealias` declaration.
39- /// - Parameters:
40- /// - name: The new name that will alias the existing type.
41- /// - type: The existing type that is being aliased.
42- public init ( _ name: String , equals type: String ) {
43- self . name = name
44- self . existingType = type
45- }
46-
47- /// Adds an attribute to the typealias declaration.
48- /// - Parameters:
49- /// - attribute: The attribute name (without the @ symbol).
50- /// - arguments: The arguments for the attribute, if any.
51- /// - Returns: A copy of the typealias with the attribute added.
52- public func attribute( _ attribute: String , arguments: [ String ] = [ ] ) -> Self {
53- var copy = self
54- copy. attributes. append ( AttributeInfo ( name: attribute, arguments: arguments) )
55- return copy
56- }
57-
5838 public var syntax : any SyntaxProtocol {
5939 // `typealias` keyword token
6040 let keyword = TokenSyntax . keyword ( . typealias, trailingTrivia: . space)
@@ -76,6 +56,26 @@ public struct TypeAlias: CodeBlock, Sendable {
7656 )
7757 }
7858
59+ /// Creates a `typealias` declaration.
60+ /// - Parameters:
61+ /// - name: The new name that will alias the existing type.
62+ /// - type: The existing type that is being aliased.
63+ public init ( _ name: String , equals type: String ) {
64+ self . name = name
65+ self . existingType = type
66+ }
67+
68+ /// Adds an attribute to the typealias declaration.
69+ /// - Parameters:
70+ /// - attribute: The attribute name (without the @ symbol).
71+ /// - arguments: The arguments for the attribute, if any.
72+ /// - Returns: A copy of the typealias with the attribute added.
73+ public func attribute( _ attribute: String , arguments: [ String ] = [ ] ) -> Self {
74+ var copy = self
75+ copy. attributes. append ( AttributeInfo ( name: attribute, arguments: arguments) )
76+ return copy
77+ }
78+
7979 private func buildAttributeList( from attributes: [ AttributeInfo ] ) -> AttributeListSyntax {
8080 if attributes. isEmpty {
8181 return AttributeListSyntax ( [ ] )
0 commit comments