Skip to content

Commit c247510

Browse files
authored
Merge pull request #2392 from DougGregor/body-macro-comment-fix
Fix comment on expandBodyMacro
2 parents ab4b2bd + 4446b03 commit c247510

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

Sources/SwiftSyntaxMacroExpansion/MacroSystem.swift

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ private func expandAccessorMacroWithoutExistingAccessors(
275275

276276
// `expandAttachedMacro` adds the `{` and `}` to wrap the accessor block and
277277
// then indents it.
278-
// Remove any indentaiton from the first line using `drop(while:)` and then
278+
// Remove any indentation from the first line using `drop(while:)` and then
279279
// prepend a space to separate it from the variable declaration
280280
let indentedSource = " " + expanded.indented(by: attachedTo.indentationOfFirstLine).drop(while: { $0.isWhitespace })
281281
return "\(raw: indentedSource)"
@@ -409,10 +409,11 @@ private func expandBodyMacro(
409409
return nil
410410
}
411411

412-
// `expandAttachedMacro` adds the `{` and `}` to wrap the accessor block and
413-
// then indents it.
414-
// Remove any indentaiton from the first line using `drop(while:)` and then
415-
// prepend a space to separate it from the variable declaration
412+
// `expandAttachedMacro` adds the `{` and `}` to wrap the body and then
413+
// indents it.
414+
// Remove any indentation from the first line using `drop(while:)` and then
415+
// prepend a space when it's being introduced on a declaration that has no
416+
// body yet.
416417
let leadingWhitespace = decl.body == nil ? " " : ""
417418
let indentedSource = leadingWhitespace + expanded.indented(by: decl.indentationOfFirstLine).drop(while: { $0.isWhitespace })
418419
return "\(raw: indentedSource)"

0 commit comments

Comments
 (0)