comparison src/jscomp.sml @ 592:a8be5a2068a5

Injecting strings and bools
author Adam Chlipala <adamc@hcoop.net>
date Thu, 01 Jan 2009 16:11:42 -0500
parents 8f8771f32909
children f277f5faebcd
comparison
equal deleted inserted replaced
591:8f8771f32909 592:a8be5a2068a5
160 case #1 t of 160 case #1 t of
161 TSource => strcat loc [str loc "s", 161 TSource => strcat loc [str loc "s",
162 (EFfiApp ("Basis", "htmlifyInt", [e]), loc)] 162 (EFfiApp ("Basis", "htmlifyInt", [e]), loc)]
163 | TRecord [] => str loc "null" 163 | TRecord [] => str loc "null"
164 164
165 | TFfi ("Basis", "string") => e 165 | TFfi ("Basis", "string") => (EFfiApp ("Basis", "jsifyString", [e]), loc)
166 | TFfi ("Basis", "int") => (EFfiApp ("Basis", "htmlifyInt", [e]), loc) 166 | TFfi ("Basis", "int") => (EFfiApp ("Basis", "htmlifyInt", [e]), loc)
167 | TFfi ("Basis", "float") => (EFfiApp ("Basis", "htmlifyFloat", [e]), loc) 167 | TFfi ("Basis", "float") => (EFfiApp ("Basis", "htmlifyFloat", [e]), loc)
168
169 | TFfi ("Basis", "bool") => (ECase (e,
170 [((PCon (Enum, PConFfi {mod = "Basis",
171 datatyp = "bool",
172 con = "True",
173 arg = NONE}, NONE), loc),
174 str loc "true"),
175 ((PCon (Enum, PConFfi {mod = "Basis",
176 datatyp = "bool",
177 con = "False",
178 arg = NONE}, NONE), loc),
179 str loc "false")],
180 {disc = (TFfi ("Basis", "bool"), loc),
181 result = (TFfi ("Basis", "string"), loc)}), loc)
168 182
169 | _ => (EM.errorAt loc "Don't know how to embed type in JavaScript"; 183 | _ => (EM.errorAt loc "Don't know how to embed type in JavaScript";
170 Print.prefaces "Can't embed" [("t", MonoPrint.p_typ MonoEnv.empty t)]; 184 Print.prefaces "Can't embed" [("t", MonoPrint.p_typ MonoEnv.empty t)];
171 str loc "ERROR") 185 str loc "ERROR")
172 186