Commit e600b6d0 authored by POTTIER Francois's avatar POTTIER Francois

Removed the mode [Repeated], which was indistinguishable with [InsideRecVisit].

parent a1185be3
type 'env mode =
| OutsideRec (* updating [current] and visiting [outer] subterms *)
(* we are outside [rec] and outside [repeated] *)
| InsideRecDiscovery (* updating [current] and doing nothing else; embedded subterms not visited *)
(* we are under [rec] in the discovery phase *)
| InsideRecVisit (* [current] not updated; [inner] is [current]; embedded subterms visited *)
| Repeated
(* we are either under [rec] in the visit phase, or under [repeated] *)
type 'env penv = {
current: 'env ref; (* threaded left to right *)
......@@ -56,8 +58,7 @@ class virtual ['self] libmap = object (self : 'self)
= fun visit_t penv t1 ->
match penv.mode with
| OutsideRec
| InsideRecVisit
| Repeated ->
| InsideRecVisit ->
visit_t penv.outer t1
| InsideRecDiscovery ->
(* An [outer] subterm is NOT visited in discovery mode. *)
......@@ -75,7 +76,6 @@ class virtual ['self] libmap = object (self : 'self)
let x2, env = self#extend x1 env in
current := env;
x2
| Repeated
| InsideRecVisit ->
(* The environment should not be extended when in visit mode.
It has been extended already during the discovery phase. *)
......@@ -95,8 +95,7 @@ class virtual ['self] libmap = object (self : 'self)
let q2 = visit_q penv q1 in
p2, q2
| InsideRecDiscovery
| InsideRecVisit
| Repeated ->
| InsideRecVisit ->
(* [rebind] forbidden under [rec] and [repeated] *)
assert false
......@@ -121,8 +120,7 @@ class virtual ['self] libmap = object (self : 'self)
(* An [inner] subterm is NOT visited in discovery mode. *)
Obj.magic ()
| OutsideRec
| InsideRecVisit
| Repeated ->
| InsideRecVisit ->
visit_t !(penv.current) t1
method private visit_recursive: 'env 'p1 'p2 .
......@@ -139,8 +137,7 @@ class virtual ['self] libmap = object (self : 'self)
let penv = { penv with mode = InsideRecVisit } in
visit_p penv p1
| InsideRecDiscovery
| InsideRecVisit
| Repeated ->
| InsideRecVisit ->
(* [rec] forbidden under [rec] or [repeated] *)
assert false
......@@ -148,7 +145,7 @@ class virtual ['self] libmap = object (self : 'self)
('env penv -> 'p1 -> 'p2) ->
'env penv -> 'p1 repeated -> 'p2 repeated
= fun visit_p penv p1 ->
let penv = { penv with mode = Repeated } in
let penv = { penv with mode = InsideRecVisit } in
visit_p penv p1
end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment