Skip to content

Commit

Permalink
Add a method to directly resolve SAWCore names by URI
Browse files Browse the repository at this point in the history
  • Loading branch information
robdockins committed Nov 13, 2020
1 parent 537dfc2 commit 5ae1901
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions saw-core/src/Verifier/SAW/SharedTerm.hs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ module Verifier.SAW.SharedTerm
, alistAllFields
, scRegisterName
, scResolveName
, scResolveNameByURI
, scResolveUnambiguous
, scFindBestName
, DuplicateNameException(..)
Expand Down Expand Up @@ -424,6 +425,11 @@ scFindBestName sc (ImportedName uri as) = go as
[_] -> return x
_ -> go xs

scResolveNameByURI :: SharedContext -> URI -> IO (Maybe VarIndex)
scResolveNameByURI sc uri =
do env <- readIORef (scNamingEnv sc)
pure $! Map.lookup uri (absoluteNames env)

scResolveName :: SharedContext -> Text -> IO [(VarIndex, NameInfo)]
scResolveName sc nm =
do env <- readIORef (scNamingEnv sc)
Expand Down

0 comments on commit 5ae1901

Please sign in to comment.