1
1
mirror of https://github.com/github/semantic.git synced 2024-12-03 00:16:52 +03:00

use withLexicalScopeAndFrame in Statements

This commit is contained in:
joshvera 2018-11-05 16:11:16 -05:00
parent f2754368cb
commit 1020f6dc61

View File

@ -32,10 +32,8 @@ instance Show1 Statements where liftShowsPrec = genericLiftShowsPrec
instance ToJSON1 Statements
instance Evaluatable Statements where
eval eval (Statements xs) = do
currentScope' <- currentScope -- TODO: currentScope should return a Maybe
scope <- newScope (Map.singleton Lexical [ currentScope' ])
withScope scope $ maybe (rvalBox unit) (runApp . foldMap1 (App . eval)) (nonEmpty xs)
eval eval (Statements xs) =
withLexicalScopeAndFrame $ maybe (rvalBox unit) (runApp . foldMap1 (App . eval)) (nonEmpty xs)
instance Tokenize Statements where
tokenize = imperative