diff --git a/src/Data/Syntax/Declaration.hs b/src/Data/Syntax/Declaration.hs index 43c329e84..5b35c9c30 100644 --- a/src/Data/Syntax/Declaration.hs +++ b/src/Data/Syntax/Declaration.hs @@ -210,22 +210,21 @@ instance Evaluatable Class where supers <- for classSuperclasses $ \superclass -> do name <- maybeM (throwEvalError NoNameError) (declaredName (subterm superclass)) - scope <- associatedScope (Declaration name) - (scope,) <$> subtermAddress superclass + associatedScope (Declaration name) - let imports = (Import,) <$> (fmap pure . catMaybes $ fst <$> supers) - current = maybe mempty (fmap (Lexical, ) . pure . pure) currentScope' - edges = Map.fromList (imports <> current) - childScope <- newScope edges - declare (Declaration name) span (Just childScope) + -- let imports = (Import,) <$> (fmap pure . catMaybes $ supers) + -- current = maybe mempty (fmap (Lexical, ) . pure . pure) currentScope' + -- edges = Map.fromList (imports <> current) + -- childScope <- newScope edges + -- declare (Declaration name) span (Just childScope) - withScope childScope $ do - (_, addr) <- letrec name $ do - void $ subtermValue classBody - classBinds <- Env.head <$> getEnv - klass name (snd <$> supers) classBinds - bind name addr - pure (Rval addr) + -- withScope childScope $ do + -- (_, addr) <- letrec name $ do + -- void $ subtermValue classBody + -- classBinds <- Env.head <$> getEnv + -- klass (Declaration name) (catMaybes supers) classBinds -- TODO: Update klass definition + -- pure (Rval addr) + rvalBox unit -- | A decorator in Python data Decorator a = Decorator { decoratorIdentifier :: !a, decoratorParamaters :: ![a], decoratorBody :: !a } @@ -301,9 +300,11 @@ instance Show1 TypeAlias where liftShowsPrec = genericLiftShowsPrec instance Evaluatable TypeAlias where eval TypeAlias{..} = do name <- maybeM (throwEvalError NoNameError) (declaredName (subterm typeAliasIdentifier)) - addr <- subtermAddress typeAliasKind - bind name addr - pure (Rval addr) + kindName <- maybeM (throwEvalError NoNameError) (declaredName (subterm typeAliasKind)) + span <- ask @Span + address <- declare (Declaration name) span Nothing -- TODO: Also need to declare the alias via an Alias edge? + kindAddress <- lookupDeclaration (Declaration kindName) -- TODO: Validate the path? Also assumes the type is declared. + rvalBox unit -- TODO: Return Address here? instance Declarations a => Declarations (TypeAlias a) where declaredName TypeAlias{..} = declaredName typeAliasIdentifier