Skip to content

Commit

Permalink
Deal with duplicate names
Browse files Browse the repository at this point in the history
Ignore-this: 7ce59603f1421cd0278dd67871164a9a

darcs-hash:20090906164233-6ac22-a2a44f5dcf19abd04bf75deaa6d0ee5730016ef4.gz
  • Loading branch information
eb committed Sep 6, 2009
1 parent c38b607 commit 4e169f7
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion Epic/Scopecheck.lhs
Expand Up @@ -102,6 +102,16 @@ checking we do (for now).
> return $ (DefaultCase expr'):alts'

Turn the argument list into a mapping from names to argument position
If any names appear more than once, use the last one.

We're being very tolerant of input here...

> v_ise [] _ = []
> v_ise ((n,ty):args) i = (n,i):(v_ise args (i+1))
> v_ise ((n,ty):args) i = let rest = v_ise args (i+1) in
> case lookup n rest of
> Nothing -> (n,i):rest
> _ -> rest

where dropArg n [] = []
dropArg n ((x,i):xs) | x == n = dropArg n xs
| otherwise = (x,i):(dropArg n xs)

0 comments on commit 4e169f7

Please sign in to comment.