[project @ 2000-12-20 10:38:18 by simonmar]
[ghc-hetmet.git] / ghc / compiler / main / CodeOutput.lhs
index 0d865b9..84f5645 100644 (file)
@@ -22,6 +22,7 @@ import qualified PrintJava
 import TyCon           ( TyCon )
 import Id              ( Id )
 import CoreSyn         ( CoreBind )
+import OccurAnal       ( occurAnalyseBinds )
 import StgSyn          ( StgBinding )
 import AbsCSyn         ( AbstractC )
 import PprAbsC         ( dumpRealC, writeRealC )
@@ -135,7 +136,9 @@ outputJava dflags filenm mod tycons core_binds
   = doOutput filenm (\ f -> printForUser f alwaysQualify pp_java)
        -- User style printing for now to keep indentation
   where
-    java_code = javaGen mod [{- Should be imports-}] tycons core_binds
+    occ_anal_binds = occurAnalyseBinds core_binds
+       -- Make sure we have up to date dead-var information
+    java_code = javaGen mod [{- Should be imports-}] tycons occ_anal_binds
     pp_java   = PrintJava.compilationUnit java_code
 \end{code}
 
@@ -177,9 +180,9 @@ outputForeignStubs dflags c_code h_code
 -- turn out to be empty, in which case no file should be created.
 outputForeignStubs_help is_header ""      = return Nothing
 outputForeignStubs_help is_header doc_str 
-   = newTempName suffix >>= \ fname ->
-     writeFile fname (include_prefix ++ doc_str) >>
-     return (Just suffix)
+   = do fname <- newTempName suffix
+        writeFile fname (include_prefix ++ doc_str)
+        return (Just fname)
   where
     suffix
        | is_header   = "h_stub"