mirror of
https://github.com/github/semantic.git
synced 2024-11-28 10:15:55 +03:00
Rename addExport to export.
This commit is contained in:
parent
11a92c0cb6
commit
6a3f4ba689
@ -4,7 +4,7 @@ module Control.Abstract.Environment
|
|||||||
, Exports
|
, Exports
|
||||||
, getEnv
|
, getEnv
|
||||||
, getExports
|
, getExports
|
||||||
, addExport
|
, export
|
||||||
, lookupEnv
|
, lookupEnv
|
||||||
, bind
|
, bind
|
||||||
, bindAll
|
, bindAll
|
||||||
@ -36,8 +36,8 @@ getExports :: Member (State (Exports address)) effects => Evaluator address valu
|
|||||||
getExports = get
|
getExports = get
|
||||||
|
|
||||||
-- | Add an export to the global export state.
|
-- | Add an export to the global export state.
|
||||||
addExport :: Member (State (Exports address)) effects => Name -> Name -> Maybe address -> Evaluator address value effects ()
|
export :: Member (State (Exports address)) effects => Name -> Name -> Maybe address -> Evaluator address value effects ()
|
||||||
addExport name alias = modify' . insert name alias
|
export name alias = modify' . insert name alias
|
||||||
|
|
||||||
|
|
||||||
-- | Look a 'Name' up in the current environment, trying the default environment if no value is found.
|
-- | Look a 'Name' up in the current environment, trying the default environment if no value is found.
|
||||||
|
@ -229,7 +229,7 @@ instance Evaluatable QualifiedExport where
|
|||||||
eval (QualifiedExport exportSymbols) = do
|
eval (QualifiedExport exportSymbols) = do
|
||||||
-- Insert the aliases with no addresses.
|
-- Insert the aliases with no addresses.
|
||||||
for_ exportSymbols $ \(name, alias) ->
|
for_ exportSymbols $ \(name, alias) ->
|
||||||
addExport name alias Nothing
|
export name alias Nothing
|
||||||
pure (Rval unit)
|
pure (Rval unit)
|
||||||
|
|
||||||
|
|
||||||
@ -250,7 +250,7 @@ instance Evaluatable QualifiedExportFrom where
|
|||||||
-- Look up addresses in importedEnv and insert the aliases with addresses into the exports.
|
-- Look up addresses in importedEnv and insert the aliases with addresses into the exports.
|
||||||
for_ exportSymbols $ \(name, alias) -> do
|
for_ exportSymbols $ \(name, alias) -> do
|
||||||
let address = Env.lookup name importedEnv
|
let address = Env.lookup name importedEnv
|
||||||
maybe (throwEvalError $ ExportError modulePath name) (addExport name alias . Just) address
|
maybe (throwEvalError $ ExportError modulePath name) (export name alias . Just) address
|
||||||
pure (Rval unit)
|
pure (Rval unit)
|
||||||
|
|
||||||
newtype DefaultExport a = DefaultExport { defaultExport :: a }
|
newtype DefaultExport a = DefaultExport { defaultExport :: a }
|
||||||
@ -269,7 +269,7 @@ instance Evaluatable DefaultExport where
|
|||||||
Just name -> do
|
Just name -> do
|
||||||
addr <- lookupOrAlloc name
|
addr <- lookupOrAlloc name
|
||||||
assign addr v
|
assign addr v
|
||||||
addExport name name Nothing
|
export name name Nothing
|
||||||
bind name addr
|
bind name addr
|
||||||
Nothing -> throwEvalError DefaultExportError
|
Nothing -> throwEvalError DefaultExportError
|
||||||
pure (Rval unit)
|
pure (Rval unit)
|
||||||
|
Loading…
Reference in New Issue
Block a user