Skip to content

Commit 92e77ef

Browse files
authored
Merge pull request swiftlang#210 from chiragramani/fix_readme_example
Fix Readme Example
2 parents 861a8a6 + fd9da8c commit 92e77ef

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

README.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ class AddOneToIntegerLiterals: SyntaxRewriter {
181181
override func visit(_ token: TokenSyntax) -> Syntax {
182182
// Only transform integer literals.
183183
guard case .integerLiteral(let text) = token.tokenKind else {
184-
return token
184+
return Syntax(token)
185185
}
186186

187187
// Remove underscores from the original text.
@@ -190,8 +190,11 @@ class AddOneToIntegerLiterals: SyntaxRewriter {
190190
// Parse out the integer.
191191
let int = Int(integerText)!
192192

193-
// Return a new integer literal token with `int + 1` as its text.
194-
return token.withKind(.integerLiteral("\(int + 1)"))
193+
// Create a new integer literal token with `int + 1` as its text.
194+
let newIntegerLiteralToken = token.withKind(.integerLiteral("\(int + 1)"))
195+
196+
// Return the new integer literal.
197+
return Syntax(newIntegerLiteralToken)
195198
}
196199
}
197200

0 commit comments

Comments
 (0)