mirror of
https://github.com/github/semantic.git
synced 2024-12-27 17:05:33 +03:00
🔥 some redundant qualifiers.
This commit is contained in:
parent
8127690358
commit
ec53cd91d6
@ -6,7 +6,7 @@ module Analysis.ImportGraph
|
|||||||
) where
|
) where
|
||||||
|
|
||||||
import Analysis.Analysis
|
import Analysis.Analysis
|
||||||
import Analysis.Carrier.Env.Monovariant as A
|
import Analysis.Carrier.Env.Monovariant
|
||||||
import Analysis.File
|
import Analysis.File
|
||||||
import Analysis.FlowInsensitive
|
import Analysis.FlowInsensitive
|
||||||
import Control.Applicative (Alternative(..))
|
import Control.Applicative (Alternative(..))
|
||||||
@ -120,7 +120,7 @@ importGraphAnalysis = Analysis{..}
|
|||||||
apply eval (Value (Closure path span name body) _) a = local (const path) . local (const span) $ do
|
apply eval (Value (Closure path span name body) _) a = local (const path) . local (const span) $ do
|
||||||
addr <- alloc @name @name name
|
addr <- alloc @name @name name
|
||||||
assign addr a
|
assign addr a
|
||||||
A.bind name addr (eval body)
|
bind name addr (eval body)
|
||||||
apply _ f _ = fail $ "Cannot coerce " <> show f <> " to function"
|
apply _ f _ = fail $ "Cannot coerce " <> show f <> " to function"
|
||||||
unit = pure mempty
|
unit = pure mempty
|
||||||
bool _ = pure mempty
|
bool _ = pure mempty
|
||||||
@ -130,7 +130,7 @@ importGraphAnalysis = Analysis{..}
|
|||||||
asString _ = pure mempty
|
asString _ = pure mempty
|
||||||
record fields = do
|
record fields = do
|
||||||
for_ fields $ \ (k, v) -> do
|
for_ fields $ \ (k, v) -> do
|
||||||
addr <- A.alloc @name @name k
|
addr <- alloc @name @name k
|
||||||
assign addr v
|
assign addr v
|
||||||
pure (Value Abstract (foldMap (valueGraph . snd) fields))
|
pure (Value Abstract (foldMap (valueGraph . snd) fields))
|
||||||
_ ... m = pure (Just m)
|
_ ... m = pure (Just m)
|
||||||
|
@ -8,7 +8,7 @@ module Analysis.ScopeGraph
|
|||||||
) where
|
) where
|
||||||
|
|
||||||
import Analysis.Analysis
|
import Analysis.Analysis
|
||||||
import Analysis.Carrier.Env.Monovariant as A
|
import Analysis.Carrier.Env.Monovariant
|
||||||
import Analysis.File
|
import Analysis.File
|
||||||
import Analysis.FlowInsensitive
|
import Analysis.FlowInsensitive
|
||||||
import Control.Applicative (Alternative (..))
|
import Control.Applicative (Alternative (..))
|
||||||
@ -117,9 +117,9 @@ scopeGraphAnalysis = Analysis{..}
|
|||||||
bindRef <- asks (Map.lookup addr)
|
bindRef <- asks (Map.lookup addr)
|
||||||
modify (Map.insertWith (<>) addr (Set.singleton (extendBinding addr ref bindRef <> v)))
|
modify (Map.insertWith (<>) addr (Set.singleton (extendBinding addr ref bindRef <> v)))
|
||||||
abstract eval name body = do
|
abstract eval name body = do
|
||||||
addr <- A.alloc @name @name name
|
addr <- alloc @name @name name
|
||||||
assign name mempty
|
assign name mempty
|
||||||
A.bind name addr (eval body)
|
bind name addr (eval body)
|
||||||
apply _ f a = pure (f <> a)
|
apply _ f a = pure (f <> a)
|
||||||
unit = pure mempty
|
unit = pure mempty
|
||||||
bool _ = pure mempty
|
bool _ = pure mempty
|
||||||
|
@ -8,7 +8,7 @@ module Analysis.Typecheck
|
|||||||
) where
|
) where
|
||||||
|
|
||||||
import Analysis.Analysis
|
import Analysis.Analysis
|
||||||
import Analysis.Carrier.Env.Monovariant as A
|
import Analysis.Carrier.Env.Monovariant
|
||||||
import Analysis.File
|
import Analysis.File
|
||||||
import Analysis.FlowInsensitive
|
import Analysis.FlowInsensitive
|
||||||
import Control.Applicative (Alternative (..))
|
import Control.Applicative (Alternative (..))
|
||||||
@ -167,7 +167,7 @@ typecheckingAnalysis = Analysis{..}
|
|||||||
assign addr ty = modify (Map.insertWith (<>) addr (Set.singleton ty))
|
assign addr ty = modify (Map.insertWith (<>) addr (Set.singleton ty))
|
||||||
abstract eval name body = do
|
abstract eval name body = do
|
||||||
-- FIXME: construct the associated scope
|
-- FIXME: construct the associated scope
|
||||||
addr <- A.alloc @name @name name
|
addr <- alloc @name @name name
|
||||||
arg <- meta
|
arg <- meta
|
||||||
assign addr arg
|
assign addr arg
|
||||||
ty <- eval body
|
ty <- eval body
|
||||||
@ -185,7 +185,7 @@ typecheckingAnalysis = Analysis{..}
|
|||||||
asString s = unify (Alg String) s $> mempty
|
asString s = unify (Alg String) s $> mempty
|
||||||
record fields = do
|
record fields = do
|
||||||
fields' <- for fields $ \ (k, v) -> do
|
fields' <- for fields $ \ (k, v) -> do
|
||||||
addr <- A.alloc @name @name k
|
addr <- alloc @name @name k
|
||||||
(k, v) <$ assign addr v
|
(k, v) <$ assign addr v
|
||||||
-- FIXME: should records reference types by address instead?
|
-- FIXME: should records reference types by address instead?
|
||||||
pure (Alg (Record (Map.fromList fields')))
|
pure (Alg (Record (Map.fromList fields')))
|
||||||
|
Loading…
Reference in New Issue
Block a user