Interface file optimisation and removal of nameParent
[ghc-hetmet.git] / compiler / parser / ParserCore.y
index a6ee5dd..b37add3 100644 (file)
@@ -11,7 +11,7 @@ import Type ( Kind,
               liftedTypeKindTyCon, openTypeKindTyCon, unliftedTypeKindTyCon,
               argTypeKindTyCon, ubxTupleKindTyCon, mkArrowKind, mkTyConApp
             )
-import Name( nameOccName, nameModule )
+import Name( Name, nameOccName, nameModule )
 import Module
 import PackageConfig   ( mainPackageId )
 import ParserCoreUtils
@@ -108,7 +108,7 @@ trep    :: { OccName -> [LConDecl RdrName] }
         | '=' ty        { (\ tc_occ -> let { dc_name  = mkRdrUnqual (setOccNameSpace dataName tc_occ) ;
                                             con_info = PrefixCon [toHsType $2] }
                                        in [noLoc $ ConDecl (noLoc dc_name) Explicit []
-                                          (noLoc []) con_info ResTyH98]) }
+                                          (noLoc []) con_info ResTyH98 Nothing]) }
 
 cons   :: { [LConDecl RdrName] }
        : {- empty -}   { [] } -- 20060420 Empty data types allowed. jds
@@ -116,7 +116,7 @@ cons        :: { [LConDecl RdrName] }
 
 con    :: { LConDecl RdrName }
        : d_pat_occ attv_bndrs hs_atys 
-               { noLoc $ ConDecl (noLoc (mkRdrUnqual $1)) Explicit $2 (noLoc []) (PrefixCon $3) ResTyH98}
+               { noLoc $ ConDecl (noLoc (mkRdrUnqual $1)) Explicit $2 (noLoc []) (PrefixCon $3) ResTyH98 Nothing }
         | d_pat_occ '::' ty
                 -- XXX - audreyt - $3 needs to be split into argument and return types!
                 -- also not sure whether the [] below (quantified vars) appears.
@@ -124,7 +124,7 @@ con :: { LConDecl RdrName }
                 -- also we want to munge $3 somehow.
                 -- extractWhatEver to unpack ty into the parts to ConDecl
                 -- XXX - define it somewhere in RdrHsSyn
-               { noLoc $ ConDecl (noLoc (mkRdrUnqual $1)) Explicit [] (noLoc []) (PrefixCon []) (undefined $3) }
+               { noLoc $ ConDecl (noLoc (mkRdrUnqual $1)) Explicit [] (noLoc []) (PrefixCon []) (undefined $3) Nothing }
 
 attv_bndrs :: { [LHsTyVarBndr RdrName] }
        : {- empty -}            { [] }
@@ -225,7 +225,7 @@ kind        :: { IfaceKind }
 
 aexp    :: { IfaceExpr }
        : var_occ                { IfaceLcl $1 }
-        | modid '.' qd_occ      { IfaceExt (ExtPkg $1 (mkVarOccFS $3)) }
+        | modid '.' qd_occ      { IfaceExt undefined {-ToDo!!! (ExtPkg $1 (mkVarOccFS $3))-} }
        | lit           { IfaceLit $1 }
        | '(' exp ')'   { $2 }
 
@@ -258,7 +258,7 @@ alts1       :: { [IfaceAlt] }
 
 alt    :: { IfaceAlt }
        : modid '.' d_pat_occ bndrs '->' exp 
-               { (IfaceDataAlt $3, map ifaceBndrName $4, $6) } 
+               { (IfaceDataAlt undefined {-ToDo!!! $3 -}, map ifaceBndrName $4, $6) } 
                        -- The external syntax currently includes the types of the
                       -- the args, but they aren't needed internally
                        -- Nor is the module qualifier
@@ -281,8 +281,8 @@ var_occ     :: { FastString }
 
 
 -- Type constructor
-q_tc_name      :: { IfaceExtName }
-        : modid '.' CNAME      { ExtPkg $1 (mkOccName tcName $3) }
+q_tc_name      :: { Name }
+        : modid '.' CNAME      { undefined {-ToDo!!! ExtPkg $1 (mkOccName tcName $3)-} }
 
 -- Data constructor in a pattern or data type declaration; use the dataName, 
 -- because that's what we expect in Core case patterns
@@ -318,10 +318,7 @@ convRatLit i aty
   = pprPanic "Unknown rational literal type" (ppr aty)
 
 eqTc :: IfaceTyCon -> TyCon -> Bool   -- Ugh!
-eqTc (IfaceTc (ExtPkg mod occ)) tycon
-  = mod == nameModule nm && occ == nameOccName nm
-  where
-    nm = tyConName tycon
+eqTc (IfaceTc name) tycon = name == tyConName tycon
 
 -- Tiresomely, we have to generate both HsTypes (in type/class decls) 
 -- and IfaceTypes (in Core expressions).  So we parse them as IfaceTypes,
@@ -361,8 +358,8 @@ ifaceArrow ifT1 ifT2 = IfaceFunTy ifT1 ifT2
 toHsTvBndr :: IfaceTvBndr -> LHsTyVarBndr RdrName
 toHsTvBndr (tv,k) = noLoc $ KindedTyVar (mkRdrUnqual (mkTyVarOcc tv)) (toKind k)
 
-ifaceExtRdrName :: IfaceExtName -> RdrName
-ifaceExtRdrName (ExtPkg mod occ) = mkOrig mod occ
+ifaceExtRdrName :: Name -> RdrName
+ifaceExtRdrName name = mkOrig (nameModule name) (nameOccName name)
 ifaceExtRdrName other = pprPanic "ParserCore.ifaceExtRdrName" (ppr other)
 
 add_forall tv (L _ (HsForAllTy exp tvs cxt t))