Skip to content

Commit

Permalink
Remove most of the partial head and tail functions from src/ShellChec…
Browse files Browse the repository at this point in the history
…k/CFG.hs
  • Loading branch information
josephcsible committed Jan 2, 2024
1 parent 025cc52 commit 67abfe1
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/ShellCheck/CFG.hs
Original file line number Diff line number Diff line change
Expand Up @@ -615,15 +615,15 @@ build t = do

T_CaseExpression id t [] -> build t

T_CaseExpression id t list -> do
T_CaseExpression id t list@(hd:tl) -> do
start <- newStructuralNode
token <- build t
branches <- mapM buildBranch list
branches <- mapM buildBranch (hd NE.:| tl)
end <- newStructuralNode

let neighbors = zip branches $ tail branches
let (_, firstCond, _) = head branches
let (_, lastCond, lastBody) = last branches
let neighbors = zip (NE.toList branches) $ NE.tail branches
let (_, firstCond, _) = NE.head branches
let (_, lastCond, lastBody) = NE.last branches

linkRange start token
linkRange token firstCond
Expand Down

0 comments on commit 67abfe1

Please sign in to comment.