changeset 1422:07ef5771568d

Notice that Basis.now is effectful; smarter JavaScript encoding of initial source values built using server-side expressions that can't be turned into JavaScript
author Adam Chlipala <adam@chlipala.net>
date Tue, 08 Feb 2011 16:54:01 -0500
parents 3dab4696d116
children bd6c90f5a428
files src/jscomp.sml src/settings.sml
diffstat 2 files changed, 14 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/jscomp.sml	Thu Feb 03 21:04:12 2011 -0500
+++ b/src/jscomp.sml	Tue Feb 08 16:54:01 2011 -0500
@@ -1186,6 +1186,18 @@
                      ((EUnurlify (e, t, b), loc), st)
                  end
 
+               | EJavaScript (m as Source t, e') =>
+                 (foundJavaScript := true;
+                  let
+                      val (x', st) = jsExp m (t :: outer) ((ERel 0, loc), st)
+                  in
+                      ((ELet ("x", t, e', x'), loc), st)
+                  end
+                  handle CantEmbed t => ((*ErrorMsg.errorAt loc "Unable to embed type in JavaScript";
+                                         Print.preface ("Type",
+                                                        MonoPrint.p_typ MonoEnv.empty t);*)
+                                         (e, st)))
+
                | EJavaScript (m, e') =>
                  (foundJavaScript := true;
                   jsExp m outer (e', st)
--- a/src/settings.sml	Thu Feb 03 21:04:12 2011 -0500
+++ b/src/settings.sml	Tue Feb 08 16:54:01 2011 -0500
@@ -139,7 +139,8 @@
                         "kc",
                         "debug",
                         "naughtyDebug",
-                        "rand"]
+                        "rand",
+                        "now"]
 
 val benign = ref benignBase
 fun setBenignEffectful ls = benign := S.addList (benignBase, ls)