1
1
mirror of https://github.com/github/semantic.git synced 2024-12-15 01:51:39 +03:00

Merge branch 'heap-frames' of https://github.com/github/semantic into heap-frames

This commit is contained in:
Rob Rix 2018-12-06 15:44:27 -05:00
commit 2cd7257429
2 changed files with 15 additions and 7 deletions

View File

@ -215,7 +215,7 @@ instance Ord1 Array where liftCompare = genericLiftCompare
instance Show1 Array where liftShowsPrec = genericLiftShowsPrec instance Show1 Array where liftShowsPrec = genericLiftShowsPrec
instance Evaluatable Array where instance Evaluatable Array where
eval _ (Array _) = undefined -- rvalBox =<< array =<< traverse (eval >=> address) a eval eval Array{..} = rvalBox =<< array =<< traverse (eval >=> Eval.value) arrayElements
instance Tokenize Array where instance Tokenize Array where
tokenize = list . arrayElements tokenize = list . arrayElements
@ -255,7 +255,7 @@ instance Ord1 Tuple where liftCompare = genericLiftCompare
instance Show1 Tuple where liftShowsPrec = genericLiftShowsPrec instance Show1 Tuple where liftShowsPrec = genericLiftShowsPrec
instance Evaluatable Tuple where instance Evaluatable Tuple where
eval _ (Tuple _) = undefined -- rvalBox =<< tuple =<< traverse (eval >=> address) cs eval eval (Tuple cs) = rvalBox =<< tuple =<< traverse (eval >=> Eval.value) cs
newtype Set a = Set { setElements :: [a] } newtype Set a = Set { setElements :: [a] }
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, Named1, Message1, NFData1) deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, Named1, Message1, NFData1)

View File

@ -133,11 +133,19 @@ instance Ord1 Let where liftCompare = genericLiftCompare
instance Show1 Let where liftShowsPrec = genericLiftShowsPrec instance Show1 Let where liftShowsPrec = genericLiftShowsPrec
instance Evaluatable Let where instance Evaluatable Let where
eval _ Let{..} = do eval eval Let{..} = do
undefined name <- maybeM (throwEvalError NoNameError) (declaredName letVariable)
-- name <- maybeM (throwEvalError NoNameError) (declaredName letVariable) letSpan <- ask @Span
-- addr <- snd <$> letrec name (eval letValue >>= Abstract.value) valueName <- maybeM (throwEvalError NoNameError) (declaredName letValue)
-- Rval <$> locally (bind name addr *> (eval letBody >>= address)) assocScope <- associatedScope (Declaration valueName)
withLexicalScopeAndFrame $ do
declare (Declaration name) letSpan assocScope
letVal <- (eval letValue >>= Abstract.value)
slot <- lookupDeclaration (Declaration name)
assign slot letVal
eval letBody
rvalBox unit
-- Assignment -- Assignment