diff options
author | simonpj <unknown> | 1998-12-18 17:42:39 +0000 |
---|---|---|
committer | simonpj <unknown> | 1998-12-18 17:42:39 +0000 |
commit | 7e602b0a11e567fcb035d1afd34015aebcf9a577 (patch) | |
tree | 54ca13c3ec0704e343b68d0d313a29f53d6c3855 /ghc/compiler/parser/syntax.c | |
parent | 139f0fd30e19f934aa51885a52b8e5d7c24ee460 (diff) | |
download | haskell-7e602b0a11e567fcb035d1afd34015aebcf9a577.tar.gz |
[project @ 1998-12-18 17:40:31 by simonpj]
Another big commit from Simon. Actually, the last one
didn't all go into the main trunk; because of a CVS glitch it
ended up in the wrong branch.
So this commit includes:
* Scoped type variables
* Warnings for unused variables should work now (they didn't before)
* Simplifier improvements:
- Much better treatment of strict arguments
- Better treatment of bottoming Ids
- No need for w/w split for fns that are merely strict
- Fewer iterations needed, I hope
* Less gratuitous renaming in interface files and abs C
* OccName is a separate module, and is an abstract data type
I think the whole Prelude and Exts libraries compile correctly.
Something isn't quite right about typechecking existentials though.
Diffstat (limited to 'ghc/compiler/parser/syntax.c')
-rw-r--r-- | ghc/compiler/parser/syntax.c | 61 |
1 files changed, 36 insertions, 25 deletions
diff --git a/ghc/compiler/parser/syntax.c b/ghc/compiler/parser/syntax.c index ad5b3f60a3..989ce0c0bc 100644 --- a/ghc/compiler/parser/syntax.c +++ b/ghc/compiler/parser/syntax.c @@ -63,17 +63,37 @@ checkfixity(vals) /* - 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*/ @@ -215,11 +235,14 @@ expORpat(int wanted, tree e) } 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: @@ -298,6 +321,7 @@ error_if_patt_wanted(int wanted, char *msg) /* ---------------------------------------------------------------------- */ + BOOLEAN /* return TRUE if LHS is a pattern */ lhs_is_patt(tree e) { @@ -433,28 +457,15 @@ binding rule; 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)); -} - + + else */ -pbinding -createpat(guards,where) - pbinding guards; - binding where; -{ - qid func; - - 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)); } |