Mercurial > urweb
diff src/jscomp.sml @ 1262:003df929ee08
Switch to strings and eval for thunkifying JavaScripted functions
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Sat, 22 May 2010 16:29:54 -0400 |
parents | 25ebd8c4fafb |
children | 514be09d5018 |
line wrap: on
line diff
--- a/src/jscomp.sml Sat May 22 14:14:02 2010 -0400 +++ b/src/jscomp.sml Sat May 22 16:29:54 2010 -0400 @@ -564,9 +564,12 @@ 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)];*)