X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2FbasicTypes%2FSrcLoc.lhs;h=85b9b2e068336237b4c807383c291675ba6d6332;hb=4bc25e8c30559b7a6a87b39afcc79340ae778788;hp=a342c8968e9ca4846c4d1b44680ef4af3640db95;hpb=a80b845e7b007611032e7cb5d1a92e9224ff42da;p=ghc-hetmet.git diff --git a/compiler/basicTypes/SrcLoc.lhs b/compiler/basicTypes/SrcLoc.lhs index a342c89..85b9b2e 100644 --- a/compiler/basicTypes/SrcLoc.lhs +++ b/compiler/basicTypes/SrcLoc.lhs @@ -58,6 +58,7 @@ module SrcLoc ( -- ** Constructing Located noLoc, + mkGeneralLocated, -- ** Deconstructing Located getLoc, unLoc, @@ -71,7 +72,6 @@ module SrcLoc ( import Util import Outputable import FastString -import System.FilePath \end{code} %************************************************************************ @@ -166,9 +166,6 @@ cmpSrcLoc (SrcLoc s1 l1 c1) (SrcLoc s2 l2 c2) = (s1 `compare` s2) `thenCmp` (l1 `compare` l2) `thenCmp` (c1 `compare` c2) cmpSrcLoc (SrcLoc _ _ _) _other = GT -pprFastFilePath :: FastString -> SDoc -pprFastFilePath path = text $ normalise $ unpackFS path - instance Outputable SrcLoc where ppr (SrcLoc src_path src_line src_col) = getPprStyle $ \ sty -> @@ -299,7 +296,7 @@ isGoodSrcSpan SrcSpanPoint{} = True isGoodSrcSpan _ = False isOneLineSpan :: SrcSpan -> Bool --- ^ True if the span is known to straddle more than one line. +-- ^ True if the span is known to straddle only one line. -- For "bad" 'SrcSpan', it returns False isOneLineSpan s | isGoodSrcSpan s = srcSpanStartLine s == srcSpanEndLine s @@ -457,6 +454,9 @@ getLoc (L l _) = l noLoc :: e -> Located e noLoc e = L noSrcSpan e +mkGeneralLocated :: String -> e -> Located e +mkGeneralLocated s e = L (mkGeneralSrcSpan (fsLit s)) e + combineLocs :: Located a -> Located b -> SrcSpan combineLocs a b = combineSrcSpans (getLoc a) (getLoc b)