changeset 1651:dfc854e478bb

Error messages about applying 'dynClass' to tags that don't like it
author Adam Chlipala <adam@chlipala.net>
date Sat, 31 Dec 2011 13:31:00 -0500
parents 1bfd793e7eb8
children 1c8456f0cf8c
files src/monoize.sml src/urweb.grm
diffstat 2 files changed, 12 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/monoize.sml	Thu Dec 29 16:08:34 2011 -0500
+++ b/src/monoize.sml	Sat Dec 31 13:31:00 2011 -0500
@@ -3034,6 +3034,15 @@
                 val (class, fm) = monoExp (env, st, fm) class
                 val (dynClass, fm) = monoExp (env, st, fm) dynClass
 
+                val dynamics = ["dyn", "ctextbox", "ccheckbox", "cselect", "coption", "ctextarea"]
+
+                val () = case #1 dynClass of
+                             L'.ENone _ => ()
+                           | _ => if List.exists (fn x => x = tag) dynamics then
+                                      E.errorAt loc ("Dynamic tag <" ^ tag ^ "> cannot be combined with 'dynClass' attribute; an additional <span> may be useful")
+                                  else
+                                      ()
+
                 fun tagStart tag' =
                     let
                         val t = (L'.TFfi ("Basis", "string"), loc)
--- a/src/urweb.grm	Thu Dec 29 16:08:34 2011 -0500
+++ b/src/urweb.grm	Sat Dec 31 13:31:00 2011 -0500
@@ -1462,6 +1462,9 @@
                                                                                NONE => (EVar (["Basis"], "None", Infer), pos)
                                                                              | SOME c => (EApp ((EVar (["Basis"], "Some", Infer), pos), c), pos)), pos)
                                                      in
+                                                         case #3 tag of
+                                                             NONE => ()
+                                                           | SOME _ => ErrorMsg.errorAt pos "<form> does not support 'dynClass' attribute";
                                                          (EApp (e, xmlOpt), pos)
                                                      end
                                                  else if et = "subform" orelse et = "subforms" then