1
1
mirror of https://github.com/github/semantic.git synced 2024-11-28 10:15:55 +03:00

Remove lexical scope from Statements node

This commit is contained in:
joshvera 2018-11-29 13:00:53 -05:00
parent 168c31525b
commit 716bebd985

View File

@ -23,6 +23,7 @@ import qualified Data.Reprinting.Scope as Scope
-- 1. Each statements effects on the store are accumulated;
-- 2. Each statement can affect the environment of later statements (e.g. by 'modify'-ing the environment); and
-- 3. Only the last statements return value is returned.
-- TODO: Separate top-level statement nodes into non-lexical Statement and lexical StatementBlock nodes
newtype Statements a = Statements { statements :: [a] }
deriving (Diffable, Eq, Foldable, Functor, Generic1, Hashable1, Ord, Show, Traversable, FreeVariables1, Declarations1, ToJSONFields1, Named1, Message1, NFData1)
@ -33,7 +34,7 @@ instance ToJSON1 Statements
instance Evaluatable Statements where
eval eval (Statements xs) =
withLexicalScopeAndFrame $ maybe (rvalBox unit) (runApp . foldMap1 (App . eval)) (nonEmpty xs)
maybe (rvalBox unit) (runApp . foldMap1 (App . eval)) (nonEmpty xs)
instance Tokenize Statements where
tokenize = imperative