- -- Add in the OPTIONS from the source file This is nasty:
- -- we've done this once already, in the compilation manager
- -- It might be better to cache the flags in the
- -- ml_hspp_file field, say
- let dflags0 = hsc_dflags hsc_env
- hspp_buf = expectJust "GHC.checkModule" (ms_hspp_buf ms)
- filename = fromJust (ml_hs_file (ms_location ms))
- opts = getOptionsFromStringBuffer hspp_buf filename
- (dflags1,leftovers) <- parseDynamicFlags dflags0 (map snd opts)
- if (not (null leftovers))
- then do printErrorsAndWarnings dflags1 (optionsErrorMsgs leftovers opts filename)
- return Nothing
- else do
-
- r <- hscFileCheck hsc_env{hsc_dflags=dflags1} ms
- case r of
- HscFail ->
- return Nothing
- HscChecked parsed renamed Nothing ->
+ mbChecked <- hscFileCheck hsc_env{hsc_dflags=ms_hspp_opts ms} ms
+ case mbChecked of
+ Nothing -> return Nothing
+ Just (HscChecked parsed renamed Nothing) ->