-- | lookup an object, function or enumerator
lookupObject :: (MonadCError m, MonadSymtab m) => Ident -> m (Maybe IdentDecl)
lookupObject ident = do
old_decl <- liftM (lookupIdent ident) getDefTable
mapMaybeM old_decl $ \obj ->
case obj of
Right objdef -> addRef ident objdef >> return objdef
Left _tydef -> astError (nodeInfo ident) (mismatchErr "lookupObject" "an object" "a typeDef")
Right now I'm going to assume we're going to special-case every monad in the codebase so we can get some somewhat reasonable output...?
The elephant in the room.
Right now I'm going to assume we're going to special-case every monad in the codebase so we can get some somewhat reasonable output...?