mirror of
https://github.com/github/semantic.git
synced 2024-12-21 13:51:44 +03:00
Combine the code paths.
This commit is contained in:
parent
44b0614c7d
commit
7259059b51
@ -69,19 +69,16 @@ parseSymbols blobs = do
|
|||||||
go modes blob@Blob{..}
|
go modes blob@Blob{..}
|
||||||
| Precise <- pythonMode modes
|
| Precise <- pythonMode modes
|
||||||
, Python <- blobLanguage'
|
, Python <- blobLanguage'
|
||||||
= catching $ renderPreciseToSymbols <$> parse precisePythonParser blob
|
= catching $ renderToSymbols <$> parse precisePythonParser blob
|
||||||
| otherwise = catching $ withSomeTerm renderToSymbols <$> doParse blob
|
| otherwise = catching $ withSomeTerm (renderToSymbols . ALaCarteTerm (blobLanguage blob)) <$> doParse blob
|
||||||
where
|
where
|
||||||
catching m = m `catchError` (\(SomeException e) -> pure $ errorFile (show e))
|
catching m = m `catchError` (\(SomeException e) -> pure $ errorFile (show e))
|
||||||
blobLanguage' = blobLanguage blob
|
blobLanguage' = blobLanguage blob
|
||||||
blobPath' = pack $ blobPath blob
|
blobPath' = pack $ blobPath blob
|
||||||
errorFile e = File blobPath' (bridging # blobLanguage') mempty (V.fromList [ParseError (T.pack e)]) blobOid
|
errorFile e = File blobPath' (bridging # blobLanguage') mempty (V.fromList [ParseError (T.pack e)]) blobOid
|
||||||
|
|
||||||
renderToSymbols :: IsTaggable f => Term f Loc -> File
|
renderToSymbols :: Precise.ToTags t => t Loc -> File
|
||||||
renderToSymbols term = renderPreciseToSymbols (ALaCarteTerm (blobLanguage blob) term)
|
renderToSymbols term = tagsToFile (Precise.tags blobSource term)
|
||||||
|
|
||||||
renderPreciseToSymbols :: Precise.ToTags t => t Loc -> File
|
|
||||||
renderPreciseToSymbols term = tagsToFile (Precise.tags blobSource term)
|
|
||||||
|
|
||||||
tagsToFile :: [Tag] -> File
|
tagsToFile :: [Tag] -> File
|
||||||
tagsToFile tags = File blobPath' (bridging # blobLanguage') (V.fromList (fmap tagToSymbol tags)) mempty blobOid
|
tagsToFile tags = File blobPath' (bridging # blobLanguage') (V.fromList (fmap tagToSymbol tags)) mempty blobOid
|
||||||
|
Loading…
Reference in New Issue
Block a user