@@ -50,7 +50,7 @@ module Development.IDE.Core.Rules(
5050 getHieAstsRule ,
5151 getBindingsRule ,
5252 needsCompilationRule ,
53- computeLinkableType ,
53+ computeLinkableTypeForDynFlags ,
5454 generateCoreRule ,
5555 getImportMapRule ,
5656 regenerateHiFile ,
@@ -1015,33 +1015,33 @@ needsCompilationRule file = do
10151015 pure $ computeLinkableType ms modsums (map join needsComps)
10161016
10171017 pure (Just $ encodeLinkableType res, Just res)
1018-
1019- -- | Compute the linkable type required for the input module
1020- computeLinkableType
1021- :: ModSummary -- ^ module
1022- -> [Maybe ModSummary ] -- ^ direct dependencies
1023- -> [Maybe LinkableType ] -- ^ linkable requirements for the direct dependencies
1024- -> Maybe LinkableType
1025- computeLinkableType this deps xs
1026- | Just ObjectLinkable `elem` xs = Just ObjectLinkable -- If any dependent needs object code, so do we
1027- | Just BCOLinkable `elem` xs = Just this_type -- If any dependent needs bytecode, then we need to be compiled
1028- | any (maybe False uses_th_qq) deps = Just this_type -- If any dependent needs TH, then we need to be compiled
1029- | otherwise = Nothing -- If none of these conditions are satisfied, we don't need to compile
1030- where
1031- uses_th_qq (ms_hspp_opts -> dflags) =
1032- xopt LangExt. TemplateHaskell dflags || xopt LangExt. QuasiQuotes dflags
1033-
1034- unboxed_tuples_or_sums (ms_hspp_opts -> d) =
1035- xopt LangExt. UnboxedTuples d || xopt LangExt. UnboxedSums d
1036- -- How should we compile this module? (assuming we do in fact need to compile it)
1037- -- Depends on whether it uses unboxed tuples or sums
1038- this_type
1018+ where
1019+ uses_th_qq (ms_hspp_opts -> dflags) =
1020+ xopt LangExt. TemplateHaskell dflags || xopt LangExt. QuasiQuotes dflags
1021+
1022+ computeLinkableType :: ModSummary -> [Maybe ModSummary ] -> [Maybe LinkableType ] -> Maybe LinkableType
1023+ computeLinkableType this deps xs
1024+ | Just ObjectLinkable `elem` xs = Just ObjectLinkable -- If any dependent needs object code, so do we
1025+ | Just BCOLinkable `elem` xs = Just this_type -- If any dependent needs bytecode, then we need to be compiled
1026+ | any (maybe False uses_th_qq) deps = Just this_type -- If any dependent needs TH, then we need to be compiled
1027+ | otherwise = Nothing -- If none of these conditions are satisfied, we don't need to compile
1028+ where
1029+ this_type = computeLinkableTypeForDynFlags (ms_hspp_opts this)
1030+
1031+ -- | How should we compile this module?
1032+ -- (assuming we do in fact need to compile it).
1033+ -- Depends on whether it uses unboxed tuples or sums
1034+ computeLinkableTypeForDynFlags :: DynFlags -> LinkableType
1035+ computeLinkableTypeForDynFlags d
10391036#if defined(GHC_PATCHED_UNBOXED_BYTECODE)
10401037 = BCOLinkable
10411038#else
1042- | unboxed_tuples_or_sums this = ObjectLinkable
1043- | otherwise = BCOLinkable
1039+ | unboxed_tuples_or_sums = ObjectLinkable
1040+ | otherwise = BCOLinkable
10441041#endif
1042+ where
1043+ unboxed_tuples_or_sums =
1044+ xopt LangExt. UnboxedTuples d || xopt LangExt. UnboxedSums d
10451045
10461046-- | Tracks which linkables are current, so we don't need to unload them
10471047newtype CompiledLinkables = CompiledLinkables { getCompiledLinkables :: Var (ModuleEnv UTCTime ) }
0 commit comments