diff src/jscomp.sml @ 574:ac947e2f29ff

Trivial use of a source
author Adam Chlipala <adamc@hcoop.net>
date Sun, 21 Dec 2008 12:56:39 -0500
parents 57018f21cd5c
children 3d56940120b1
line wrap: on
line diff
--- a/src/jscomp.sml	Sun Dec 21 12:30:57 2008 -0500
+++ b/src/jscomp.sml	Sun Dec 21 12:56:39 2008 -0500
@@ -34,7 +34,8 @@
 structure U = MonoUtil
 
 val funcs = [(("Basis", "alert"), "alert"),
-             (("Basis", "htmlifyString"), "escape")]
+             (("Basis", "htmlifyString"), "escape"),
+             (("Basis", "new_client_source"), "sc")]
 
 structure FM = BinaryMapFn(struct
                            type ord_key = string * string
@@ -85,6 +86,7 @@
       | EJavaScript _ => 0
       | ESignalReturn e => varDepth e
       | ESignalBind (e1, e2) => Int.max (varDepth e1, varDepth e2)
+      | ESignalSource e => varDepth e
 
 fun strcat loc es =
     case es of
@@ -168,7 +170,7 @@
                   | EFfi k =>
                     let
                         val name = case ffi k of
-                                       NONE => (EM.errorAt loc "Unsupported FFI identifier in JavaScript";
+                                       NONE => (EM.errorAt loc ("Unsupported FFI identifier " ^ #2 k ^ " in JavaScript");
                                                 "ERROR")
                                      | SOME s => s
                     in
@@ -177,7 +179,7 @@
                   | EFfiApp (m, x, args) =>
                     let
                         val name = case ffi (m, x) of
-                                       NONE => (EM.errorAt loc "Unsupported FFI function in JavaScript";
+                                       NONE => (EM.errorAt loc ("Unsupported FFI function " ^ x ^ " in JavaScript");
                                                 "ERROR")
                                      | SOME s => s
                     in
@@ -366,6 +368,15 @@
                                  str ")"],
                          st)
                     end
+                  | ESignalSource e =>
+                    let
+                        val (e, st) = jsE inner (e, st)
+                    in
+                        (strcat [str "ss(",
+                                 e,
+                                 str ")"],
+                         st)
+                    end
             end
     in
         jsE