1
1
mirror of https://github.com/github/semantic.git synced 2024-12-11 08:45:48 +03:00

Fix up parts of Evaluatable Class; not sure about the klass declaration

This commit is contained in:
Rick Winfrey 2018-10-29 16:33:09 -07:00
parent d76fcb73a7
commit 8c26fbfb61

View File

@ -210,22 +210,21 @@ instance Evaluatable Class where
supers <- for classSuperclasses $ \superclass -> do supers <- for classSuperclasses $ \superclass -> do
name <- maybeM (throwEvalError NoNameError) (declaredName (subterm superclass)) name <- maybeM (throwEvalError NoNameError) (declaredName (subterm superclass))
scope <- associatedScope (Declaration name) associatedScope (Declaration name)
(scope,) <$> subtermAddress superclass
let imports = (Import,) <$> (fmap pure . catMaybes $ fst <$> supers) let imports = (Import,) <$> (fmap pure . catMaybes $ supers)
current = maybe mempty (fmap (Lexical, ) . pure . pure) currentScope' current = maybe mempty (fmap (Lexical, ) . pure . pure) currentScope'
edges = Map.fromList (imports <> current) edges = Map.fromList (imports <> current)
childScope <- newScope edges childScope <- newScope edges
declare (Declaration name) span (Just childScope) declare (Declaration name) span (Just childScope)
withScope childScope $ do -- withScope childScope $ do
(_, addr) <- letrec name $ do -- (_, addr) <- letrec name $ do
void $ subtermValue classBody -- void $ subtermValue classBody
classBinds <- Env.head <$> getEnv -- classBinds <- Env.head <$> getEnv
klass name (snd <$> supers) classBinds -- klass (Declaration name) (catMaybes supers) classBinds -- TODO: Update klass definition
bind name addr -- pure (Rval addr)
pure (Rval addr) rvalBox unit
-- | A decorator in Python -- | A decorator in Python
data Decorator a = Decorator { decoratorIdentifier :: !a, decoratorParamaters :: ![a], decoratorBody :: !a } data Decorator a = Decorator { decoratorIdentifier :: !a, decoratorParamaters :: ![a], decoratorBody :: !a }