X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Fcompiler%2FbasicTypes%2FSrcLoc.lhs;fp=ghc%2Fcompiler%2FbasicTypes%2FSrcLoc.lhs;h=c3fca1db6434dd0ea1e4cd035792a04a801aafb0;hb=b085ee40c7f265a5977ea6ec1c415e573be5ff8c;hp=3f89e97e3f7305c49081c44724fc363d76f41785;hpb=f6124b6ca2ec9820f7eb454dbcffbf4b8b790d4f;p=ghc-hetmet.git diff --git a/ghc/compiler/basicTypes/SrcLoc.lhs b/ghc/compiler/basicTypes/SrcLoc.lhs index 3f89e97..c3fca1d 100644 --- a/ghc/compiler/basicTypes/SrcLoc.lhs +++ b/ghc/compiler/basicTypes/SrcLoc.lhs @@ -30,6 +30,7 @@ import Util ( thenCmp ) import Outputable import FastString ( unpackFS ) import FastTypes +import FastString import GlaExts ( (+#) ) \end{code} @@ -43,10 +44,10 @@ We keep information about the {\em definition} point for each entity; this is the obvious stuff: \begin{code} data SrcLoc - = SrcLoc FAST_STRING -- A precise location (file name) + = SrcLoc FastString -- A precise location (file name) FastInt - | UnhelpfulSrcLoc FAST_STRING -- Just a general indication + | UnhelpfulSrcLoc FastString -- Just a general indication | NoSrcLoc \end{code} @@ -66,14 +67,14 @@ Things to make 'em: \begin{code} mkSrcLoc x y = SrcLoc x (iUnbox y) noSrcLoc = NoSrcLoc -importedSrcLoc = UnhelpfulSrcLoc SLIT("") -builtinSrcLoc = UnhelpfulSrcLoc SLIT("") -generatedSrcLoc = UnhelpfulSrcLoc SLIT("") +importedSrcLoc = UnhelpfulSrcLoc FSLIT("") +builtinSrcLoc = UnhelpfulSrcLoc FSLIT("") +generatedSrcLoc = UnhelpfulSrcLoc FSLIT("") isGoodSrcLoc (SrcLoc _ _) = True isGoodSrcLoc other = False -srcLocFile :: SrcLoc -> FAST_STRING +srcLocFile :: SrcLoc -> FastString srcLocFile (SrcLoc fname _) = fname srcLocLine :: SrcLoc -> FastInt @@ -120,18 +121,15 @@ cmpSrcLoc (SrcLoc s1 l1) (SrcLoc s2 l2) = (s1 `compare` s2) `thenCmp` (l1 ` instance Outputable SrcLoc where ppr (SrcLoc src_path src_line) = getPprStyle $ \ sty -> - if userStyle sty then - hcat [ text src_file, char ':', int (iBox src_line) ] - else - if debugStyle sty then - hcat [ ptext src_path, char ':', int (iBox src_line) ] + if userStyle sty || debugStyle sty then + hcat [ ftext src_path, char ':', int (iBox src_line) ] else hcat [text "{-# LINE ", int (iBox src_line), space, - char '\"', ptext src_path, text " #-}"] + char '\"', ftext src_path, text " #-}"] where src_file = unpackFS src_path -- Leave the directory prefix intact, -- so emacs can find the file - ppr (UnhelpfulSrcLoc s) = ptext s + ppr (UnhelpfulSrcLoc s) = ftext s ppr NoSrcLoc = ptext SLIT("") \end{code}