/*
- Check Previous Pattern usage
+ We've found a function definition. See if it defines the
+ same function as the previous definition (at this indentation level).
+ If so, set SAMEFN.
+ Set FN to the name of the function.
*/
void
-checksamefn(fn)
- qid fn;
+checksamefn(lhs)
+ tree lhs;
{
- char *this = qid_to_string(fn);
- char *was = (FN==NULL) ? NULL : qid_to_string(FN);
+ tree fn;
+ qid fn_id;
+ char *this, *was;
+ fn = function(lhs);
+
+ if (ttree(fn) == ident) {
+ fn_id = gident((struct Sident *) fn);
+ }
+ else if (ttree(fn) == infixap) {
+ fn_id = ginffun((struct Sinfixap *) fn);
+ }
+ else {
+ fprintf( stderr, "Wierd funlhs" );
+ return;
+ }
+
+ this = qid_to_string(fn_id);
+ was = (FN==NULL) ? NULL : qid_to_string(FN);
SAMEFN = (was != NULL && strcmp(this,was) == 0);
+ FN = fn_id;
if(!SAMEFN && etags)
#if 1/*etags*/
}
break;
+ case restr: /* type sig */
+ expORpat(wanted, grestre(e));
+ break;
+
case par: /* parenthesised */
expORpat(wanted, gpare(e));
break;
- case restr:
case lambda:
case let:
case casee:
/* ---------------------------------------------------------------------- */
+
BOOLEAN /* return TRUE if LHS is a pattern */
lhs_is_patt(tree e)
{
if(tbinding(bind) == abind)
bind = gabindsnd(bind);
- if(tbinding(bind) == pbind)
+ /* if(tbinding(bind) == pbind)
gpbindl(bind) = lconc(gpbindl(bind), gpbindl(rule));
- else if(tbinding(bind) == fbind)
- gfbindl(bind) = lconc(gfbindl(bind), gfbindl(rule));
- else
- fprintf(stderr,"bind error in decl (%d)\n",tbinding(bind));
-}
-
-
-pbinding
-createpat(guards,where)
- pbinding guards;
- binding where;
-{
- qid func;
+
+ else */
- if(FN != NULL)
- func = FN;
+ if(tbinding(bind) == fbind)
+ gfbindm(bind) = lconc(gfbindm(bind), gfbindm(rule));
else
- func = mknoqual(install_literal(""));
-
- return(mkpgrhs(PREVPATT,guards,where,func,endlineno));
+ fprintf(stderr,"bind error in decl (%d)\n",tbinding(bind));
}
}
}
-
/* Check that a type is of the form
C a1 a2 .. an
where n>=1, and the ai are all type variables