mirror of
https://github.com/github/semantic.git
synced 2024-12-22 22:31:36 +03:00
Close over the right source.
This commit is contained in:
parent
00c14e403a
commit
f8cc3b8933
@ -62,11 +62,11 @@ documentToTerm language document SourceBlob{..} = alloca $ \ root -> do
|
|||||||
-- the scope that `node` was allocated within, meaning `alloca` will
|
-- the scope that `node` was allocated within, meaning `alloca` will
|
||||||
-- free it & other stack data may overwrite it.
|
-- free it & other stack data may overwrite it.
|
||||||
range `seq` sourceSpan `seq` assignTerm language source (range :. categoryForLanguageProductionName language (toS name) :. sourceSpan :. Nil) children allChildren
|
range `seq` sourceSpan `seq` assignTerm language source (range :. categoryForLanguageProductionName language (toS name) :. sourceSpan :. Nil) children allChildren
|
||||||
getChild getter start node n out = do
|
where getChild getter node n out = do
|
||||||
_ <- getter node n out
|
_ <- getter node n out
|
||||||
let childRange = nodeRange node
|
let childRange = nodeRange node
|
||||||
toTerm out childRange (slice (offsetRange childRange (negate start)) source)
|
toTerm out childRange (slice childRange source)
|
||||||
{-# INLINE getChild #-}
|
{-# INLINE getChild #-}
|
||||||
isNonEmpty child = category (extract child) /= Empty
|
isNonEmpty child = category (extract child) /= Empty
|
||||||
|
|
||||||
nodeRange node = Range { start = fromIntegral $ ts_node_p_start_char node, end = fromIntegral $ ts_node_p_end_char node }
|
nodeRange node = Range { start = fromIntegral $ ts_node_p_start_char node, end = fromIntegral $ ts_node_p_end_char node }
|
||||||
|
Loading…
Reference in New Issue
Block a user