summaryrefslogtreecommitdiff
path: root/src/jscomp.sml
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adamc@hcoop.net>2010-05-22 16:29:54 -0400
committerGravatar Adam Chlipala <adamc@hcoop.net>2010-05-22 16:29:54 -0400
commita89f9edc1c5718c2f6c1fcce2c131e6b4c2cced7 (patch)
treec34c7c6d8fb4a1ea2f03fa641ee1db54fddcd8c3 /src/jscomp.sml
parent4a916000c43f1dd90211aa3bdc810539baa406b8 (diff)
Switch to strings and eval for thunkifying JavaScripted functions
Diffstat (limited to 'src/jscomp.sml')
-rw-r--r--src/jscomp.sml7
1 files changed, 5 insertions, 2 deletions
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)];*)