Skip to content

Commit 8c3d2fe

Browse files
improve mini-compile fix
1 parent 79a274f commit 8c3d2fe

File tree

1 file changed

+18
-3
lines changed
  • examples/ghc-lib-test-mini-compile/src

1 file changed

+18
-3
lines changed

examples/ghc-lib-test-mini-compile/src/Main.hs

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -219,8 +219,25 @@ mkDynFlags filename s = do
219219
(dflags, _, _) <- parseDynamicFilePragma dflags0 opts
220220
return dflags
221221

222-
#else
222+
#elif (defined (GHC_9_14))
223+
let baseFlags =
224+
(defaultDynFlags fakeSettings) {
225+
ghcLink = NoLink
226+
, backend = noBackend
227+
, homeUnitId_ = toUnitId (stringToUnit ghclibPrimUnitId)
228+
}
229+
parsePragmasIntoDynFlags filename s baseFlags
230+
where
231+
parsePragmasIntoDynFlags :: String -> String -> DynFlags -> IO DynFlags
232+
parsePragmasIntoDynFlags filepath contents dflags0 = do
233+
let (_, opts) = getOptions (initParserOpts dflags0)
234+
(supportedLanguagePragmas dflags0)
235+
(stringToStringBuffer contents) filepath
236+
logger <- initLogger
237+
(dflags, _, _) <- parseDynamicFilePragma logger dflags0 opts
238+
return dflags
223239

240+
#else
224241
let baseFlags =
225242
(defaultDynFlags fakeSettings) {
226243
ghcLink = NoLink
@@ -232,9 +249,7 @@ mkDynFlags filename s = do
232249
parsePragmasIntoDynFlags :: String -> String -> DynFlags -> IO DynFlags
233250
parsePragmasIntoDynFlags filepath contents dflags0 = do
234251
let (_, opts) = getOptions (initParserOpts dflags0)
235-
#if (defined (GHC_9_16))
236252
(initSourceErrorContext dflags0)
237-
#endif
238253
(supportedLanguagePragmas dflags0)
239254
(stringToStringBuffer contents) filepath
240255
logger <- initLogger

0 commit comments

Comments
 (0)