summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/js/urweb.js2
-rw-r--r--src/jscomp.sml7
2 files changed, 6 insertions, 3 deletions
diff --git a/lib/js/urweb.js b/lib/js/urweb.js
index 4f477f2e..6215a54c 100644
--- a/lib/js/urweb.js
+++ b/lib/js/urweb.js
@@ -1078,7 +1078,7 @@ function exec1(env, stack, e) {
var idx = e.n;
e = urfuncs[idx];
if (e.c == "t")
- e = urfuncs[idx] = e.f();
+ e = urfuncs[idx] = eval("(" + e.f + ")");
break;
case "s":
stack = cons({c: "s"}, stack);
diff --git a/src/jscomp.sml b/src/jscomp.sml
index 7610b6d2..4b04194c 100644
--- a/src/jscomp.sml
+++ b/src/jscomp.sml
@@ -564,9 +564,12 @@ fun process file =
val old = e
val (e, st) = jsExp mode [] (e, st)
val e = deStrcat 0 e
+ val e = String.translate (fn #"'" => "\\'"
+ | #"\\" => "\\\\"
+ | ch => String.str ch) e
- val sc = "urfuncs[" ^ Int.toString n ^ "] = {c:\"t\",f:function(){return "
- ^ e ^ "}};\n"
+ val sc = "urfuncs[" ^ Int.toString n ^ "] = {c:\"t\",f:'"
+ ^ e ^ "'};\n"
in
(*Print.prefaces "jsify'" [("old", MonoPrint.p_exp MonoEnv.empty old),
("new", MonoPrint.p_exp MonoEnv.empty new)];*)