diff options
| author | Jacques Garrigue <garrigue at math.nagoya-u.ac.jp> | 2004-01-06 03:27:42 +0000 |
|---|---|---|
| committer | Jacques Garrigue <garrigue at math.nagoya-u.ac.jp> | 2004-01-06 03:27:42 +0000 |
| commit | 4e41ff1f982b80868bc0cd9cd758f136c97acb3a (patch) | |
| tree | 5165337ba83b03e7a37fdc462b8df369c4d117ab | |
| parent | ef6a9898f8c61a4e43b6fcbdc88c176c6ee997fc (diff) | |
| download | ocaml-4e41ff1f982b80868bc0cd9cd758f136c97acb3a.tar.gz | |
optimise full_match
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@6062 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
| -rw-r--r-- | typing/parmatch.ml | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/typing/parmatch.ml b/typing/parmatch.ml index 45c5181717..4c54523ed0 100644 --- a/typing/parmatch.ml +++ b/typing/parmatch.ml @@ -602,10 +602,11 @@ let full_match closing env = match env with row.row_fields else row.row_closed && - List.for_all - (fun (tag,f) -> - Btype.row_field_repr f = Rabsent || List.mem tag fields) - row.row_fields + let count = + List.fold_left + (fun n (_,f) -> if Btype.row_field_repr f = Rabsent then n else n+1) + 0 row.row_fields in + List.length fields = count | ({pat_desc = Tpat_constant(Const_char _)},_) :: _ -> List.length env = 256 | ({pat_desc = Tpat_constant(_)},_) :: _ -> false |
