comparison src/monoize.sml @ 847:0f7e2cca6d9b

<dyn> inside <table>; fix Specialize bug with datatype decls generating other mutually-recursive datatype decls
author Adam Chlipala <adamc@hcoop.net>
date Sat, 13 Jun 2009 14:29:36 -0400
parents 0d30e6338c65
children 3c7b48040dcf
comparison
equal deleted inserted replaced
846:0d30e6338c65 847:0f7e2cca6d9b
2593 end 2593 end
2594 2594
2595 | "dyn" => 2595 | "dyn" =>
2596 (case attrs of 2596 (case attrs of
2597 [("Signal", e, _)] => 2597 [("Signal", e, _)] =>
2598 ((L'.EStrcat 2598 let
2599 ((L'.EPrim (Prim.String "<span><script type=\"text/javascript\">dyn("), loc), 2599 val inTable = case targs of
2600 (L'.EStrcat ((L'.EJavaScript (L'.Script, e), loc), 2600 (L.CRecord (_, ctx), _) :: _ =>
2601 (L'.EPrim (Prim.String ")</script></span>"), loc)), loc)), loc), 2601 List.exists (fn ((L.CName "Table", _), _) => true
2602 fm) 2602 | _ => false) ctx
2603 | _ => false
2604
2605 val tag = if inTable then
2606 "tbody"
2607 else
2608 "span"
2609 in
2610 ((L'.EStrcat
2611 ((L'.EPrim (Prim.String ("<" ^ tag ^ "><script type=\"text/javascript\">dyn(")), loc),
2612 (L'.EStrcat ((L'.EJavaScript (L'.Script, e), loc),
2613 (L'.EPrim (Prim.String (")</script></" ^ tag ^ ">")), loc)), loc)), loc),
2614 fm)
2615 end
2603 | _ => raise Fail "Monoize: Bad dyn attributes") 2616 | _ => raise Fail "Monoize: Bad dyn attributes")
2604 2617
2605 | "submit" => normal ("input type=\"submit\"", NONE, NONE) 2618 | "submit" => normal ("input type=\"submit\"", NONE, NONE)
2606 | "button" => normal ("input type=\"submit\"", NONE, NONE) 2619 | "button" => normal ("input type=\"submit\"", NONE, NONE)
2607 | "hidden" => input "hidden" 2620 | "hidden" => input "hidden"