X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Fcompiler%2Frename%2FRnBinds.lhs;h=33dacd7d73c274c94efbada145d676021dcad5be;hb=b4775e5e760111e2d71fba3c44882dce390edfb2;hp=bc82621ab8920646ab25faca33a057c43d61a197;hpb=9a9c18a5c8a3875cdd8f29972e21d6a0f8257451;p=ghc-hetmet.git diff --git a/ghc/compiler/rename/RnBinds.lhs b/ghc/compiler/rename/RnBinds.lhs index bc82621..33dacd7 100644 --- a/ghc/compiler/rename/RnBinds.lhs +++ b/ghc/compiler/rename/RnBinds.lhs @@ -32,7 +32,7 @@ import RnEnv ( bindLocatedLocalsRn, lookupBndrRn, ) import CmdLineOpts ( DynFlag(..) ) import Digraph ( stronglyConnComp, SCC(..) ) -import Name ( OccName, Name, nameOccName, nameSrcLoc ) +import Name ( Name, nameOccName, nameSrcLoc ) import NameSet import RdrName ( RdrName, rdrNameOcc ) import BasicTypes ( RecFlag(..) ) @@ -69,8 +69,6 @@ within one @MonoBinds@, so that unique-Int plumbing is done explicitly \begin{code} type VertexTag = Int -type Cycle = [VertexTag] -type Edge = (VertexTag, VertexTag) \end{code} %************************************************************************ @@ -169,16 +167,16 @@ rnTopMonoBinds mbinds sigs bndr_name_set = mkNameSet binder_names in renameSigsFVs (okBindSig bndr_name_set) sigs `thenRn` \ (siglist, sig_fvs) -> - doptRn Opt_WarnMissingSigs `thenRn` \ warnMissing -> - let - type_sig_vars = [n | Sig n _ _ <- siglist] - un_sigd_binders | warnMissing = nameSetToList (delListFromNameSet - bndr_name_set type_sig_vars) - | otherwise = [] - in - mapRn_ missingSigWarn un_sigd_binders `thenRn_` - rn_mono_binds siglist mbinds `thenRn` \ (final_binds, bind_fvs) -> + ifOptRn Opt_WarnMissingSigs ( + let + type_sig_vars = [n | Sig n _ _ <- siglist] + un_sigd_binders = nameSetToList (delListFromNameSet bndr_name_set type_sig_vars) + in + mapRn_ missingSigWarn un_sigd_binders + ) `thenRn_` + + rn_mono_binds siglist mbinds `thenRn` \ (final_binds, bind_fvs) -> returnRn (final_binds, bind_fvs `plusFV` sig_fvs) where binder_rdr_names = collectMonoBinders mbinds @@ -239,7 +237,7 @@ rnMonoBinds mbinds sigs thing_inside -- Non-empty monobinds rn_mono_binds siglist mbinds `thenRn` \ (binds, bind_fvs) -> -- Now do the "thing inside", and deal with the free-variable calculations - thing_inside binds `thenRn` \ (result,result_fvs) -> + thing_inside binds `thenRn` \ (result,result_fvs) -> let all_fvs = result_fvs `plusFV` bind_fvs `plusFV` sig_fvs unused_binders = nameSetToList (binder_set `minusNameSet` all_fvs) @@ -265,8 +263,8 @@ This is done {\em either} by pass 3 (for the top-level bindings), \begin{code} rn_mono_binds :: [RenamedSig] -- Signatures attached to this group -> RdrNameMonoBinds - -> RnMS (RenamedHsBinds, -- - FreeVars) -- Free variables + -> RnMS (RenamedHsBinds, -- Dependency analysed + FreeVars) -- Free variables rn_mono_binds siglist mbinds = @@ -387,7 +385,7 @@ rnMethodBinds gen_tyvars (FunMonoBind name inf matches locn) returnRn (FunMonoBind sel_name inf new_matches locn, fvs `addOneFV` sel_name) where -- Gruesome; bring into scope the correct members of the generic type variables - -- See comments in RnSource.rnDecl(ClassDecl) + -- See comments in RnSource.rnSourceDecl(ClassDecl) rn_match match@(Match _ (TypePatIn ty : _) _ _) = extendTyVarEnvFVRn gen_tvs (rnMatch match) where @@ -548,29 +546,6 @@ renameSig (NoInlineSig v p src_loc) returnRn (NoInlineSig new_v p src_loc) \end{code} -\begin{code} -renameIE :: (RdrName -> RnMS Name) -> IE RdrName -> RnMS (IE Name, FreeVars) -renameIE lookup_occ_nm (IEVar v) - = lookup_occ_nm v `thenRn` \ new_v -> - returnRn (IEVar new_v, unitFV new_v) - -renameIE lookup_occ_nm (IEThingAbs v) - = lookup_occ_nm v `thenRn` \ new_v -> - returnRn (IEThingAbs new_v, unitFV new_v) - -renameIE lookup_occ_nm (IEThingAll v) - = lookup_occ_nm v `thenRn` \ new_v -> - returnRn (IEThingAll new_v, unitFV new_v) - -renameIE lookup_occ_nm (IEThingWith v vs) - = lookup_occ_nm v `thenRn` \ new_v -> - mapRn lookup_occ_nm vs `thenRn` \ new_vs -> - returnRn (IEThingWith new_v new_vs, plusFVs [ unitFV x | x <- new_v:new_vs ]) - -renameIE lookup_occ_nm (IEModuleContents m) - = returnRn (IEModuleContents m, emptyFVs) -\end{code} - %************************************************************************ %* *