summaryrefslogtreecommitdiff
path: root/compiler/deSugar/Desugar.hs
diff options
context:
space:
mode:
authorBen Gamari <bgamari.foss@gmail.com>2018-06-07 13:20:30 -0400
committerBen Gamari <ben@smart-cactus.org>2018-06-07 18:06:29 -0400
commit64c71ce956af3af593a46ef0d615c7f6fe6ecece (patch)
tree79d2b226b8ad0f500028b12e0d4c38464050eaa2 /compiler/deSugar/Desugar.hs
parentf7417118732d6c8431b3f281c3d34455c7443550 (diff)
downloadhaskell-64c71ce956af3af593a46ef0d615c7f6fe6ecece.tar.gz
Don't use unsafeGlobalDynFlags in optCoercion
This plumbs DynFlags through CoreOpt so optCoercion can finally eliminate its usage of `unsafeGlobalDynFlags`. Note that this doesn't completely eliminate `unsafeGlobalDynFlags` usage from this bit of the compiler. A few uses are introduced in call-sites where we don't (yet) have ready access to `DynFlags`. Test Plan: Validate Reviewers: goldfire Subscribers: rwbarton, thomie, carter Differential Revision: https://phabricator.haskell.org/D4774
Diffstat (limited to 'compiler/deSugar/Desugar.hs')
-rw-r--r--compiler/deSugar/Desugar.hs6
1 files changed, 3 insertions, 3 deletions
diff --git a/compiler/deSugar/Desugar.hs b/compiler/deSugar/Desugar.hs
index b987130802..532bd0077f 100644
--- a/compiler/deSugar/Desugar.hs
+++ b/compiler/deSugar/Desugar.hs
@@ -397,18 +397,18 @@ dsRule (L loc (HsRule _ name rule_act vars lhs rhs))
Left msg -> do { warnDs NoReason msg; return Nothing } ;
Right (final_bndrs, fn_id, args) -> do
- { let is_local = isLocalId fn_id
+ { dflags <- getDynFlags
+ ; let is_local = isLocalId fn_id
-- NB: isLocalId is False of implicit Ids. This is good because
-- we don't want to attach rules to the bindings of implicit Ids,
-- because they don't show up in the bindings until just before code gen
fn_name = idName fn_id
- final_rhs = simpleOptExpr rhs'' -- De-crap it
+ final_rhs = simpleOptExpr dflags rhs'' -- De-crap it
rule_name = snd (unLoc name)
final_bndrs_set = mkVarSet final_bndrs
arg_ids = filterOut (`elemVarSet` final_bndrs_set) $
exprsSomeFreeVarsList isId args
- ; dflags <- getDynFlags
; rule <- dsMkUserRule this_mod is_local
rule_name rule_act fn_name final_bndrs args
final_rhs