File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed
Sources/SwiftSyntaxMacroExpansion Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -132,21 +132,21 @@ private func expandFreestandingExpr(
132132/// Adds the appropriate indentation on expanded code even if it's multi line.
133133/// Makes sure original macro expression's trivia is maintained by adding it to expanded code.
134134private func adjustIndentationOfFreestandingMacro( expandedCode: String , node: some FreestandingMacroExpansionSyntax ) -> String {
135-
135+
136136 if expandedCode. isEmpty {
137137 return expandedCode. wrappingInTrivia ( from: node)
138138 }
139-
139+
140140 let indentationOfFirstLine = node. indentationOfFirstLine
141141 let indentLength = indentationOfFirstLine. sourceLength. utf8Length
142-
142+
143143 // we are doing 3 step adjustment here
144144 // step 1: add indentation to each line of expanded code
145145 // step 2: remove indentation from first line of expaned code
146146 // step 3: wrap the expanded code into macro expression's trivia. This trivia will contain appropriate existing
147147 // indentation. Note that if macro expression occurs in middle of the line then there will be no indentation or extra space.
148148 // Hence we are doing step 2
149-
149+
150150 var indentedSource = expandedCode. indented ( by: indentationOfFirstLine)
151151 indentedSource. removeFirst ( indentLength)
152152 indentedSource = indentedSource. wrappingInTrivia ( from: node)
You can’t perform that action at this time.
0 commit comments