X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Fcompiler%2Fmain%2FHscStats.lhs;h=61eb47e8a3bdf3b197255aebd60459f5519ec52e;hb=b4623557bb3c8bec7232e4e68a8be8cf28fbbda6;hp=8d115aebce46a34c9cbdd80d193b045436e37b79;hpb=6c1d2ec4f8f08d77e39de6f79afa4143110901fa;p=ghc-hetmet.git diff --git a/ghc/compiler/main/HscStats.lhs b/ghc/compiler/main/HscStats.lhs index 8d115ae..61eb47e 100644 --- a/ghc/compiler/main/HscStats.lhs +++ b/ghc/compiler/main/HscStats.lhs @@ -8,7 +8,6 @@ module HscStats ( ppSourceStats ) where #include "HsVersions.h" -import IO ( hPutStr, stderr ) import HsSyn import Outputable import Char ( isSpace ) @@ -68,7 +67,7 @@ ppSourceStats short (HsModule name version exports imports decls _ src_loc) -- in class decls. ToDo tycl_decls = [d | TyClD d <- decls] - (class_ds, data_ds, newt_ds, type_ds) = countTyClDecls tycl_decls + (class_ds, data_ds, newt_ds, type_ds, _) = countTyClDecls tycl_decls inst_decls = [d | InstD d <- decls] inst_ds = length inst_decls @@ -105,13 +104,15 @@ ppSourceStats short (HsModule name version exports imports decls _ src_loc) count_monobinds (PatMonoBind p r _) = (0,1) count_monobinds (FunMonoBind f _ m _) = (0,1) + count_mb_monobinds (Just mbs) = count_monobinds mbs + count_mb_monobinds Nothing = (0,0) + count_sigs sigs = foldr add4 (0,0,0,0) (map sig_info sigs) sig_info (Sig _ _ _) = (1,0,0,0) sig_info (ClassOpSig _ _ _ _) = (0,1,0,0) sig_info (SpecSig _ _ _) = (0,0,1,0) - sig_info (InlineSig _ _ _) = (0,0,0,1) - sig_info (NoInlineSig _ _ _) = (0,0,0,1) + sig_info (InlineSig _ _ _ _) = (0,0,0,1) sig_info _ = (0,0,0,0) import_info (ImportDecl _ _ qual as spec _) @@ -124,14 +125,14 @@ ppSourceStats short (HsModule name version exports imports decls _ src_loc) spec_info (Just (False, _)) = (0,0,0,0,1,0) spec_info (Just (True, _)) = (0,0,0,0,0,1) - data_info (TyData _ _ _ _ _ nconstrs derivs _ _ _ _) + data_info (TyData {tcdNCons = nconstrs, tcdDerivs = derivs}) = (nconstrs, case derivs of {Nothing -> 0; Just ds -> length ds}) data_info other = (0,0) - class_info (ClassDecl _ _ _ _ meth_sigs def_meths _ _ _ ) - = case count_sigs meth_sigs of + class_info decl@(ClassDecl {}) + = case count_sigs (tcdSigs decl) of (_,classops,_,_) -> - (classops, addpr (count_monobinds def_meths)) + (classops, addpr (count_mb_monobinds (tcdMeths decl))) class_info other = (0,0) inst_info (InstDecl _ inst_meths inst_sigs _ _)