mirror of
https://github.com/github/semantic.git
synced 2024-12-22 22:31:36 +03:00
Module def has it's own analysis now
This commit is contained in:
parent
184d25bccc
commit
479606fb35
@ -34,7 +34,6 @@ data Declaration
|
||||
| FunctionDeclaration { declarationIdentifier :: T.Text, declarationText :: T.Text, declarationLanguage :: Maybe Language }
|
||||
| HeadingDeclaration { declarationIdentifier :: T.Text, declarationText :: T.Text, declarationLanguage :: Maybe Language, declarationLevel :: Int }
|
||||
| CallReference { declarationIdentifier :: T.Text, declarationImportIdentifier :: Maybe T.Text }
|
||||
| ModuleDeclaration { declarationIdentifier :: T.Text }
|
||||
| ErrorDeclaration { declarationIdentifier :: T.Text, declarationText :: T.Text, declarationLanguage :: Maybe Language }
|
||||
deriving (Eq, Generic, Show)
|
||||
|
||||
@ -131,11 +130,6 @@ instance CustomHasDeclaration Expression.Call where
|
||||
| otherwise = Just $ CallReference (getSource fromAnn) Nothing
|
||||
where getSource = toText . flip Source.slice blobSource . getField
|
||||
|
||||
instance CustomHasDeclaration Declaration.Module where
|
||||
customToDeclaration Blob{..} _ (Declaration.Module (Term (In fromAnn _), _) _)
|
||||
= Just $ ModuleDeclaration (getSource fromAnn)
|
||||
where getSource = toText . flip Source.slice blobSource . getField
|
||||
|
||||
-- | Produce a 'Declaration' for 'Union's using the 'HasDeclaration' instance & therefore using a 'CustomHasDeclaration' instance when one exists & the type is listed in 'DeclarationStrategy'.
|
||||
instance Apply HasDeclaration fs => CustomHasDeclaration (Union fs) where
|
||||
customToDeclaration blob ann = apply (Proxy :: Proxy HasDeclaration) (toDeclaration blob ann)
|
||||
@ -163,7 +157,6 @@ type family DeclarationStrategy syntax where
|
||||
DeclarationStrategy Declaration.Method = 'Custom
|
||||
DeclarationStrategy Markdown.Heading = 'Custom
|
||||
DeclarationStrategy Expression.Call = 'Custom
|
||||
DeclarationStrategy Declaration.Module = 'Custom
|
||||
DeclarationStrategy Syntax.Error = 'Custom
|
||||
DeclarationStrategy (Union fs) = 'Custom
|
||||
DeclarationStrategy a = 'Default
|
||||
|
@ -171,7 +171,6 @@ diffTOC = mapMaybe entrySummary . dedupe . filter extraDeclarations . tableOfCon
|
||||
extraDeclarations :: HasField fields (Maybe Declaration) => Entry (Record fields) -> Bool
|
||||
extraDeclarations entry = case getDeclaration (entryPayload entry) of
|
||||
Just ImportDeclaration{..} -> False
|
||||
Just ModuleDeclaration{..} -> False
|
||||
Just CallReference{..} -> False
|
||||
_ -> True
|
||||
|
||||
@ -192,6 +191,5 @@ toCategoryName declaration = case declaration of
|
||||
FunctionDeclaration{} -> "Function"
|
||||
MethodDeclaration{} -> "Method"
|
||||
CallReference{} -> "Call"
|
||||
ModuleDeclaration{} -> "Module"
|
||||
HeadingDeclaration _ _ _ l -> "Heading " <> T.pack (show l)
|
||||
ErrorDeclaration{} -> "ParseError"
|
||||
|
Loading…
Reference in New Issue
Block a user