-/* -*- mode: hugs-c; -*- */
+
/* --------------------------------------------------------------------------
* Substitute variables in an expression
*
- * Copyright (c) The University of Nottingham and Yale University, 1994-1997.
- * All rights reserved. See NOTICE for details and conditions of use etc...
- * Hugs version 1.4, December 1997
+ * The Hugs 98 system is Copyright (c) Mark P Jones, Alastair Reid, the
+ * Yale Haskell Group, and the Oregon Graduate Institute of Science and
+ * Technology, 1994-1999, All rights reserved. It is distributed as
+ * free software under the license in the file "License", which is
+ * included in the distribution.
*
* $RCSfile: stgSubst.c,v $
- * $Revision: 1.2 $
- * $Date: 1998/12/02 13:22:40 $
+ * $Revision: 1.8 $
+ * $Date: 2000/03/23 14:54:21 $
* ------------------------------------------------------------------------*/
-#include "prelude.h"
+#include "hugsbasictypes.h"
#include "storage.h"
#include "connect.h"
#include "errors.h"
-#include "stg.h"
-
-#include "stgSubst.h"
/* --------------------------------------------------------------------------
* Local function prototypes:
static Void substAlt( List sub, StgCaseAlt alt )
{
- stgCaseAltBody(alt) = substExpr(sub,stgCaseAltBody(alt));
+ if (isDefaultAlt(alt))
+ stgDefaultBody(alt) = substExpr(sub,stgDefaultBody(alt)); else
+ stgCaseAltBody(alt) = substExpr(sub,stgCaseAltBody(alt));
}
static Void substPrimAlt( List sub, StgPrimAlt alt )
stgAppFun(e) = substVar(sub,stgAppFun(e));
map1Over(substAtom,sub,stgAppArgs(e));
break;
+ case STGCON:
+ map1Over(substAtom,sub,stgConArgs(e));
+ break;
case STGVAR:
case NAME:
return substVar(sub,e);
return e;
}
+
/*-------------------------------------------------------------------------*/