mirror of
https://github.com/github/semantic.git
synced 2024-12-22 22:31:36 +03:00
Compute the child node’s range, not the parent’s.
This commit is contained in:
parent
5c17ab5149
commit
7cf8a7ddbb
@ -49,10 +49,10 @@ documentToTerm language document SourceBlob{..} = alloca $ \ root -> do
|
|||||||
name <- peekCString name
|
name <- peekCString name
|
||||||
count <- ts_node_p_named_child_count node
|
count <- ts_node_p_named_child_count node
|
||||||
|
|
||||||
let getChild getter node n out = do
|
let getChild getter parentNode n childNode = do
|
||||||
_ <- getter node n out
|
_ <- getter parentNode n childNode
|
||||||
let childRange = nodeRange node
|
let childRange = nodeRange childNode
|
||||||
toTerm out childRange (slice (offsetRange childRange (start range - start childRange)) source)
|
toTerm childNode childRange (slice (offsetRange childRange (start range - start childRange)) source)
|
||||||
|
|
||||||
children <- filter isNonEmpty <$> traverse (alloca . getChild ts_node_p_named_child node) (take (fromIntegral count) [0..])
|
children <- filter isNonEmpty <$> traverse (alloca . getChild ts_node_p_named_child node) (take (fromIntegral count) [0..])
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user