1
1
mirror of https://github.com/github/semantic.git synced 2024-12-21 05:41:54 +03:00

Don’t pass the blob into runTagging.

This commit is contained in:
Rob Rix 2019-10-01 11:54:38 -04:00
parent de5de5f936
commit 937df795a1
No known key found for this signature in database
GPG Key ID: F188A01508EA1CF7
2 changed files with 8 additions and 7 deletions

View File

@ -44,7 +44,7 @@ legacyParseSymbols blobs = Legacy.ParseTreeSymbolResponse <$> distributeFoldMap
symbolsToSummarize = ["Function", "Method", "Class", "Module"]
renderToSymbols :: (IsTaggable f, Applicative m) => Term f Loc -> m [Legacy.File]
renderToSymbols = pure . pure . tagsToFile . runTagging blob symbolsToSummarize
renderToSymbols = pure . pure . tagsToFile . runTagging (blobLanguage blob) blobSource symbolsToSummarize
tagsToFile :: [Tag] -> Legacy.File
tagsToFile tags = Legacy.File (pack (blobPath blob)) (pack (show (blobLanguage blob))) (fmap tagToSymbol tags)
@ -79,7 +79,7 @@ parseSymbols blobs = do
errorFile e = File blobPath' (bridging # blobLanguage') mempty (V.fromList [ParseError (T.pack e)]) blobOid
renderToSymbols :: IsTaggable f => Term f Loc -> File
renderToSymbols term = tagsToFile (runTagging blob symbolsToSummarize term)
renderToSymbols term = tagsToFile (runTagging (blobLanguage blob) blobSource symbolsToSummarize term)
renderPreciseToSymbols :: Py.Term Loc -> File
renderPreciseToSymbols term = tagsToFile (Precise.tags blobSource term)

View File

@ -14,7 +14,7 @@ import Data.Text as T hiding (empty)
import Streaming
import qualified Streaming.Prelude as Streaming
import Data.Blob
import Data.Language
import Data.Term
import Source.Loc
import qualified Source.Source as Source
@ -22,16 +22,17 @@ import Tags.Tag
import Tags.Taggable
runTagging :: (IsTaggable syntax)
=> Blob
=> Language
-> Source.Source
-> [Text]
-> Term syntax Loc
-> [Tag]
runTagging blob symbolsToSummarize
runTagging lang source symbolsToSummarize
= Eff.run
. evalState @[ContextToken] []
. Streaming.toList_
. contextualizing (blobSource blob) toKind
. tagging (blobLanguage blob)
. contextualizing source toKind
. tagging lang
where
toKind x = do
guard (x `elem` symbolsToSummarize)