aboutsummaryrefslogtreecommitdiffhomepage
path: root/interp/notation.ml
diff options
context:
space:
mode:
authorGravatar Emilio Jesus Gallego Arias <e+git@x80.org>2017-01-12 20:11:01 +0100
committerGravatar Emilio Jesus Gallego Arias <e+git@x80.org>2017-04-24 23:58:19 +0200
commit846b74275511bd89c2f3abe19245133050d2199c (patch)
tree24e4c838d440e7ce6104bca95c8eb4b7baa321ec /interp/notation.ml
parente57074289193b0f0184f3c7143d8ab7e0edd5112 (diff)
[constrexpr] Make patterns use Loc.located for location information
This is first of a series of patches, converting `constrexpr` pattern data type from ad-hoc location handling to `Loc.located`. Along Coq, we can find two different coding styles for handling objects with location information: one style uses `'a Loc.located`, whereas other data structures directly embed `Loc.t` in their constructors. Handling all located objects uniformly would be very convenient, and would allow optimizing certain cases, in particular making located smarter when there is no location information, as it is the case for all terms coming from the kernel. `git grep 'Loc.t \*'` gives an overview of the remaining work to do. We've also added an experimental API for `located` to the `Loc` module, `Loc.tag` should be used to add locations objects, making it explicit in the code when a "located" object is created.
Diffstat (limited to 'interp/notation.ml')
-rw-r--r--interp/notation.ml8
1 files changed, 4 insertions, 4 deletions
diff --git a/interp/notation.ml b/interp/notation.ml
index 90ac7f729..04711808b 100644
--- a/interp/notation.ml
+++ b/interp/notation.ml
@@ -472,11 +472,11 @@ let interp_prim_token =
(** [rcp_of_glob] : from [glob_constr] to [raw_cases_pattern_expr] *)
let rec rcp_of_glob looked_for = function
- | GVar (loc,id) -> RCPatAtom (loc,Some id)
- | GHole (loc,_,_,_) -> RCPatAtom (loc,None)
- | GRef (loc,g,_) -> looked_for g; RCPatCstr (loc, g,[],[])
+ | GVar (loc,id) -> Loc.tag ~loc @@ RCPatAtom (Some id)
+ | GHole (loc,_,_,_) -> Loc.tag ~loc @@ RCPatAtom (None)
+ | GRef (loc,g,_) -> looked_for g; Loc.tag ~loc @@ RCPatCstr (g,[],[])
| GApp (loc,GRef (_,g,_),l) ->
- looked_for g; RCPatCstr (loc, g, List.map (rcp_of_glob looked_for) l,[])
+ looked_for g; Loc.tag ~loc @@ RCPatCstr (g, List.map (rcp_of_glob looked_for) l,[])
| _ -> raise Not_found
let interp_prim_token_cases_pattern_expr loc looked_for p =