mirror of
https://github.com/github/semantic.git
synced 2024-11-28 10:15:55 +03:00
Define a Visibilities type class
This commit is contained in:
parent
2676e124be
commit
3adaf47a4f
@ -59,6 +59,7 @@ library
|
|||||||
, Data.Abstract.Declarations
|
, Data.Abstract.Declarations
|
||||||
, Data.Abstract.Evaluatable
|
, Data.Abstract.Evaluatable
|
||||||
, Data.Abstract.FreeVariables
|
, Data.Abstract.FreeVariables
|
||||||
|
, Data.Abstract.Visibilities.Visibilities
|
||||||
, Data.Abstract.Heap
|
, Data.Abstract.Heap
|
||||||
, Data.Abstract.Live
|
, Data.Abstract.Live
|
||||||
, Data.Abstract.Module
|
, Data.Abstract.Module
|
||||||
|
18
src/Data/Abstract/Visibilities/Visibilities.hs
Normal file
18
src/Data/Abstract/Visibilities/Visibilities.hs
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
module Data.Abstract.Visibilities.Visibilities
|
||||||
|
( Visibilities (..)
|
||||||
|
, Visibilities1 (..)
|
||||||
|
) where
|
||||||
|
|
||||||
|
import Data.Abstract.ScopeGraph (Visibility(..))
|
||||||
|
|
||||||
|
class Visibilities syntax where
|
||||||
|
termToVisibility :: syntax -> Maybe Visibility
|
||||||
|
termToVisibility = const Nothing
|
||||||
|
|
||||||
|
class Visibilities1 syntax where
|
||||||
|
-- | Lift a function mapping a Visibility syntax to its related Relation.
|
||||||
|
-- This can be used to find the Relation of a component syntax whose Visibility may be contained within a subterm.
|
||||||
|
--
|
||||||
|
-- Note that not all syntax will have contain Visibility syntax; in general it’s reserved for syntax where visibility is necessary for correctly resolving lookups of declarations (e.g. Method, PublicField, and other members whose containing syntax (i.e. Class, Module, etc.) can restrict visibility to external members).
|
||||||
|
liftTermToVisibility :: (a -> Maybe Visibility) -> syntax a -> Maybe Visibility
|
||||||
|
liftTermToVisibility _ _ = Nothing
|
Loading…
Reference in New Issue
Block a user