[project @ 2000-04-11 11:02:31 by simonmar]
[ghc-hetmet.git] / ghc / driver / ghc-iface.lprl
index f14e6dc..80ce281 100644 (file)
@@ -163,6 +163,7 @@ sub constructNewHiFile {
        print NEWHI $Decl{"new:$v"};            # Print the new decl itself
     }
     print NEWHI $Stuff{'new:rules'} unless $Stuff{'new:rules'} eq '';
+    print NEWHI $Stuff{'new:deprecations'} unless $Stuff{'new:deprecations'} eq '';
 
     close(NEWHI) || &tidy_up_and_die(1,"Failed writing to $new_hi\n");
 }
@@ -198,6 +199,7 @@ sub readHiFile {
     $Stuff{"$mod:instances"}       = '';
     $Stuff{"$mod:declarations"}            = '';
     $Stuff{"$mod:rules"}           = '';
+    $Stuff{"$mod:deprecations"}            = '';
 
     if (! -f $hifile) { # no pre-existing .hi file
        $HiExists{$mod} = 0;
@@ -232,6 +234,9 @@ sub readHiFile {
        } elsif ( /^{-## __R / ) {
            $Stuff{"$mod:rules"} .= $_;
        
+       } elsif ( /^{-## __D / ) {
+           $Stuff{"$mod:deprecations"} .= $_;
+       
        } elsif ( /^-[-]+ .*/ ) { # silently ignore comment lines.
            ;
        } else {  # We're in a declaration
@@ -254,8 +259,11 @@ sub readHiFile {
                $Decl{"$mod:$current_name"} = $_;
                if ($mod eq "old") { $OldVersion{$current_name} = $version; }
 
-          } elsif ( /^(newtype|data)\s+(.*\s+=>\s+)?(\S+)\s+/ ) {
+          } elsif ( /^(newtype|data)\s+({.*}\s+=>\s+)?(\S+)\s+/ ) {
                        # Data declaration      
+                       # The (...)? parts skips over the context of a data decl
+                       # to find the name of the type constructor.  The curly
+                       # brackets are part of the iface file syntax for contexts
                $current_name = "data $3";
                $Decl{"$mod:$current_name"} = $_;
                if ($mod eq "old") { $OldVersion{$current_name} = $version; }
@@ -311,7 +319,7 @@ sub calcNewModuleVersion {
        return(&mv_change($changed_version, "orphan-hood changed"));
     }
 
-    foreach $t ( 'usages' , 'exports', 'instances', 'fixities', 'rules' ) {
+    foreach $t ( 'usages' , 'exports', 'instances', 'fixities', 'rules', 'deprecations' ) {
        return(&mv_change($changed_version,"$t changed")) if $Stuff{"old:$t"} ne $Stuff{"new:$t"};
     }