Skip to content

Commit

Permalink
Fix false psitives for that were found because of tokens order
Browse files Browse the repository at this point in the history
  • Loading branch information
PaulTaykalo committed Oct 24, 2019
1 parent d40b7d9 commit 743abea
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions Source/SwiftLintFramework/Extensions/SyntaxMap+SwiftLint.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,17 @@ extension SyntaxMap {
return []
}

let intersectingTokens = tokens
func isAfterByteRange(_ token: SyntaxToken) -> Bool {
return token.offset < byteRange.upperBound
}

let tokensAfterFirstIntersection = tokens
.lazy
.suffix(from: startIndex)
.prefix(while: intersect)
return Array(intersectingTokens)
.prefix(while: isAfterByteRange)
.filter(intersect)

return Array(tokensAfterFirstIntersection)
}

// Index of first token which intersects byterange
Expand Down

0 comments on commit 743abea

Please sign in to comment.