Skip to content

Commit

Permalink
CR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
mildm8nnered committed Aug 27, 2023
1 parent d3d45c1 commit 940f17f
Showing 1 changed file with 9 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -205,20 +205,17 @@ private extension ExprSyntaxProtocol {
}

func isOperandOfBitwiseShiftOperation() -> Bool {
guard let siblings = parent?.as(ExprListSyntax.self)?.children(viewMode: .sourceAccurate) else {
guard
let siblings = parent?.as(ExprListSyntax.self)?.children(viewMode: .sourceAccurate),
siblings.count == 3
else {
return false
}
if siblings.count == 3 {
let index = siblings.index(after: siblings.startIndex)
if let tokenKind = siblings[index].as(BinaryOperatorExprSyntax.self)?.operatorToken.tokenKind {
if tokenKind == .binaryOperator("<<") || tokenKind == .binaryOperator(">>") {
let lastIndex = siblings.index(after: index)
let selfAsSyntax = self.as(Syntax.self)
if siblings[siblings.startIndex] == selfAsSyntax || siblings[lastIndex] == selfAsSyntax {
return true
}
}
}

let operatorIndex = siblings.index(after: siblings.startIndex)
if let tokenKind = siblings[operatorIndex].as(BinaryOperatorExprSyntax.self)?.operatorToken.tokenKind,
tokenKind == .binaryOperator("<<") || tokenKind == .binaryOperator(">>") {
return true
}

return false
Expand Down

0 comments on commit 940f17f

Please sign in to comment.