Remove most of the partial head and tail functions from src/ShellCheck/CFG.hs
This commit is contained in:
parent
025cc5266e
commit
67abfe159e
|
@ -615,15 +615,15 @@ build t = do
|
||||||
|
|
||||||
T_CaseExpression id t [] -> build t
|
T_CaseExpression id t [] -> build t
|
||||||
|
|
||||||
T_CaseExpression id t list -> do
|
T_CaseExpression id t list@(hd:tl) -> do
|
||||||
start <- newStructuralNode
|
start <- newStructuralNode
|
||||||
token <- build t
|
token <- build t
|
||||||
branches <- mapM buildBranch list
|
branches <- mapM buildBranch (hd NE.:| tl)
|
||||||
end <- newStructuralNode
|
end <- newStructuralNode
|
||||||
|
|
||||||
let neighbors = zip branches $ tail branches
|
let neighbors = zip (NE.toList branches) $ NE.tail branches
|
||||||
let (_, firstCond, _) = head branches
|
let (_, firstCond, _) = NE.head branches
|
||||||
let (_, lastCond, lastBody) = last branches
|
let (_, lastCond, lastBody) = NE.last branches
|
||||||
|
|
||||||
linkRange start token
|
linkRange start token
|
||||||
linkRange token firstCond
|
linkRange token firstCond
|
||||||
|
|
Loading…
Reference in New Issue