comparison src/mono_shake.sml @ 2252:e843a04499d4

Revert to revision 2222.
author Ziv Scully <ziv@mit.edu>
date Mon, 21 Sep 2015 10:16:55 -0400
parents 25874084bf1f
children
comparison
equal deleted inserted replaced
2251:25874084bf1f 2252:e843a04499d4
14 * 14 *
15 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
16 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 18 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
19 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 19 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
20 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 20 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
21 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 21 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 22 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 23 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
24 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 24 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
58 | ((DCookie _, _), acc) => acc 58 | ((DCookie _, _), acc) => acc
59 | ((DStyle _, _), acc) => acc 59 | ((DStyle _, _), acc) => acc
60 | ((DTask _, _), acc) => acc 60 | ((DTask _, _), acc) => acc
61 | ((DPolicy _, _), acc) => acc 61 | ((DPolicy _, _), acc) => acc
62 | ((DOnError _, _), acc) => acc) 62 | ((DOnError _, _), acc) => acc)
63 (IM.empty, IM.empty) (#decls file) 63 (IM.empty, IM.empty) (#1 file)
64 64
65 fun typ (c, s) = 65 fun typ (c, s) =
66 case c of 66 case c of
67 TDatatype (n, _) => 67 TDatatype (n, _) =>
68 if IS.member (#con s, n) then 68 if IS.member (#con s, n) then
128 | PolSequence e1 => e1 128 | PolSequence e1 => e1
129 in 129 in
130 usedVars st e1 130 usedVars st e1
131 end 131 end
132 | ((DOnError n, _), (page_cs, page_es)) => (page_cs, IS.add (page_es, n)) 132 | ((DOnError n, _), (page_cs, page_es)) => (page_cs, IS.add (page_es, n))
133 | (_, st) => st) (IS.empty, IS.empty) (#decls file) 133 | (_, st) => st) (IS.empty, IS.empty) (#1 file)
134 134
135 val s = {con = page_cs, exp = page_es} 135 val s = {con = page_cs, exp = page_es}
136 136
137 val s = IS.foldl (fn (n, s) => 137 val s = IS.foldl (fn (n, s) =>
138 case IM.find (cdef, n) of 138 case IM.find (cdef, n) of
143 val s = IS.foldl (fn (n, s) => 143 val s = IS.foldl (fn (n, s) =>
144 case IM.find (edef, n) of 144 case IM.find (edef, n) of
145 NONE => raise Fail "MonoShake: Couldn't find 'val'" 145 NONE => raise Fail "MonoShake: Couldn't find 'val'"
146 | SOME (t, e) => shakeExp s e) s page_es 146 | SOME (t, e) => shakeExp s e) s page_es
147 in 147 in
148 {decls = 148 (List.filter (fn (DDatatype dts, _) => List.exists (fn (_, n, _) => IS.member (#con s, n)) dts
149 List.filter (fn (DDatatype dts, _) => List.exists (fn (_, n, _) => IS.member (#con s, n)) dts
150 | (DVal (_, n, _, _, _), _) => IS.member (#exp s, n) 149 | (DVal (_, n, _, _, _), _) => IS.member (#exp s, n)
151 | (DValRec vis, _) => List.exists (fn (_, n, _, _, _) => IS.member (#exp s, n)) vis 150 | (DValRec vis, _) => List.exists (fn (_, n, _, _, _) => IS.member (#exp s, n)) vis
152 | (DExport _, _) => true 151 | (DExport _, _) => true
153 | (DTable _, _) => true 152 | (DTable _, _) => true
154 | (DSequence _, _) => true 153 | (DSequence _, _) => true
157 | (DJavaScript _, _) => true 156 | (DJavaScript _, _) => true
158 | (DCookie _, _) => true 157 | (DCookie _, _) => true
159 | (DStyle _, _) => true 158 | (DStyle _, _) => true
160 | (DTask _, _) => true 159 | (DTask _, _) => true
161 | (DPolicy _, _) => true 160 | (DPolicy _, _) => true
162 | (DOnError _, _) => true) (#decls file), sideInfo = #sideInfo file} 161 | (DOnError _, _) => true) (#1 file), #2 file)
163 end 162 end
164 163
165 end 164 end