mirror of
https://github.com/github/semantic.git
synced 2024-12-22 06:11:49 +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
|
||||
count <- ts_node_p_named_child_count node
|
||||
|
||||
let getChild getter node n out = do
|
||||
_ <- getter node n out
|
||||
let childRange = nodeRange node
|
||||
toTerm out childRange (slice (offsetRange childRange (start range - start childRange)) source)
|
||||
let getChild getter parentNode n childNode = do
|
||||
_ <- getter parentNode n childNode
|
||||
let childRange = nodeRange childNode
|
||||
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..])
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user