comparison src/corify.sml @ 124:541282b81454

Explifying (non-mutual) 'val rec'
author Adam Chlipala <adamc@hcoop.net>
date Thu, 17 Jul 2008 10:13:18 -0400
parents 2d6116de9cca
children fd98dd10dce7
comparison
equal deleted inserted replaced
123:e3041657d653 124:541282b81454
382 else 382 else
383 x 383 x
384 in 384 in
385 ([(L'.DVal (x, n, corifyCon st t, corifyExp st e, s), loc)], st) 385 ([(L'.DVal (x, n, corifyCon st t, corifyExp st e, s), loc)], st)
386 end 386 end
387 | L.DValRec _ => raise Fail "Explify DValRec"
387 388
388 | L.DSgn _ => ([], st) 389 | L.DSgn _ => ([], st)
389 390
390 | L.DStr (x, n, _, (L.StrFun (_, na, _, _, str), _)) => 391 | L.DStr (x, n, _, (L.StrFun (_, na, _, _, str), _)) =>
391 ([], St.bindFunctor st x n na str) 392 ([], St.bindFunctor st x n na str)
529 end 530 end
530 531
531 fun maxName ds = foldl (fn ((d, _), n) => 532 fun maxName ds = foldl (fn ((d, _), n) =>
532 case d of 533 case d of
533 L.DCon (_, n', _, _) => Int.max (n, n') 534 L.DCon (_, n', _, _) => Int.max (n, n')
534 | L.DVal (_, n', _ , _) => Int.max (n, n') 535 | L.DVal (_, n', _, _) => Int.max (n, n')
536 | L.DValRec vis => foldl (fn ((_, n', _, _), n) => Int.max (n, n)) n vis
535 | L.DSgn (_, n', _) => Int.max (n, n') 537 | L.DSgn (_, n', _) => Int.max (n, n')
536 | L.DStr (_, n', _, str) => Int.max (n, Int.max (n', maxNameStr str)) 538 | L.DStr (_, n', _, str) => Int.max (n, Int.max (n', maxNameStr str))
537 | L.DFfiStr (_, n', _) => Int.max (n, n') 539 | L.DFfiStr (_, n', _) => Int.max (n, n')
538 | L.DExport _ => n) 540 | L.DExport _ => n)
539 0 ds 541 0 ds