Mercurial > urweb
comparison src/expl_rename.sml @ 1991:7db8356caef5
Tweaked parameter renaming for functors, so now demos and the original bug-triggering application work
author | Adam Chlipala <adam@chlipala.net> |
---|---|
date | Thu, 20 Feb 2014 15:50:33 -0500 |
parents | 7bd2ecf96bb0 |
children | 403f0cc65b9c |
comparison
equal
deleted
inserted
replaced
1990:7bd2ecf96bb0 | 1991:7db8356caef5 |
---|---|
420 let | 420 let |
421 val st = St.create NextId | 421 val st = St.create NextId |
422 val (st, n) = St.bind (st, FormalId) | 422 val (st, n) = St.bind (st, FormalId) |
423 | 423 |
424 val (ds, st) = ListUtil.foldlMapConcat dupDecl st ds | 424 val (ds, st) = ListUtil.foldlMapConcat dupDecl st ds |
425 | |
426 (* Revenge of the functor parameter renamer! | |
427 * See comment in elaborate.sml for the start of the saga. | |
428 * We need to alpha-rename the argument to allow sufficient shadowing in the body. *) | |
429 | |
430 fun mungeName m = | |
431 if List.exists (fn (DStr (x, _, _, _), _) => x = m | |
432 | _ => false) ds then | |
433 mungeName ("?" ^ m) | |
434 else | |
435 m | |
436 | |
437 val FormalName = mungeName FormalName | |
438 | |
425 val ds = (DStr (FormalName, n, (SgnConst [], loc), (StrVar FormalId, loc)), loc) :: ds | 439 val ds = (DStr (FormalName, n, (SgnConst [], loc), (StrVar FormalId, loc)), loc) :: ds |
426 in | 440 in |
427 (St.next st, (StrConst ds, loc)) | 441 (St.next st, (StrConst ds, loc)) |
428 end | 442 end |
429 | _ => (NextId, all) | 443 | _ => (NextId, all) |