summaryrefslogtreecommitdiff
path: root/src/jscomp.sml
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adamc@hcoop.net>2010-11-26 11:57:04 -0500
committerGravatar Adam Chlipala <adamc@hcoop.net>2010-11-26 11:57:04 -0500
commit99fdcac63e9a5a55a95c31ef569f025d2f25876d (patch)
tree797cfeacd60b528213c49c09abf7da63ba136ad8 /src/jscomp.sml
parent4f2c619bb0971153c518f120c8911ce3a94f783d (diff)
Fix JavaScript unit unurlification; URL blessing client-side
Diffstat (limited to 'src/jscomp.sml')
-rw-r--r--src/jscomp.sml19
1 files changed, 16 insertions, 3 deletions
diff --git a/src/jscomp.sml b/src/jscomp.sml
index 6beb6a32..992a2e30 100644
--- a/src/jscomp.sml
+++ b/src/jscomp.sml
@@ -278,8 +278,8 @@ fun process file =
fun unurlifyExp loc (t : typ, st) =
case #1 t of
- TRecord [] => ("null", st)
- | TFfi ("Basis", "unit") => ("null", st)
+ TRecord [] => ("(i++,null)", st)
+ | TFfi ("Basis", "unit") => ("(i++,null)", st)
| TRecord [(x, t)] =>
let
val (e, st) = unurlifyExp loc (t, st)
@@ -1285,9 +1285,22 @@ fun process file =
| SOME line => lines (line :: acc)
val lines = lines []
+ val urlRules = foldr (fn (r, s) =>
+ "cons({allow:"
+ ^ (if #action r = Settings.Allow then "true" else "false")
+ ^ ",prefix:"
+ ^ (if #kind r = Settings.Prefix then "true" else "false")
+ ^ ",pattern:\""
+ ^ #pattern r
+ ^ "\"},"
+ ^ s
+ ^ ")") "null" (Settings.getUrlRules ())
+
+ val urlRules = "urlRules = " ^ urlRules ^ ";\n\n"
+
val script =
if !foundJavaScript then
- lines ^ String.concat (rev (#script st))
+ lines ^ urlRules ^ String.concat (rev (#script st))
else
""
in