diff options
Diffstat (limited to 'camlp4/lib/extfun.ml')
-rw-r--r-- | camlp4/lib/extfun.ml | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/camlp4/lib/extfun.ml b/camlp4/lib/extfun.ml index 866ea221c1..7123271a6a 100644 --- a/camlp4/lib/extfun.ml +++ b/camlp4/lib/extfun.ml @@ -89,14 +89,12 @@ value insert_matching matchings (patt, has_when, expr) = let rec loop = fun [ [m :: ml] as gml -> - if m1.has_when && not m.has_when then [m1 :: gml] - else if not m1.has_when && m.has_when then [m :: loop ml] - else - let c = compare m1.patt m.patt in - if c < 0 then [m1 :: gml] - else if c > 0 then [m :: loop ml] - else if m.has_when then [m1 :: gml] - else [m1 :: ml] + if m1.has_when && not m.has_when then [m1 :: gml] else + if not m1.has_when && m.has_when then [m :: loop ml] else + (* either both or none have a when clause *) + if compare m1.patt m.patt = 0 then + if not m1.has_when then [m1 :: ml] else [m1 :: gml] + else [m :: loop ml] | [] -> [m1] ] in loop matchings |