Mercurial > urweb
diff src/shake.sml @ 607:0dd40b6bfdf3
Start of RPCification
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Sat, 14 Feb 2009 14:07:56 -0500 |
parents | 5c9606deacb6 |
children | 56aaa1941dad |
line wrap: on
line diff
--- a/src/shake.sml Tue Jan 27 09:53:51 2009 -0500 +++ b/src/shake.sml Sat Feb 14 14:07:56 2009 -0500 @@ -94,26 +94,31 @@ and shakeCon s = U.Con.fold {kind = kind, con = con} s fun exp (e, s) = - case e of - ENamed n => - if IS.member (#exp s, n) then - s - else - let - val s' = {exp = IS.add (#exp s, n), - con = #con s} - in - (*print ("Need " ^ Int.toString n ^ "\n");*) - case IM.find (edef, n) of - NONE => s' - | SOME (ns, t, e) => - let - val s' = shakeExp (shakeCon s' t) e - in - foldl (fn (n, s') => exp (ENamed n, s')) s' ns - end - end - | _ => s + let + fun check n = + if IS.member (#exp s, n) then + s + else + let + val s' = {exp = IS.add (#exp s, n), + con = #con s} + in + (*print ("Need " ^ Int.toString n ^ "\n");*) + case IM.find (edef, n) of + NONE => s' + | SOME (ns, t, e) => + let + val s' = shakeExp (shakeCon s' t) e + in + foldl (fn (n, s') => exp (ENamed n, s')) s' ns + end + end + in + case e of + ENamed n => check n + | EServerCall (n, _, _) => check n + | _ => s + end and shakeExp s = U.Exp.fold {kind = kind, con = con, exp = exp} s