diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/elaborate.sml | 11 | ||||
-rw-r--r-- | src/jscomp.sml | 26 | ||||
-rw-r--r-- | src/monoize.sml | 8 |
3 files changed, 39 insertions, 6 deletions
diff --git a/src/elaborate.sml b/src/elaborate.sml index c55593b4..5e94d8e4 100644 --- a/src/elaborate.sml +++ b/src/elaborate.sml @@ -704,7 +704,16 @@ (#fields s1, #fields s2) (*val () = eprefaces "Summaries2" [("#1", p_summary env {fields = fs1, unifs = #unifs s1, others = #others s1}), ("#2", p_summary env {fields = fs2, unifs = #unifs s2, others = #others s2})]*) + val (unifs1, unifs2) = eatMatching (fn ((_, r1), (_, r2)) => r1 = r2) (#unifs s1, #unifs s2) + fun eatMost unifs = + case unifs of + (_, r) :: (rest as _ :: _) => (r := SOME (L'.CRecord (k, []), loc); + eatMost rest) + | _ => unifs + val unifs1 = eatMost unifs1 + val unifs2 = eatMost unifs2 + val (others1, others2) = eatMatching (consEq env) (#others s1, #others s2) (*val () = eprefaces "Summaries3" [("#1", p_summary env {fields = fs1, unifs = unifs1, others = others1}), ("#2", p_summary env {fields = fs2, unifs = unifs2, others = others2})]*) @@ -761,7 +770,7 @@ | _ => (fs1, fs2, others1, others2) (*val () = eprefaces "Summaries5" [("#1", p_summary env {fields = fs1, unifs = unifs1, others = others1}), - ("#2", p_summary env {fields = fs2, unifs = unifs2, others = others2})]*) + ("#2", p_summary env {fields = fs2, unifs = unifs2, others = others2})]*) val clear = case (fs1, others1, fs2, others2) of ([], [], [], []) => true diff --git a/src/jscomp.sml b/src/jscomp.sml index 23b6e936..37bbf79d 100644 --- a/src/jscomp.sml +++ b/src/jscomp.sml @@ -409,6 +409,12 @@ fun process file = Print.prefaces "Can't unurlify" [("t", MonoPrint.p_typ MonoEnv.empty t)]; ("ERROR", st)) + fun padWith (ch, s, len) = + if size s < len then + padWith (ch, String.str ch ^ s, len - 1) + else + s + fun jsExp mode skip outer = let val len = length outer @@ -448,7 +454,16 @@ fun process file = else "\\074" | #"\\" => "\\\\" - | ch => String.str ch) s + | #"\n" => "\\n" + | #"\r" => "\\r" + | #"\t" => "\\t" + | ch => + if Char.isPrint ch then + String.str ch + else + "\\" ^ padWith (#"0", + Int.fmt StringCvt.OCT (ord ch), + 3)) s ^ "\"") | _ => str (Prim.toString p) @@ -878,6 +893,15 @@ fun process file = | EDml _ => unsupported "DML" | ENextval _ => unsupported "Nextval" | EUnurlify _ => unsupported "EUnurlify" + | EJavaScript (_, e as (EAbs _, _), _) => + let + val (e, st) = jsE inner (e, st) + in + (strcat [str "\"cr(\"+ca(", + e, + str ")+\")\""], + st) + end | EJavaScript (_, e, _) => let val (e, st) = jsE inner (e, st) diff --git a/src/monoize.sml b/src/monoize.sml index 57bf26e3..131bdf67 100644 --- a/src/monoize.sml +++ b/src/monoize.sml @@ -1954,9 +1954,9 @@ fun monoExp (env, st, fm) (all as (e, loc)) = loc)), loc), fm) end | SOME (_, src, _) => - (strcat [str "<script type=\"text/javascript\">inp(\"input\",", + (strcat [str "<span><script type=\"text/javascript\">inp(\"input\",", (L'.EJavaScript (L'.Script, src, NONE), loc), - str ")</script>"], + str ")</script></span>"], fm)) | _ => (Print.prefaces "Targs" (map (fn t => ("T", CorePrint.p_con env t)) targs); raise Fail "No name passed to textbox tag")) @@ -2030,9 +2030,9 @@ fun monoExp (env, st, fm) (all as (e, loc)) = str ")"] val sc = setAttrs sc in - (strcat [str "<script type=\"text/javascript\">", + (strcat [str "<span><script type=\"text/javascript\">", sc, - str "</script>"], + str "</script></span>"], fm) end) |