1
1
mirror of https://github.com/github/semantic.git synced 2024-12-22 06:11:49 +03:00

Pack node names explicitly.

This commit is contained in:
Rob Rix 2017-07-28 13:57:58 -04:00
parent 72282f15a7
commit ce8f7d4903

View File

@ -15,6 +15,7 @@ import Data.Record
import Data.Source
import Data.Span
import qualified Data.Syntax.Assignment as A
import Data.Text (Text, pack)
import Language
import qualified Language.Go as Go
import qualified Language.TypeScript as TS
@ -82,7 +83,7 @@ documentToTerm language document Blob{..} = do
let allChildren = getChildren (fromIntegral (nodeChildCount node)) copyAll
let source = slice (nodeRange node) blobSource
assignTerm language source (range :. categoryForLanguageProductionName language (toS name) :. nodeSpan node :. Nil) children allChildren
assignTerm language source (range :. categoryForLanguageProductionName language (pack name) :. nodeSpan node :. Nil) children allChildren
where getChildren count copy = do
nodes <- allocaArray count $ \ childNodesPtr -> do
_ <- with (nodeTSNode node) (\ nodePtr -> copy nodePtr childNodesPtr (fromIntegral count))