diff options
author | Ian Lynagh <igloo@earth.li> | 2011-06-02 00:23:27 +0100 |
---|---|---|
committer | Ian Lynagh <igloo@earth.li> | 2011-06-09 13:01:09 +0100 |
commit | 5f8f1f244f49543cda309303f065c5bdcf961ea4 (patch) | |
tree | b6640c1a7838a53904077e6448ddb0fcb6476242 /compiler/parser/Parser.y.pp | |
parent | 1d746841aafe38044dd9f0de1a8d686ea554a3c7 (diff) | |
download | haskell-srcloc.tar.gz |
Refactor SrcLoc and SrcSpansrcloc
The "Unhelpful" cases are now in a separate type. This allows us to
improve various things, e.g.:
* Most of the panic's in SrcLoc are now gone
* The Lexer now works with RealSrcSpans rather than SrcSpans, i.e. it
knows that it has real locations and thus can assume that the line
number etc really exists
* Some of the more suspicious cases are no longer necessary, e.g.
we no longer need this case in advanceSrcLoc:
advanceSrcLoc loc _ = loc -- Better than nothing
More improvements can probably be made, e.g. tick locations can
probably use RealSrcSpans too.
Diffstat (limited to 'compiler/parser/Parser.y.pp')
-rw-r--r-- | compiler/parser/Parser.y.pp | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/compiler/parser/Parser.y.pp b/compiler/parser/Parser.y.pp index 102f989332..01d768a4d7 100644 --- a/compiler/parser/Parser.y.pp +++ b/compiler/parser/Parser.y.pp @@ -41,9 +41,7 @@ import ForeignCall ( Safety(..), CExportSpec(..), CLabelString, ) import OccName ( varName, dataName, tcClsName, tvName ) import DataCon ( DataCon, dataConName ) -import SrcLoc ( Located(..), unLoc, getLoc, noLoc, combineSrcSpans, - SrcSpan, combineLocs, srcLocFile, - mkSrcLoc, mkSrcSpan ) +import SrcLoc import Module import StaticFlags ( opt_SccProfilingOn, opt_Hpc ) import Type ( Kind, liftedTypeKind, unliftedTypeKind ) @@ -1262,7 +1260,7 @@ quasiquote :: { Located (HsQuasiQuote RdrName) } : TH_QUASIQUOTE { let { loc = getLoc $1 ; ITquasiQuote (quoter, quote, quoteSpan) = unLoc $1 ; quoterId = mkUnqual varName quoter } - in L1 (mkHsQuasiQuote quoterId quoteSpan quote) } + in L1 (mkHsQuasiQuote quoterId (RealSrcSpan quoteSpan) quote) } exp :: { LHsExpr RdrName } : infixexp '::' sigtype { LL $ ExprWithTySig $1 $3 } |