diff options
author | Alan Zimmerman <alan.zimm@gmail.com> | 2015-11-13 08:39:07 +0200 |
---|---|---|
committer | Alan Zimmerman <alan.zimm@gmail.com> | 2015-11-13 08:39:07 +0200 |
commit | 2290c8bd8c3faee0cb7dc1c2c7951bb9d5e3ebf9 (patch) | |
tree | ede1496a88c095fb62431a21c2384b25647c1504 /compiler/deSugar/DsGRHSs.hs | |
parent | 5d6133bec0f682e86ee31bbdb6d82e6fb2ede8f7 (diff) | |
download | haskell-2290c8bd8c3faee0cb7dc1c2c7951bb9d5e3ebf9.tar.gz |
APIAnnotations:add Locations in hsSyn for layout
Summary:
At the moment ghc-exactprint, which uses the GHC API Annotations to
provide a framework for roundtripping Haskell source code with optional
AST edits, has to implement a horrible workaround to manage the points
where layout needs to be captured.
These are
MatchGroup
HsDo
HsCmdDo
HsLet
LetStmt
HsCmdLet
GRHSs
To provide a more natural representation, the contents subject to layout
rules need to be wrapped in a SrcSpan.
This commit does this.
Trac ticket #10250
Test Plan: ./validate
Reviewers: hvr, goldfire, bgamari, austin, mpickering
Reviewed By: mpickering
Subscribers: thomie, mpickering
Differential Revision: https://phabricator.haskell.org/D1370
GHC Trac Issues: #10250
Diffstat (limited to 'compiler/deSugar/DsGRHSs.hs')
-rw-r--r-- | compiler/deSugar/DsGRHSs.hs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/compiler/deSugar/DsGRHSs.hs b/compiler/deSugar/DsGRHSs.hs index 6e4056a7c3..3eafd12c73 100644 --- a/compiler/deSugar/DsGRHSs.hs +++ b/compiler/deSugar/DsGRHSs.hs @@ -57,7 +57,7 @@ dsGRHSs :: HsMatchContext Name -> [Pat Id] -- These are to build a MatchCon -> GRHSs Id (LHsExpr Id) -- Guarded RHSs -> Type -- Type of RHS -> DsM MatchResult -dsGRHSs hs_ctx _ (GRHSs grhss binds) rhs_ty +dsGRHSs hs_ctx _ (GRHSs grhss (L _ binds)) rhs_ty = ASSERT( notNull grhss ) do { match_results <- mapM (dsGRHS hs_ctx rhs_ty) grhss ; let match_result1 = foldr1 combineMatchResults match_results @@ -106,7 +106,7 @@ matchGuards (BodyStmt expr _ _ _ : stmts) ctx rhs rhs_ty = do pred_expr <- dsLExpr expr return (mkGuardedMatchResult pred_expr match_result) -matchGuards (LetStmt binds : stmts) ctx rhs rhs_ty = do +matchGuards (LetStmt (L _ binds) : stmts) ctx rhs rhs_ty = do match_result <- matchGuards stmts ctx rhs rhs_ty return (adjustMatchResultDs (dsLocalBinds binds) match_result) -- NB the dsLet occurs inside the match_result |