comparison src/jscomp.sml @ 1845:c1e3805e604e

Make Scriptcheck catch more script/message-passing uses, and move the phase earlier in compilation
author Adam Chlipala <adam@chlipala.net>
date Fri, 15 Mar 2013 16:09:55 -0400
parents 10a2cb93d175
children 8958b580d026
comparison
equal deleted inserted replaced
1844:2c5e6f78560c 1845:c1e3805e604e
59 59
60 exception CantEmbed of typ 60 exception CantEmbed of typ
61 61
62 fun inString {needle, haystack} = String.isSubstring needle haystack 62 fun inString {needle, haystack} = String.isSubstring needle haystack
63 63
64 fun process file = 64 fun process (file : file) =
65 let 65 let
66 val (someTs, nameds) = 66 val (someTs, nameds) =
67 foldl (fn ((DVal (_, n, t, e, _), _), (someTs, nameds)) => (someTs, IM.insert (nameds, n, e)) 67 foldl (fn ((DVal (_, n, t, e, _), _), (someTs, nameds)) => (someTs, IM.insert (nameds, n, e))
68 | ((DValRec vis, _), (someTs, nameds)) => 68 | ((DValRec vis, _), (someTs, nameds)) =>
69 (someTs, foldl (fn ((_, n, _, e, _), nameds) => IM.insert (nameds, n, e)) 69 (someTs, foldl (fn ((_, n, _, e, _), nameds) => IM.insert (nameds, n, e))
75 | (_, someTs) => someTs) someTs cs 75 | (_, someTs) => someTs) someTs cs
76 else 76 else
77 someTs) someTs dts, 77 someTs) someTs dts,
78 nameds) 78 nameds)
79 | (_, state) => state) 79 | (_, state) => state)
80 (IM.empty, IM.empty) file 80 (IM.empty, IM.empty) (#1 file)
81 81
82 fun str loc s = (EPrim (Prim.String s), loc) 82 fun str loc s = (EPrim (Prim.String s), loc)
83 83
84 fun isNullable (t, _) = 84 fun isNullable (t, _) =
85 case t of 85 case t of
1302 included = IS.empty, 1302 included = IS.empty,
1303 injectors = IM.empty, 1303 injectors = IM.empty,
1304 listInjectors = TM.empty, 1304 listInjectors = TM.empty,
1305 decoders = IM.empty, 1305 decoders = IM.empty,
1306 maxName = U.File.maxName file + 1} 1306 maxName = U.File.maxName file + 1}
1307 file 1307 (#1 file)
1308 1308
1309 val inf = TextIO.openIn (OS.Path.joinDirFile {dir = Settings.libJs (), file = "urweb.js"}) 1309 val inf = TextIO.openIn (OS.Path.joinDirFile {dir = Settings.libJs (), file = "urweb.js"})
1310 fun lines acc = 1310 fun lines acc =
1311 case TextIO.inputLine inf of 1311 case TextIO.inputLine inf of
1312 NONE => String.concat (rev acc) 1312 NONE => String.concat (rev acc)
1332 ^ "\ntime_format = \"" ^ Prim.toCString (Settings.getTimeFormat ()) ^ "\";\n" 1332 ^ "\ntime_format = \"" ^ Prim.toCString (Settings.getTimeFormat ()) ^ "\";\n"
1333 else 1333 else
1334 "" 1334 ""
1335 in 1335 in
1336 TextIO.closeIn inf; 1336 TextIO.closeIn inf;
1337 (DJavaScript script, ErrorMsg.dummySpan) :: ds 1337 ((DJavaScript script, ErrorMsg.dummySpan) :: ds, #2 file)
1338 end 1338 end
1339 1339
1340 end 1340 end