]> matita.cs.unibo.it Git - helm.git/commitdiff
interpret non ambiguous symbols ASAP
authorEnrico Tassi <enrico.tassi@inria.fr>
Thu, 29 Jul 2010 15:09:38 +0000 (15:09 +0000)
committerEnrico Tassi <enrico.tassi@inria.fr>
Thu, 29 Jul 2010 15:09:38 +0000 (15:09 +0000)
helm/software/components/disambiguation/disambiguate.ml

index 5ac709f9b82fc4e7b5e6dbe6f85fee64abc53570..d0d7460a6b7a00902515510c5157e76ba7ba54c1 100644 (file)
@@ -447,6 +447,21 @@ let disambiguate_thing
             fix_instance item (Environment.find item e)
           with Not_found -> [])
    in
+
+   (* items with 1 choice are interpreted ASAP *)
+   let aliases, todo_dom = 
+     let rec aux (aliases,acc) = function 
+       | [] -> aliases, acc
+       | (Node (_, item,extra) as node) :: tl -> 
+           let tl = tl @ extra in
+           let choices = lookup_choices item in
+           if List.length choices <> 1 then aux (aliases, acc@[node]) tl
+           else if Environment.mem item aliases then aux (aliases, acc) tl
+           else aux (Environment.add item (List.hd choices) aliases, acc) tl
+     in
+       aux (aliases,[]) todo_dom
+   in
+
 (*
       (* <benchmark> *)
       let _ =