-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Apply minor changes to the syntactic sugar rewrite (#3915)
* Improve docstrings for `StringView+SwiftSyntax.swift` * Move changelog entry to correct section & reword * Change parameter type from `Int` to `ByteCount` * Move AbsolutePosition / ByteCount conversion to internal API * Only warn once if syntax tree cannot be parsed * Move Syntactic Sugar examples to a dedicated file * Change SyntacticSugarRuleVisitor from SyntaxAnyVisitor to SyntaxVisitor * Add `SugaredType` enum to help with the implement `SyntacticSugarRule`
- Loading branch information
Showing
7 changed files
with
214 additions
and
193 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
Source/SwiftLintFramework/Extensions/ByteCount+SwiftSyntax.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import SourceKittenFramework | ||
import SwiftSyntax | ||
|
||
extension ByteCount { | ||
/// Converts a SwiftSyntax `AbsolutePosition` to a SourceKitten `ByteCount`. | ||
/// | ||
/// - parameter position: The SwiftSyntax position to convert. | ||
init(_ position: AbsolutePosition) { | ||
self.init(position.utf8Offset) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.