1
1
mirror of https://github.com/github/semantic.git synced 2024-12-21 22:01:46 +03:00

No need to add a CustomHasDeclaration instance for Send

This commit is contained in:
joshvera 2018-04-09 13:03:10 -04:00
parent 93fcc60b86
commit 341954f0e4

View File

@ -138,14 +138,6 @@ instance (Syntax.Identifier :< fs, Expression.MemberAccess :< fs) => CustomHasDe
| otherwise = [getSource modAnn]
getSource = toText . flip Source.slice blobSource . getField
instance CustomHasDeclaration (Union fs) Ruby.Syntax.Send where
customToDeclaration Blob{..} _ (Ruby.Syntax.Send _ selector _ _) =
Just $ CallReference selectorText [] -- TODO what is this list supposed to represent?
where
(Term (In selectorAnn _), _) = selector
getSource = toText . flip Source.slice blobSource . getField
selectorText = getSource selectorAnn
-- | 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' whole) fs => CustomHasDeclaration whole (Union fs) where
customToDeclaration blob ann = apply (Proxy :: Proxy (HasDeclaration' whole)) (toDeclaration' blob ann)
@ -168,7 +160,6 @@ class HasDeclarationWithStrategy (strategy :: Strategy) whole syntax where
-- If youre seeing errors about missing a 'CustomHasDeclaration' instance for a given type, youve probably listed it in here but not defined a 'CustomHasDeclaration' instance for it, or else youve listed the wrong type in here. Conversely, if your 'customHasDeclaration' method is never being called, you may have forgotten to list the type in here.
type family DeclarationStrategy syntax where
DeclarationStrategy Declaration.Class = 'Custom
DeclarationStrategy Ruby.Syntax.Send = 'Custom
DeclarationStrategy Ruby.Syntax.Class = 'Custom
DeclarationStrategy Declaration.Function = 'Custom
DeclarationStrategy Declaration.Method = 'Custom