import PrelNames ( gHC_PRIM, mAIN_NAME )
import StringBuffer ( StringBuffer(..), hGetStringBuffer, hGetStringBufferBlock
, appendStringBuffers )
+import Config
import SrcLoc
-import FastString ( mkFastString )
import DynFlags
import ErrUtils
import Util
import Bag ( emptyBag, listToBag )
import Distribution.Compiler
+import Distribution.Version
import Control.Exception
import Control.Monad
checkExtension :: Located FastString -> Located String
checkExtension (L l ext)
- = case reads (unpackFS ext) of
- [] -> languagePragParseError l
- (okExt,""):_ -> case extensionsToGHCFlag [okExt] of
- ([],[opt]) -> L l opt
- _ -> unsupportedExtnError l okExt
+ = case reads (unpackFS ext) of
+ [] -> languagePragParseError l
+ (okExt,""):_ ->
+ case readVersion cProjectVersion of
+ Just version ->
+ case extensionsToGHCFlag version [okExt] of
+ ([],[opt]) -> L l opt
+ _ -> unsupportedExtnError l okExt
+ Nothing ->
+ panic ("Can't parse version: " ++ show cProjectVersion)
languagePragParseError loc =
pgmError (showSDoc (mkLocMessage loc (