From 9c95beafac5592d640dba32b4f5769963ee78482 Mon Sep 17 00:00:00 2001 From: Virgile Prevosto <virgile.prevosto@m4x.org> Date: Fri, 19 Jun 2020 11:15:54 +0200 Subject: [PATCH] [logic] make {iter,fold}_code_annot operate on normalized annotations i.e. they will present at most one AAssigns and AAllocates per set of behaviors. --- src/kernel_services/ast_data/annotations.ml | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) diff --git a/src/kernel_services/ast_data/annotations.ml b/src/kernel_services/ast_data/annotations.ml index 9152b5e455f..a433735fd86 100644 --- a/src/kernel_services/ast_data/annotations.ml +++ b/src/kernel_services/ast_data/annotations.ml @@ -541,25 +541,12 @@ let model_fields ?emitter t = (**************************************************************************) let iter_code_annot f stmt = - try - let tbl = Code_annots.find stmt in - Emitter.Usable_emitter.Hashtbl.iter - (fun e l -> List.iter (f (Emitter.Usable_emitter.get e)) !l) - tbl - with Not_found -> - () + let l = code_annot_emitter stmt in + List.iter (fun (a,e) -> f e a) l let fold_code_annot f stmt acc = - try - let tbl = Code_annots.find stmt in - Emitter.Usable_emitter.Hashtbl.fold - (fun e l acc -> - let e = Emitter.Usable_emitter.get e in - List.fold_left (fun acc x -> f e x acc) acc !l) - tbl - acc - with Not_found -> - acc + let l = code_annot_emitter stmt in + List.fold_left (fun acc (a,e) -> f e a acc) acc l let iter_all_code_annot ?(sorted=true) f = let cmp s1 s2 = -- GitLab