comparison 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
comparison
equal deleted inserted replaced
1261:04e9885cbe56 1262:003df929ee08
562 maxName = #maxName st} 562 maxName = #maxName st}
563 563
564 val old = e 564 val old = e
565 val (e, st) = jsExp mode [] (e, st) 565 val (e, st) = jsExp mode [] (e, st)
566 val e = deStrcat 0 e 566 val e = deStrcat 0 e
567 val e = String.translate (fn #"'" => "\\'"
568 | #"\\" => "\\\\"
569 | ch => String.str ch) e
567 570
568 val sc = "urfuncs[" ^ Int.toString n ^ "] = {c:\"t\",f:function(){return " 571 val sc = "urfuncs[" ^ Int.toString n ^ "] = {c:\"t\",f:'"
569 ^ e ^ "}};\n" 572 ^ e ^ "'};\n"
570 in 573 in
571 (*Print.prefaces "jsify'" [("old", MonoPrint.p_exp MonoEnv.empty old), 574 (*Print.prefaces "jsify'" [("old", MonoPrint.p_exp MonoEnv.empty old),
572 ("new", MonoPrint.p_exp MonoEnv.empty new)];*) 575 ("new", MonoPrint.p_exp MonoEnv.empty new)];*)
573 {decls = #decls st, 576 {decls = #decls st,
574 script = sc :: #script st, 577 script = sc :: #script st,