1
1
mirror of https://github.com/github/semantic.git synced 2024-12-20 21:31:48 +03:00

Defining builtins, namespaces, and classes require specifying the Relation

This commit is contained in:
Rick Winfrey 2018-12-12 16:56:46 -08:00
parent eefac23e6a
commit bc46e4882e

View File

@ -33,18 +33,19 @@ defineBuiltIn :: ( HasCallStack
, Carrier sig m
)
=> Declaration
-> Relation
-> BuiltIn
-> Evaluator term address value m ()
defineBuiltIn declaration value = withCurrentCallStack callStack $ do
defineBuiltIn declaration rel value = withCurrentCallStack callStack $ do
currentScope' <- currentScope
let lexicalEdges = Map.singleton Lexical [ currentScope' ]
associatedScope <- newScope lexicalEdges
-- TODO: This span is still wrong.
declare declaration emptySpan (Just associatedScope)
declare declaration rel emptySpan (Just associatedScope)
param <- gensym
withScope associatedScope $ do
declare (Declaration param) emptySpan Nothing
declare (Declaration param) rel emptySpan Nothing
slot <- lookupDeclaration declaration
value <- builtIn associatedScope value
@ -70,7 +71,7 @@ defineClass :: ( AbstractValue term address value m
-> [Declaration]
-> Evaluator term address value m a
-> Evaluator term address value m ()
defineClass declaration superclasses body = void . define declaration $ do
defineClass declaration superclasses body = void . define declaration Default $ do
currentScope' <- currentScope
superScopes <- for superclasses associatedScope
@ -105,7 +106,7 @@ defineNamespace :: ( AbstractValue term address value m
=> Declaration
-> Evaluator term address value m a
-> Evaluator term address value m ()
defineNamespace declaration@Declaration{..} body = void . define declaration $ do
defineNamespace declaration@Declaration{..} body = void . define declaration Default $ do
withChildFrame declaration $ \frame -> do
_ <- body
namespace unDeclaration frame