diff options
Diffstat (limited to 'compiler/parser')
-rw-r--r-- | compiler/parser/Lexer.x | 7 | ||||
-rw-r--r-- | compiler/parser/Parser.y.pp | 9 |
2 files changed, 11 insertions, 5 deletions
diff --git a/compiler/parser/Lexer.x b/compiler/parser/Lexer.x index cef5974fb0..b872a7d953 100644 --- a/compiler/parser/Lexer.x +++ b/compiler/parser/Lexer.x @@ -57,7 +57,7 @@ module Lexer ( extension, bangPatEnabled, datatypeContextsEnabled, traditionalRecordSyntaxEnabled, typeLiteralsEnabled, - explicitNamespacesEnabled, + explicitNamespacesEnabled, sccProfilingOn, addWarning, lexTokenStream ) where @@ -1849,6 +1849,8 @@ inRulePragBit :: Int inRulePragBit = 19 rawTokenStreamBit :: Int rawTokenStreamBit = 20 -- producing a token stream with all comments included +sccProfilingOnBit :: Int +sccProfilingOnBit = 21 alternativeLayoutRuleBit :: Int alternativeLayoutRuleBit = 23 relaxedLayoutBit :: Int @@ -1909,6 +1911,8 @@ relaxedLayout :: Int -> Bool relaxedLayout flags = testBit flags relaxedLayoutBit nondecreasingIndentation :: Int -> Bool nondecreasingIndentation flags = testBit flags nondecreasingIndentationBit +sccProfilingOn :: Int -> Bool +sccProfilingOn flags = testBit flags sccProfilingOnBit traditionalRecordSyntaxEnabled :: Int -> Bool traditionalRecordSyntaxEnabled flags = testBit flags traditionalRecordSyntaxBit typeLiteralsEnabled :: Int -> Bool @@ -1975,6 +1979,7 @@ mkPState flags buf loc = .|. rawTokenStreamBit `setBitIf` dopt Opt_KeepRawTokenStream flags .|. alternativeLayoutRuleBit `setBitIf` xopt Opt_AlternativeLayoutRule flags .|. relaxedLayoutBit `setBitIf` xopt Opt_RelaxedLayout flags + .|. sccProfilingOnBit `setBitIf` dopt Opt_SccProfilingOn flags .|. nondecreasingIndentationBit `setBitIf` xopt Opt_NondecreasingIndentation flags .|. safeHaskellBit `setBitIf` safeImportsOn flags .|. traditionalRecordSyntaxBit `setBitIf` xopt Opt_TraditionalRecordSyntax flags diff --git a/compiler/parser/Parser.y.pp b/compiler/parser/Parser.y.pp index 62132277d9..6c19812762 100644 --- a/compiler/parser/Parser.y.pp +++ b/compiler/parser/Parser.y.pp @@ -43,7 +43,7 @@ import OccName ( varName, dataName, tcClsName, tvName ) import DataCon ( DataCon, dataConName ) import SrcLoc import Module -import StaticFlags ( opt_SccProfilingOn, opt_Hpc ) +import StaticFlags ( opt_Hpc ) import Kind ( Kind, liftedTypeKind, unliftedTypeKind, mkArrowKind ) import Class ( FunDep ) import BasicTypes @@ -1402,9 +1402,10 @@ exp10 :: { LHsExpr RdrName } | 'do' stmtlist { L (comb2 $1 $2) (mkHsDo DoExpr (unLoc $2)) } | 'mdo' stmtlist { L (comb2 $1 $2) (mkHsDo MDoExpr (unLoc $2)) } - | scc_annot exp { LL $ if opt_SccProfilingOn - then HsSCC (unLoc $1) $2 - else HsPar $2 } + | scc_annot exp {% do { on <- extension sccProfilingOn + ; return $ LL $ if on + then HsSCC (unLoc $1) $2 + else HsPar $2 } } | hpc_annot exp { LL $ if opt_Hpc then HsTickPragma (unLoc $1) $2 else HsPar $2 } |