diff src/jscomp.sml @ 1111:e1d738870086

JavaScript urlification; more lenient export pattern in Corify; only include scripts in pages that use JavaScript
author Adam Chlipala <adamc@hcoop.net>
date Sat, 02 Jan 2010 14:54:15 -0500
parents b2311dfb3158
children 7a31e0cf25e9
line wrap: on
line diff
--- a/src/jscomp.sml	Sat Jan 02 13:31:59 2010 -0500
+++ b/src/jscomp.sml	Sat Jan 02 14:54:15 2010 -0500
@@ -869,10 +869,21 @@
                           | EDml _ => unsupported "DML"
                           | ENextval _ => unsupported "Nextval"
                           | ESetval _ => unsupported "Nextval"
-                          | EUnurlify _ => unsupported "EUnurlify"
                           | EReturnBlob _ => unsupported "EUnurlify"
                           | ERedirect _ => unsupported "ERedirect"
 
+                          | EUnurlify (e, t) =>
+                            let
+                                val (e, st) = jsE inner (e, st)
+                                val (e', st) = unurlifyExp loc (t, st)
+                            in
+                                (strcat [str ("{c:\"f\",f:\"unurlify\",a:cons({c:\"c\",v:function(s){var t=s.split(\"/\");var i=0;return "
+                                              ^ e' ^ "}},cons("),
+                                         e,
+                                         str ",null))}"],
+                                 st)
+                            end
+
                           | ESignalReturn e =>
                             let
                                 val (e, st) = jsE inner (e, st)