Commit 62070c7f authored by simonpj@microsoft.com's avatar simonpj@microsoft.com
Browse files

Move getMainFun to TcRnDriver, trim DynFlags imports

parent fce8977b
...@@ -31,7 +31,6 @@ module DynFlags ( ...@@ -31,7 +31,6 @@ module DynFlags (
dopt_set, dopt_unset, -- DynFlags -> DynFlag -> DynFlags dopt_set, dopt_unset, -- DynFlags -> DynFlag -> DynFlags
getOpts, -- DynFlags -> (DynFlags -> [a]) -> [a] getOpts, -- DynFlags -> (DynFlags -> [a]) -> [a]
getVerbFlag, getVerbFlag,
getMainFun,
updOptLevel, updOptLevel,
setTmpDir, setTmpDir,
setPackageName, setPackageName,
...@@ -69,9 +68,7 @@ import Platform ...@@ -69,9 +68,7 @@ import Platform
#endif #endif
import Module import Module
import PackageConfig import PackageConfig
import PrelNames ( mAIN, main_RDR_Unqual ) import PrelNames ( mAIN )
import RdrName ( RdrName, mkRdrUnqual )
import OccName ( mkVarOccFS )
#if defined(i386_TARGET_ARCH) || (!defined(mingw32_TARGET_OS) && !defined(darwin_TARGET_OS)) #if defined(i386_TARGET_ARCH) || (!defined(mingw32_TARGET_OS) && !defined(darwin_TARGET_OS))
import StaticFlags ( opt_Static ) import StaticFlags ( opt_Static )
#endif #endif
...@@ -2104,13 +2101,6 @@ setMainIs arg ...@@ -2104,13 +2101,6 @@ setMainIs arg
where where
(main_mod, main_fn) = splitLongestPrefix arg (== '.') (main_mod, main_fn) = splitLongestPrefix arg (== '.')
-- | Get the unqualified name of the function to use as the \"main\" for the main module.
-- Either returns the default name or the one configured on the command line with -main-is
getMainFun :: DynFlags -> RdrName
getMainFun dflags = case (mainFunIs dflags) of
Just fn -> mkRdrUnqual (mkVarOccFS (mkFastString fn))
Nothing -> main_RDR_Unqual
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
-- Paths & Libraries -- Paths & Libraries
......
...@@ -34,7 +34,6 @@ import DynFlags ...@@ -34,7 +34,6 @@ import DynFlags
import StaticFlags import StaticFlags
import HsSyn import HsSyn
import RdrHsSyn import RdrHsSyn
import PrelNames import PrelNames
import RdrName import RdrName
import TcHsSyn import TcHsSyn
...@@ -944,6 +943,12 @@ check_main dflags tcg_env ...@@ -944,6 +943,12 @@ check_main dflags tcg_env
pp_main_fn | main_fn == main_RDR_Unqual = ptext (sLit "function") <+> quotes (ppr main_fn) pp_main_fn | main_fn == main_RDR_Unqual = ptext (sLit "function") <+> quotes (ppr main_fn)
| otherwise = ptext (sLit "main function") <+> quotes (ppr main_fn) | otherwise = ptext (sLit "main function") <+> quotes (ppr main_fn)
-- | Get the unqualified name of the function to use as the \"main\" for the main module.
-- Either returns the default name or the one configured on the command line with -main-is
getMainFun :: DynFlags -> RdrName
getMainFun dflags = case (mainFunIs dflags) of
Just fn -> mkRdrUnqual (mkVarOccFS (mkFastString fn))
Nothing -> main_RDR_Unqual
\end{code} \end{code}
Note [Root-main Id] Note [Root-main Id]
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment