2022-09-06 16:26:48 +03:00
|
|
|
module Core.Transformation.Lifting (allTests) where
|
|
|
|
|
|
|
|
import Base
|
2022-10-12 11:19:02 +03:00
|
|
|
import Core.Eval.Positive qualified as Eval
|
2022-09-12 13:45:40 +03:00
|
|
|
import Core.Transformation.Base
|
|
|
|
import Juvix.Compiler.Core.Transformation
|
2022-09-06 16:26:48 +03:00
|
|
|
|
|
|
|
allTests :: TestTree
|
2022-10-12 11:19:02 +03:00
|
|
|
allTests = testGroup "Lambda lifting" (mapMaybe liftTest Eval.tests)
|
2022-09-06 16:26:48 +03:00
|
|
|
|
2022-09-12 13:45:40 +03:00
|
|
|
pipe :: [TransformationId]
|
|
|
|
pipe = [LambdaLifting]
|
|
|
|
|
2022-10-12 11:19:02 +03:00
|
|
|
liftTest :: Eval.PosTest -> Maybe TestTree
|
|
|
|
liftTest _testEval@Eval.PosTest {..}
|
|
|
|
| _name `elem` excluded = Nothing
|
|
|
|
| otherwise =
|
|
|
|
Just $
|
|
|
|
fromTest
|
|
|
|
Test
|
|
|
|
{ _testTransformations = pipe,
|
|
|
|
_testAssertion = \i -> unless (isLifted i) (error "not lambda lifted"),
|
|
|
|
_testEval
|
|
|
|
}
|
2022-09-12 13:45:40 +03:00
|
|
|
|
2022-10-12 11:19:02 +03:00
|
|
|
excluded :: [String]
|
|
|
|
excluded =
|
|
|
|
[ "LetRec"
|
2022-09-12 13:45:40 +03:00
|
|
|
]
|