1
1
mirror of https://github.com/github/semantic.git synced 2024-12-24 23:42:31 +03:00

return original address rather than boxing a copy

This commit is contained in:
Charlie Somerville 2018-06-15 11:52:11 +10:00
parent 7053028647
commit 89359de71d

View File

@ -163,11 +163,12 @@ instance Evaluatable Class where
eval Class{..} = do
name <- either (throwEvalError . FreeVariablesError) pure (freeVariable $ subterm classIdentifier)
supers <- traverse subtermValue classSuperclasses
(v, addr) <- letrec name $ do
(_, addr) <- letrec name $ do
void $ subtermValue classBody
classEnv <- Env.head <$> getEnv
klass name supers classEnv
rvalBox =<< (v <$ bind name addr)
bind name addr
pure (Rval addr)
-- | A decorator in Python
data Decorator a = Decorator { decoratorIdentifier :: !a, decoratorParamaters :: ![a], decoratorBody :: !a }
@ -246,7 +247,8 @@ instance Evaluatable TypeAlias where
v <- subtermValue typeAliasKind
addr <- lookupOrAlloc name
assign addr v
rvalBox =<< (v <$ bind name addr)
bind name addr
pure (Rval addr)
instance Declarations a => Declarations (TypeAlias a) where
declaredName TypeAlias{..} = declaredName typeAliasIdentifier