Coccinelle release-1.0.0-rc11
[bpt/coccinelle.git] / parsing_cocci / unitary_ast0.ml
index 2045ab3..9746e86 100644 (file)
@@ -1,3 +1,29 @@
+(*
+ * Copyright 2012, INRIA
+ * Julia Lawall, Gilles Muller
+ * Copyright 2010-2011, INRIA, University of Copenhagen
+ * Julia Lawall, Rene Rydhof Hansen, Gilles Muller, Nicolas Palix
+ * Copyright 2005-2009, Ecole des Mines de Nantes, University of Copenhagen
+ * Yoann Padioleau, Julia Lawall, Rene Rydhof Hansen, Henrik Stuart, Gilles Muller, Nicolas Palix
+ * This file is part of Coccinelle.
+ *
+ * Coccinelle is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, according to version 2 of the License.
+ *
+ * Coccinelle is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Coccinelle.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * The authors reserve the right to distribute this or future versions of
+ * Coccinelle under other licenses.
+ *)
+
+
 (* find unitary metavariables *)
 module Ast0 = Ast0_cocci
 module Ast = Ast_cocci
@@ -63,8 +89,10 @@ let get_free checker t =
 
   let ident r k i =
     match Ast0.unwrap i with
-      Ast0.MetaId(name,_,_) | Ast0.MetaFunc(name,_,_)
+      Ast0.MetaId(name,_,_,_) | Ast0.MetaFunc(name,_,_)
     | Ast0.MetaLocalFunc(name,_,_) -> checker name
+    | Ast0.DisjId(starter,id_list,mids,ender) ->
+       detect_unitary_frees(List.map r.VT0.combiner_rec_ident id_list)
     | _ -> k i in
 
   let expression r k e =
@@ -89,7 +117,8 @@ let get_free checker t =
 
   let declaration r k d =
     match Ast0.unwrap d with
-      Ast0.MetaDecl(name,_) | Ast0.MetaField(name,_) -> checker name
+      Ast0.MetaDecl(name,_) | Ast0.MetaField(name,_)
+    | Ast0.MetaFieldList(name,_,_) -> checker name
     | Ast0.DisjDecl(starter,decls,mids,ender) ->
        detect_unitary_frees(List.map r.VT0.combiner_rec_declaration decls)
     | _ -> k d in
@@ -151,8 +180,8 @@ let update_unitary unitary =
 
   let ident r k i =
     match Ast0.unwrap i with
-      Ast0.MetaId(name,constraints,_) ->
-       Ast0.rewrap i (Ast0.MetaId(name,constraints,is_unitary name))
+      Ast0.MetaId(name,constraints,seed,_) ->
+       Ast0.rewrap i (Ast0.MetaId(name,constraints,seed,is_unitary name))
     | Ast0.MetaFunc(name,constraints,_) ->
        Ast0.rewrap i (Ast0.MetaFunc(name,constraints,is_unitary name))
     | Ast0.MetaLocalFunc(name,constraints,_) ->