From: Christiaan Baaij Date: Mon, 13 Jul 2009 09:08:10 +0000 (+0200) Subject: Use HscEnv from initial HsToCore transformation when translating tfp to int X-Git-Url: https://git.stderr.nl/gitweb?a=commitdiff_plain;ds=sidebyside;h=1d2f36c370db9ef82667741cc9414f9896084af3;p=matthijs%2Fmaster-project%2Fc%CE%BBash.git Use HscEnv from initial HsToCore transformation when translating tfp to int --- diff --git a/CoreTools.hs b/CoreTools.hs index eae4122..9888255 100644 --- a/CoreTools.hs +++ b/CoreTools.hs @@ -38,9 +38,10 @@ import Pretty -- | Evaluate a core Type representing type level int from the tfp -- library to a real int. -eval_tfp_int :: Type.Type -> Int -eval_tfp_int ty = +eval_tfp_int :: HscTypes.HscEnv -> Type.Type -> Int +eval_tfp_int env ty = unsafeRunGhc $ do + GHC.setSession env -- Automatically import modules for any fully qualified identifiers setDynFlag DynFlags.Opt_ImplicitImportQualified diff --git a/VHDLTools.hs b/VHDLTools.hs index 1e6e5bc..a66f92d 100644 --- a/VHDLTools.hs +++ b/VHDLTools.hs @@ -527,10 +527,11 @@ isReprType ty = do tfp_to_int :: Type.Type -> TypeSession Int tfp_to_int ty = do lens <- getA vsTfpInts + hscenv <- getA vsHscEnv let existing_len = Map.lookup (OrdType ty) lens case existing_len of Just len -> return len Nothing -> do - let new_len = eval_tfp_int ty + let new_len = eval_tfp_int hscenv ty modA vsTfpInts (Map.insert (OrdType ty) (new_len)) return new_len \ No newline at end of file