1
1
mirror of https://github.com/github/semantic.git synced 2024-12-22 14:21:31 +03:00

Compute the child node’s range, not the parent’s.

This commit is contained in:
Rob Rix 2017-02-13 12:28:05 -05:00
parent 5c17ab5149
commit 7cf8a7ddbb

View File

@ -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..])