mirror of
https://github.com/github/semantic.git
synced 2024-12-23 23:11:50 +03:00
🔥 the language field for no lang exceptions.
This commit is contained in:
parent
e41da0fed4
commit
f2a29b35f3
@ -24,7 +24,6 @@ import Data.Syntax.Algebra
|
|||||||
import Data.Term
|
import Data.Term
|
||||||
import Data.Typeable
|
import Data.Typeable
|
||||||
import Interpreter
|
import Interpreter
|
||||||
import qualified Language
|
|
||||||
import Parser
|
import Parser
|
||||||
import Renderer
|
import Renderer
|
||||||
import Semantic.Task as Task
|
import Semantic.Task as Task
|
||||||
@ -61,9 +60,9 @@ parseBlob renderer blob@Blob{..} = case (renderer, blobLanguage) of
|
|||||||
| Just (SomeParser parser) <- someParser (Proxy :: Proxy '[HasDeclaration, Foldable, Functor]) <$> lang ->
|
| Just (SomeParser parser) <- someParser (Proxy :: Proxy '[HasDeclaration, Foldable, Functor]) <$> lang ->
|
||||||
parse parser blob >>= decorate (declarationAlgebra blob) >>= render (renderToTags blob)
|
parse parser blob >>= decorate (declarationAlgebra blob) >>= render (renderToTags blob)
|
||||||
|
|
||||||
_ -> throwError (SomeException (NoLanguageForBlob blobPath blobLanguage))
|
_ -> throwError (SomeException (NoLanguageForBlob blobPath))
|
||||||
|
|
||||||
data NoLanguageForBlob = NoLanguageForBlob FilePath (Maybe Language.Language)
|
data NoLanguageForBlob = NoLanguageForBlob FilePath
|
||||||
deriving (Eq, Exception, Ord, Show, Typeable)
|
deriving (Eq, Exception, Ord, Show, Typeable)
|
||||||
|
|
||||||
|
|
||||||
@ -89,7 +88,7 @@ diffBlobPair renderer blobs = case (renderer, effectiveLanguage) of
|
|||||||
| Just (SomeParser parser) <- someParser (Proxy :: Proxy '[ConstructorName, Diffable, Eq1, Foldable, Functor, GAlign, Show1, Traversable]) <$> lang ->
|
| Just (SomeParser parser) <- someParser (Proxy :: Proxy '[ConstructorName, Diffable, Eq1, Foldable, Functor, GAlign, Show1, Traversable]) <$> lang ->
|
||||||
run (decorate constructorLabel . (Nil <$) <=< parse parser) diffTerms renderSExpressionDiff
|
run (decorate constructorLabel . (Nil <$) <=< parse parser) diffTerms renderSExpressionDiff
|
||||||
|
|
||||||
_ -> throwError (SomeException (NoLanguageForBlob effectivePath effectiveLanguage))
|
_ -> throwError (SomeException (NoLanguageForBlob effectivePath))
|
||||||
where (effectivePath, effectiveLanguage) = case runJoin blobs of
|
where (effectivePath, effectiveLanguage) = case runJoin blobs of
|
||||||
(Blob { blobLanguage = Just lang, blobPath = path }, _) -> (path, Just lang)
|
(Blob { blobLanguage = Just lang, blobPath = path }, _) -> (path, Just lang)
|
||||||
(_, Blob { blobLanguage = Just lang, blobPath = path }) -> (path, Just lang)
|
(_, Blob { blobLanguage = Just lang, blobPath = path }) -> (path, Just lang)
|
||||||
|
Loading…
Reference in New Issue
Block a user