diff options
author | Adam Chlipala <adamc@hcoop.net> | 2008-07-17 10:09:34 -0400 |
---|---|---|
committer | Adam Chlipala <adamc@hcoop.net> | 2008-07-17 10:09:34 -0400 |
commit | dcfd6390610712e9d498cdb4e466eb932a6bb138 (patch) | |
tree | 83ba4c2e9b1d7a6ef837f323bed5a279b517fdb9 /src/elab_util.sml | |
parent | c8dc6a0ab0a9f64a6d5bd1bfae94f04dc941e26d (diff) |
Parsing and elaborating (non-mutual) 'val rec'
Diffstat (limited to 'src/elab_util.sml')
-rw-r--r-- | src/elab_util.sml | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/src/elab_util.sml b/src/elab_util.sml index c14b2c60..35f4cfcd 100644 --- a/src/elab_util.sml +++ b/src/elab_util.sml @@ -504,6 +504,8 @@ fun mapfoldB {kind = fk, con = fc, exp = fe, sgn_item = fsgi, sgn = fsg, str = f bind (ctx, NamedC (x, k)) | DVal (x, _, c, _) => bind (ctx, NamedE (x, c)) + | DValRec vis => + foldl (fn ((x, _, c, _), ctx) => bind (ctx, NamedE (x, c))) ctx vis | DSgn (x, _, sgn) => bind (ctx, Sgn (x, sgn)) | DStr (x, _, sgn, _) => @@ -546,12 +548,14 @@ fun mapfoldB {kind = fk, con = fc, exp = fe, sgn_item = fsgi, sgn = fsg, str = f S.map2 (mfc ctx c, fn c' => (DCon (x, n, k', c'), loc))) - | DVal (x, n, c, e) => - S.bind2 (mfc ctx c, - fn c' => - S.map2 (mfe ctx e, - fn e' => - (DVal (x, n, c', e'), loc))) + | DVal vi => + S.map2 (mfvi ctx vi, + fn vi' => + (DVal vi', loc)) + | DValRec vis => + S.map2 (ListUtil.mapfold (mfvi ctx) vis, + fn vis' => + (DValRec vis', loc)) | DSgn (x, n, sgn) => S.map2 (mfsg ctx sgn, fn sgn' => @@ -578,6 +582,13 @@ fun mapfoldB {kind = fk, con = fc, exp = fe, sgn_item = fsgi, sgn = fsg, str = f S.map2 (mfst ctx str, fn str' => (DExport (en, sgn', str'), loc))) + + and mfvi ctx (x, n, c, e) = + S.bind2 (mfc ctx c, + fn c' => + S.map2 (mfe ctx e, + fn e' => + (x, n, c', e'))) in mfd end |