mirror of
https://github.com/koalaman/shellcheck.git
synced 2025-08-08 20:51:56 +08:00
Implement getPath in terms of unfoldr
This commit is contained in:
@@ -897,10 +897,9 @@ getUnmodifiedParameterExpansion t =
|
|||||||
_ -> Nothing
|
_ -> Nothing
|
||||||
|
|
||||||
--- A list of the element and all its parents up to the root node.
|
--- A list of the element and all its parents up to the root node.
|
||||||
getPath tree t = t :
|
getPath tree t = t : unfoldr go t
|
||||||
case Map.lookup (getId t) tree of
|
where
|
||||||
Nothing -> []
|
go s = (\x -> (x,x)) <$> Map.lookup (getId s) tree
|
||||||
Just parent -> getPath tree parent
|
|
||||||
|
|
||||||
isClosingFileOp op =
|
isClosingFileOp op =
|
||||||
case op of
|
case op of
|
||||||
|
Reference in New Issue
Block a user