mirror of
https://github.com/anoma/juvix.git
synced 2024-12-12 14:28:08 +03:00
69a12d0c2f
* Closes #2859
33 lines
1.3 KiB
Haskell
33 lines
1.3 KiB
Haskell
module VampIR.Compilation.Base where
|
|
|
|
import Base
|
|
import Core.VampIR.Base (coreVampIRAssertion')
|
|
import Juvix.Compiler.Core
|
|
import VampIR.Core.Base (VampirBackend (..), vampirAssertion')
|
|
|
|
vampirCompileAssertion :: Path Abs Dir -> Path Abs File -> Path Abs File -> (String -> IO ()) -> Assertion
|
|
vampirCompileAssertion root' mainFile dataFile step = do
|
|
step "Translate to JuvixCore"
|
|
entryPoint <- testDefaultEntryPointIO root' mainFile
|
|
PipelineResult {..} <- snd <$> testRunIO entryPoint upToStoredCore
|
|
let tab = computeCombinedInfoTable (_pipelineResult ^. coreResultModule)
|
|
coreVampIRAssertion' tab toVampIRTransformations mainFile dataFile step
|
|
vampirAssertion' entryPoint VampirHalo2 tab dataFile step
|
|
|
|
vampirCompileErrorAssertion ::
|
|
Path Abs Dir ->
|
|
Path Abs File ->
|
|
(String -> IO ()) ->
|
|
Assertion
|
|
vampirCompileErrorAssertion root' mainFile step = do
|
|
step "Translate to JuvixCore"
|
|
entryPoint <- testDefaultEntryPointIO root' mainFile
|
|
r <- testRunIOEither entryPoint upToStoredCore
|
|
case r of
|
|
Left _ -> return ()
|
|
Right res ->
|
|
let m = snd res ^. pipelineResult . coreResultModule
|
|
in case run $ runReader entryPoint $ runError @JuvixError $ toVampIR m of
|
|
Left _ -> return ()
|
|
Right _ -> assertFailure "no error"
|