[project @ 2000-04-05 16:57:18 by sewardj]
[ghc-hetmet.git] / ghc / interpreter / static.c
index e2cf438..0c99493 100644 (file)
@@ -9,8 +9,8 @@
  * included in the distribution.
  *
  * $RCSfile: static.c,v $
- * $Revision: 1.32 $
- * $Date: 2000/03/23 14:54:21 $
+ * $Revision: 1.37 $
+ * $Date: 2000/04/05 14:14:51 $
  * ------------------------------------------------------------------------*/
 
 #include "hugsbasictypes.h"
@@ -470,10 +470,12 @@ Pair importSpec; {
         hidden  = resolveImportList(m, snd(impList),FALSE);
         imports = resolveImportList(m, DOTDOT,FALSE);
     } else if (isPair(impList) && STAR == fst(impList)) {
-      List privileged;
-      imports = resolveImportList(m, DOTDOT, FALSE);
-      privileged = resolveImportList(m, snd(impList),TRUE);
-      imports = dupOnto(privileged,imports);
+       // Previously, I was forcing an import Prelude,
+       // but this precluded doing things like 
+       // import Prelude hiding ( catch) 
+       // so, for now, you need to put an explicit
+       // import Prelude if you use import privileged.
+      imports = resolveImportList(m, snd(impList),TRUE);
     } else {
         imports = resolveImportList(m, impList,FALSE);
     }
@@ -1029,6 +1031,7 @@ Cell  cd; {                             /* definitions (w or w/o deriving) */
             name(n).defn = nameId;
         } else {
             implementCfun(n,scs);
+            name(n).hasStrict = nonNull(scs);
         }
 
         hd(cs) = n;
@@ -4510,7 +4513,7 @@ Cell g; {                              /* expression                       */
 static Cell local depExpr(line,e)      /* find dependents of expression    */
 Int  line;
 Cell e; {
-  //    Printf( "\n\n"); print(e,100); Printf("\n");
+  //Printf( "\n\n"); print(e,100); Printf("\n");
   //printExp(stdout,e);
     switch (whatIs(e)) {
 
@@ -4717,12 +4720,6 @@ Cell e; {
         EEND;
     }
 
-#if 0
-    what is this for??
-    if (!moduleThisScript(name(n).mod)) {
-        return n;
-    }
-#endif
     /* Later phases of the system cannot cope if we resolve references
      * to unprocessed objects too early.  This is the main reason that
      * we cannot cope with recursive modules at the moment.
@@ -5024,6 +5021,7 @@ Void checkContext(void) {         /* Top level static check on Expr  */
 #endif
 
 Void checkDefns ( Module thisModule ) { /* Top level static analysis       */
+    Text modName = module(thisModule).text;
 
     staticAnalysis(RESET);
 
@@ -5033,17 +5031,17 @@ Void checkDefns ( Module thisModule ) { /* Top level static analysis       */
     mapProc(checkQualImport,  module(thisModule).qualImports);
     mapProc(checkUnqualImport,unqualImports);
     /* Add "import Prelude" if there`s no explicit import */
-    if (thisModule!=modulePrelude
-        && isNull(cellAssoc(modulePrelude,unqualImports))
-        && isNull(cellRevAssoc(modulePrelude,module(thisModule).qualImports))) {
-        unqualImports = cons(pair(modulePrelude,DOTDOT),unqualImports);
+    if (modName == textPrimPrel || modName == textPrelude) {
+      /* Nothing. */
+    } else if (isNull(cellAssoc(modulePrelude,unqualImports))
+              && isNull(cellRevAssoc(modulePrelude,module(thisModule).qualImports))) {
+      unqualImports = cons(pair(modulePrelude,DOTDOT),unqualImports);
     } else {
-        /* Every module (including the Prelude) implicitly contains 
-         * "import qualified Prelude" 
-         */
-        module(thisModule).qualImports
-           =cons(pair(mkCon(textPrelude),modulePrelude),
-                 module(thisModule).qualImports);
+      /* Every module implicitly contains "import qualified Prelude" 
+       */
+      module(thisModule).qualImports
+       =cons(pair(mkCon(textPrelude),modulePrelude),
+             module(thisModule).qualImports);
     }
     mapProc(checkImportList, unqualImports);