diff options
author | Pierre-Marie Pédrot <pierre-marie.pedrot@inria.fr> | 2016-09-09 13:29:28 +0200 |
---|---|---|
committer | Pierre-Marie Pédrot <pierre-marie.pedrot@inria.fr> | 2016-09-09 13:43:42 +0200 |
commit | d55818c7da468ce1c7c9644cb63f68f7561a17bc (patch) | |
tree | fc3737cf865b014f5a297ce249b98892e181ecf1 /engine | |
parent | 1888527bb43d6a8c801565af3e6376c91769fbc1 (diff) |
Tracking careless uses of slow name lookup.
Diffstat (limited to 'engine')
-rw-r--r-- | engine/termops.ml | 7 | ||||
-rw-r--r-- | engine/termops.mli | 2 |
2 files changed, 3 insertions, 6 deletions
diff --git a/engine/termops.ml b/engine/termops.ml index a047bf53c..17e56ec31 100644 --- a/engine/termops.ml +++ b/engine/termops.ml @@ -975,11 +975,8 @@ let smash_rel_context sign = let fold_named_context_both_sides f l ~init = List.fold_right_and_left f l init -let rec mem_named_context id ctxt = - match ctxt with - | decl :: _ when Id.equal id (NamedDecl.get_id decl) -> true - | _ :: sign -> mem_named_context id sign - | [] -> false +let mem_named_context_val id ctxt = + try Environ.lookup_named_val id ctxt; true with Not_found -> false let compact_named_context_reverse sign = let compact l decl = diff --git a/engine/termops.mli b/engine/termops.mli index 5d85088f8..0a7ac1f26 100644 --- a/engine/termops.mli +++ b/engine/termops.mli @@ -237,7 +237,7 @@ val map_rel_context_with_binders : val fold_named_context_both_sides : ('a -> Context.Named.Declaration.t -> Context.Named.Declaration.t list -> 'a) -> Context.Named.t -> init:'a -> 'a -val mem_named_context : Id.t -> Context.Named.t -> bool +val mem_named_context_val : Id.t -> named_context_val -> bool val compact_named_context : Context.Named.t -> Context.NamedList.t val compact_named_context_reverse : Context.Named.t -> Context.NamedList.t |