1
1
mirror of https://github.com/github/semantic.git synced 2024-12-01 00:33:59 +03:00

We no longer need to evaluate these strictly.

This commit is contained in:
Rob Rix 2017-03-27 15:57:11 -04:00
parent fa68774cbd
commit e6b85848da

View File

@ -68,11 +68,7 @@ documentToTerm language document SourceBlob{..} = do
let childCount = fromIntegral (nodeChildCount node)
let allChildren = filter isNonEmpty <$> getChildren childCount ts_node_copy_child_nodes
-- Note: The strict application here is semantically important.
-- Without it, we may not evaluate the value until after weve exited
-- the scope that `node` was allocated within, meaning `alloca` will
-- free it & other stack data may overwrite it.
range `seq` sourceSpan `seq` assignTerm language source (range :. categoryForLanguageProductionName language (toS name) :. sourceSpan :. Nil) children allChildren
assignTerm language source (range :. categoryForLanguageProductionName language (toS name) :. sourceSpan :. Nil) children allChildren
isNonEmpty :: HasField fields Category => SyntaxTerm Text fields -> Bool
isNonEmpty = (/= Empty) . category . extract