1
1
mirror of https://github.com/github/semantic.git synced 2024-12-29 18:06:14 +03:00

🔥 Data.Name.

This commit is contained in:
Patrick Thomson 2020-01-17 11:01:59 -05:00
parent 14c68c407d
commit 7dacb55e35
9 changed files with 12 additions and 17 deletions

View File

@ -21,11 +21,11 @@ module Language.Python.ScopeGraph
( scopeGraphModule ( scopeGraphModule
) where ) where
import Analysis.Name
import Control.Algebra (Algebra (..), handleCoercible) import Control.Algebra (Algebra (..), handleCoercible)
import Control.Effect.Sketch import Control.Effect.Sketch
import Data.Foldable import Data.Foldable
import Data.Monoid import Data.Monoid
import Data.Name
import GHC.Generics import GHC.Generics
import GHC.Records import GHC.Records
import GHC.TypeLits import GHC.TypeLits

View File

@ -6,11 +6,11 @@
{-# OPTIONS_GHC -Wno-incomplete-uni-patterns #-} {-# OPTIONS_GHC -Wno-incomplete-uni-patterns #-}
module Main (main) where module Main (main) where
import Analysis.Name (Name)
import Control.Algebra import Control.Algebra
import Control.Carrier.Sketch.Fresh import Control.Carrier.Sketch.Fresh
import Control.Monad import Control.Monad
import qualified Data.ByteString as ByteString import qualified Data.ByteString as ByteString
import Data.Name (Name)
import qualified Data.ScopeGraph as ScopeGraph import qualified Data.ScopeGraph as ScopeGraph
import qualified Language.Python () import qualified Language.Python ()
import qualified Language.Python as Py (Term) import qualified Language.Python as Py (Term)

View File

@ -25,7 +25,6 @@ library
ScopeGraph.Convert ScopeGraph.Convert
Data.Hole Data.Hole
Data.Module Data.Module
Data.Name
Data.ScopeGraph Data.ScopeGraph
build-depends: build-depends:
base >= 4.13 && < 5 base >= 4.13 && < 5

View File

@ -18,6 +18,8 @@ module Control.Carrier.Sketch.Fresh
, module Control.Effect.Sketch , module Control.Effect.Sketch
) where ) where
import Analysis.Name (Name)
import qualified Analysis.Name
import Control.Algebra import Control.Algebra
import Control.Carrier.Fresh.Strict import Control.Carrier.Fresh.Strict
import Control.Carrier.State.Strict import Control.Carrier.State.Strict
@ -25,8 +27,6 @@ import Control.Effect.Sketch
import Control.Monad.IO.Class import Control.Monad.IO.Class
import Data.Bifunctor import Data.Bifunctor
import Data.Module import Data.Module
import Data.Name (Name)
import qualified Data.Name
import Data.ScopeGraph (ScopeGraph) import Data.ScopeGraph (ScopeGraph)
import qualified Data.ScopeGraph as ScopeGraph import qualified Data.ScopeGraph as ScopeGraph
import Data.Semilattice.Lower import Data.Semilattice.Lower
@ -43,7 +43,7 @@ instance Lower (Sketchbook Name) where
let let
initialGraph = ScopeGraph.insertScope n initialScope lowerBound initialGraph = ScopeGraph.insertScope n initialScope lowerBound
initialScope = ScopeGraph.Scope mempty mempty mempty initialScope = ScopeGraph.Scope mempty mempty mempty
n = Data.Name.nameI 0 n = Analysis.Name.nameI 0
in in
Sketchbook initialGraph n Sketchbook initialGraph n
@ -55,7 +55,7 @@ instance (Effect sig, Algebra sig m) => Algebra (Sketch Name :+: sig) (SketchC N
Sketchbook old current <- SketchC (get @(Sketchbook Name)) Sketchbook old current <- SketchC (get @(Sketchbook Name))
let (new, _pos) = let (new, _pos) =
ScopeGraph.declare ScopeGraph.declare
(ScopeGraph.Declaration (Data.Name.name n)) (ScopeGraph.Declaration (Analysis.Name.name n))
(lowerBound @ModuleInfo) (lowerBound @ModuleInfo)
ScopeGraph.Default ScopeGraph.Default
ScopeGraph.Public ScopeGraph.Public
@ -70,11 +70,11 @@ instance (Effect sig, Algebra sig m) => Algebra (Sketch Name :+: sig) (SketchC N
Sketchbook old current <- SketchC (get @(Sketchbook Name)) Sketchbook old current <- SketchC (get @(Sketchbook Name))
let new = let new =
ScopeGraph.reference ScopeGraph.reference
(ScopeGraph.Reference (Data.Name.name n)) (ScopeGraph.Reference (Analysis.Name.name n))
(lowerBound @ModuleInfo) (lowerBound @ModuleInfo)
(lowerBound @Span) (lowerBound @Span)
ScopeGraph.Identifier ScopeGraph.Identifier
(ScopeGraph.Declaration (Data.Name.name decl)) (ScopeGraph.Declaration (Analysis.Name.name decl))
current current
old old
SketchC (put @(Sketchbook Name) (Sketchbook new current)) SketchC (put @(Sketchbook Name) (Sketchbook new current))

View File

@ -1,5 +0,0 @@
module Data.Name
( module Analysis.Name
) where
import Analysis.Name

View File

@ -48,6 +48,7 @@ module Data.ScopeGraph
import Prelude hiding (lookup) import Prelude hiding (lookup)
import Analysis.Name
import Control.Applicative import Control.Applicative
import Control.Lens.Lens import Control.Lens.Lens
import Control.Monad import Control.Monad
@ -61,7 +62,6 @@ import qualified Data.Map.Strict as Map
import Data.Maybe import Data.Maybe
import Data.Module import Data.Module
import Data.Monoid import Data.Monoid
import Data.Name
import Data.Semilattice.Lower import Data.Semilattice.Lower
import Data.Sequence (Seq) import Data.Sequence (Seq)
import qualified Data.Sequence as Seq import qualified Data.Sequence as Seq

View File

@ -13,9 +13,9 @@ module ScopeGraph.Convert
, complete , complete
) where ) where
import Analysis.Name (Name)
import Control.Effect.Sketch import Control.Effect.Sketch
import Data.List.NonEmpty import Data.List.NonEmpty
import Data.Name (Name)
import Data.Typeable import Data.Typeable
import Source.Loc import Source.Loc

View File

@ -285,6 +285,7 @@ library
, proto-lens-jsonpb , proto-lens-jsonpb
, proto-lens-runtime >= 0.5 && <0.7 , proto-lens-runtime >= 0.5 && <0.7
, reducers ^>= 3.12.3 , reducers ^>= 3.12.3
, semantic-analysis ^>= 0
, semantic-go ^>= 0 , semantic-go ^>= 0
, semantic-java ^>= 0 , semantic-java ^>= 0
, semantic-json ^>= 0 , semantic-json ^>= 0

View File

@ -2,4 +2,4 @@ module Data.Abstract.Name
( module X ( module X
) where ) where
import Data.Name as X import Analysis.Name as X