Mercurial > urweb
comparison src/tag.sml @ 1046:a5eb8f87bc17
Better error message for link-handler conflicts
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Wed, 25 Nov 2009 09:03:08 -0500 |
parents | 5fe49effbc83 |
children | 3bc726a822fb |
comparison
equal
deleted
inserted
replaced
1045:36efaf119b85 | 1046:a5eb8f87bc17 |
---|---|
38 val compare = String.compare | 38 val compare = String.compare |
39 end) | 39 end) |
40 | 40 |
41 fun kind (k, s) = (k, s) | 41 fun kind (k, s) = (k, s) |
42 fun con (c, s) = (c, s) | 42 fun con (c, s) = (c, s) |
43 | |
44 fun both (loc, f) = (ErrorMsg.errorAt loc ("Function " ^ f ^ " needed for both a link and a form"); | |
45 TextIO.output (TextIO.stdErr, | |
46 "Make sure that the signature of the containing module hides any form handlers.\n")) | |
43 | 47 |
44 fun exp env (e, s) = | 48 fun exp env (e, s) = |
45 case e of | 49 case e of |
46 EApp ( | 50 EApp ( |
47 (EApp ( | 51 (EApp ( |
103 ("Duplicate HTTP tag " | 107 ("Duplicate HTTP tag " |
104 ^ s); | 108 ^ s); |
105 if ek = ek' then | 109 if ek = ek' then |
106 () | 110 () |
107 else | 111 else |
108 ErrorMsg.errorAt loc | 112 both (loc, s); |
109 "Function needed as both a link and a form "; | |
110 byTag) | 113 byTag) |
111 | 114 |
112 val e = (EClosure (cn, args), loc) | 115 val e = (EClosure (cn, args), loc) |
113 val t = (CFfi ("Basis", "string"), loc) | 116 val t = (CFfi ("Basis", "string"), loc) |
114 in | 117 in |
164 NONE => ([d], (env, count, tags, byTag)) | 167 NONE => ([d], (env, count, tags, byTag)) |
165 | SOME (ek', n') => | 168 | SOME (ek', n') => |
166 (if ek = ek' then | 169 (if ek = ek' then |
167 () | 170 () |
168 else | 171 else |
169 ErrorMsg.errorAt loc "Function needed for both a link and a form"; | 172 both (loc, s); |
170 ([], (env, count, tags, byTag))) | 173 ([], (env, count, tags, byTag))) |
171 end | 174 end |
172 | _ => | 175 | _ => |
173 let | 176 let |
174 val env' = E.declBinds env d | 177 val env' = E.declBinds env d |