<NME> Variants.hs
<BEF> {-# LANGUAGE CPP #-}
{-
   GHCJS can generate multiple code variants of a Haskell module
-}
module Compiler.Variants where

import           Data.ByteString       (ByteString)
import           Data.Set              (Set)
import qualified Javascript.Trampoline as Js
import Generator.Helpers (runGen, newGenState)

import GHC
import StgSyn (StgBinding)

data CallingConvention = Plain | Trampoline

import           DynFlags              (DynFlags)
import           Module                (Module (..), InstalledUnitId)
import           StgSyn                (StgBinding, StgTopBinding)
import           HscTypes              (SptEntry, ForeignStubs)

data Variant = Variant
    { variantRender            :: GhcjsSettings
                               -> DynFlags
                               -> Module
                               -> [StgTopBinding]
                               -> [SptEntry]
                               -> ForeignStubs
                               -> CollectedCCs
                               -> ByteString
    , variantLink              :: DynFlags
                               -> GhcjsEnv
                               -> GhcjsSettings
                               -> FilePath                     -- output directory
                               -> [FilePath]                   -- include paths for home package
                               -> [InstalledUnitId]            -- dependencies
                               -> [LinkedObj]                  -- object files
                               -> [FilePath]                   -- extra JavaScript files
                               -> (Gen2.Fun -> Bool)           -- function to use as roots
                               -> Set Gen2.Fun                 -- extra roots
                               -> IO ()
    }

gen2Variant :: Variant
gen2Variant = Variant Gen2.generate Gen2.link

type StgPgm = [StgBinding]

<MSG> Fixes for integrated build and change the list of modules exposed so it defaults to just JSMain (or Main if that does not exist).

<DFF> @@ -9,8 +9,9 @@ import qualified Javascript.Formatted as Js
 import qualified Javascript.Trampoline as Js
 import Generator.Helpers (runGen, newGenState)
 
-import GHC
 import StgSyn (StgBinding)
+import Module (Module(..))
+import Id (Id)
 
 data CallingConvention = Plain | Trampoline
 

{'addition_count': 2, 'commit_subject': 'Fixes for integrated build and change the list of modules exposed so it defaults to just JSMain (or Main if that does not exist).', 'deletion_count': 1, 'file_extension': '.hs', 'lang': 'hs', 'license': 'mit', 'repo_name': 'ghcjs/ghcjs'}