diff src/mono_util.sml @ 1847:8958b580d026

Change Name_js to skip code snippets that depend on the CSRF-protection signature
author Adam Chlipala <adam@chlipala.net>
date Mon, 01 Apr 2013 10:13:49 -0400
parents c1e3805e604e
children e15234fbb163
line wrap: on
line diff
--- a/src/mono_util.sml	Tue Mar 19 19:10:31 2013 -0400
+++ b/src/mono_util.sml	Mon Apr 01 10:13:49 2013 -0400
@@ -1,4 +1,4 @@
-(* Copyright (c) 2008, Adam Chlipala
+(* Copyright (c) 2008, 2013, Adam Chlipala
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -654,6 +654,25 @@
         S.Continue v => v
       | S.Return _ => raise Fail "MonoUtil.Decl.foldMapB: Impossible"
 
+fun exists {typ, exp, decl} k =
+    case mapfold {typ = fn c => fn () =>
+                                    if typ c then
+                                        S.Return ()
+                                    else
+                                        S.Continue (c, ()),
+                  exp = fn e => fn () =>
+                                    if exp e then
+                                        S.Return ()
+                                    else
+                                        S.Continue (e, ()),
+                  decl = fn d => fn () =>
+                                    if decl d then
+                                        S.Return ()
+                                    else
+                                        S.Continue (d, ())} k () of
+        S.Return _ => true
+      | S.Continue _ => false
+
 end
 
 structure File = struct