mirror of
https://github.com/koalaman/shellcheck
synced 2025-07-16 10:03:08 -07:00
Make getPath return a NonEmpty
This commit is contained in:
parent
e1ad063834
commit
add49cda17
4 changed files with 40 additions and 38 deletions
|
@ -31,6 +31,7 @@ import Data.Functor
|
|||
import Data.Functor.Identity
|
||||
import Data.List
|
||||
import Data.Maybe
|
||||
import qualified Data.List.NonEmpty as NE
|
||||
import qualified Data.Map as Map
|
||||
import Numeric (showHex)
|
||||
|
||||
|
@ -897,9 +898,7 @@ getUnmodifiedParameterExpansion t =
|
|||
_ -> Nothing
|
||||
|
||||
--- A list of the element and all its parents up to the root node.
|
||||
getPath tree t = t : unfoldr go t
|
||||
where
|
||||
go s = (\x -> (x,x)) <$> Map.lookup (getId s) tree
|
||||
getPath tree = NE.unfoldr $ \t -> (t, Map.lookup (getId t) tree)
|
||||
|
||||
isClosingFileOp op =
|
||||
case op of
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue