diff options
author | 2009-03-26 15:26:35 -0400 | |
---|---|---|
committer | 2009-03-26 15:26:35 -0400 | |
commit | ea1046a80313fc7f22c97587bdffb3f90e91eb98 (patch) | |
tree | 04c0c60d822430bac17b3e0c52291ddb8c5dc454 /src/monoize.sml | |
parent | 17164a11b7905fda774935471215a36f3f83a820 (diff) |
Make sql_injectable class nicer with inclusion
Diffstat (limited to 'src/monoize.sml')
-rw-r--r-- | src/monoize.sml | 50 |
1 files changed, 30 insertions, 20 deletions
diff --git a/src/monoize.sml b/src/monoize.sml index 87530070..1860fd19 100644 --- a/src/monoize.sml +++ b/src/monoize.sml @@ -163,6 +163,8 @@ fun monoType env = | L.CFfi ("Basis", "sql_offset") => (L'.TFfi ("Basis", "string"), loc) + | L.CApp ((L.CFfi ("Basis", "sql_injectable_prim"), _), t) => + (L'.TFun (mt env dtmap t, (L'.TFfi ("Basis", "string"), loc)), loc) | L.CApp ((L.CFfi ("Basis", "sql_injectable"), _), t) => (L'.TFun (mt env dtmap t, (L'.TFfi ("Basis", "string"), loc)), loc) | L.CApp ((L.CApp ((L.CFfi ("Basis", "sql_unary"), _), _), _), _) => @@ -1423,26 +1425,34 @@ fun monoExp (env, st, fm) (all as (e, loc)) = ((L'.EAbs ("x", (L'.TFfi ("Basis", "time"), loc), (L'.TFfi ("Basis", "string"), loc), (L'.EFfiApp ("Basis", "sqlifyTime", [(L'.ERel 0, loc)]), loc)), loc), fm) - | L.EFfi ("Basis", "sql_option_int") => - ((L'.EAbs ("x", (L'.TOption (L'.TFfi ("Basis", "int"), loc), loc), (L'.TFfi ("Basis", "string"), loc), - (L'.EFfiApp ("Basis", "sqlifyIntN", [(L'.ERel 0, loc)]), loc)), loc), - fm) - | L.EFfi ("Basis", "sql_option_float") => - ((L'.EAbs ("x", (L'.TOption (L'.TFfi ("Basis", "float"), loc), loc), (L'.TFfi ("Basis", "string"), loc), - (L'.EFfiApp ("Basis", "sqlifyFloatN", [(L'.ERel 0, loc)]), loc)), loc), - fm) - | L.EFfi ("Basis", "sql_option_bool") => - ((L'.EAbs ("x", (L'.TOption (L'.TFfi ("Basis", "bool"), loc), loc), (L'.TFfi ("Basis", "string"), loc), - (L'.EFfiApp ("Basis", "sqlifyBoolN", [(L'.ERel 0, loc)]), loc)), loc), - fm) - | L.EFfi ("Basis", "sql_option_string") => - ((L'.EAbs ("x", (L'.TOption (L'.TFfi ("Basis", "string"), loc), loc), (L'.TFfi ("Basis", "string"), loc), - (L'.EFfiApp ("Basis", "sqlifyStringN", [(L'.ERel 0, loc)]), loc)), loc), - fm) - | L.EFfi ("Basis", "sql_option_time") => - ((L'.EAbs ("x", (L'.TOption (L'.TFfi ("Basis", "time"), loc), loc), (L'.TFfi ("Basis", "string"), loc), - (L'.EFfiApp ("Basis", "sqlifyTimeN", [(L'.ERel 0, loc)]), loc)), loc), - fm) + | L.ECApp ((L.EFfi ("Basis", "sql_prim"), _), t) => + let + val t = monoType env t + val tf = (L'.TFun (t, (L'.TFfi ("Basis", "string"), loc)), loc) + in + ((L'.EAbs ("f", tf, tf, (L'.ERel 0, loc)), loc), + fm) + end + | L.ECApp ((L.EFfi ("Basis", "sql_option_prim"), _), t) => + let + val t = monoType env t + val s = (L'.TFfi ("Basis", "string"), loc) + in + ((L'.EAbs ("f", + (L'.TFun (t, s), loc), + (L'.TFun ((L'.TOption t, loc), s), loc), + (L'.EAbs ("x", + (L'.TOption t, loc), + s, + (L'.ECase ((L'.ERel 0, loc), + [((L'.PNone t, loc), + (L'.EPrim (Prim.String "NULL"), loc)), + ((L'.PSome (t, (L'.PVar ("y", t), loc)), loc), + (L'.EApp ((L'.ERel 2, loc), (L'.ERel 0, loc)), loc))], + {disc = (L'.TOption t, loc), + result = s}), loc)), loc)), loc), + fm) + end | L.ECApp ((L.EFfi ("Basis", "sql_subset"), _), _) => ((L'.ERecord [], loc), fm) |