Renaming pcstr_pat -> pcstr_self, cstr_pat -> cstr_self.

git-svn-id: http://caml.inria.fr/svn/ocaml/branches/extension_points@13496 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
master
Alain Frisch 2013-04-10 09:35:09 +00:00
parent 71787e0228
commit 580bb34579
18 changed files with 35 additions and 32 deletions

View File

@ -820,7 +820,7 @@ value varify_constructors var_names =
| p -> p ]
in
let cil = class_str_item cfl [] in
mkexp loc (Pexp_object { pcstr_pat = patt p; pcstr_fields = cil })
mkexp loc (Pexp_object { pcstr_self = patt p; pcstr_fields = cil })
| ExOlb loc _ _ -> error loc "labeled expression not allowed here"
| ExOvr loc iel -> mkexp loc (Pexp_override (mkideexp iel []))
| ExRec loc lel eo ->
@ -1193,7 +1193,7 @@ value varify_constructors var_names =
in
let cil = class_str_item cfl [] in
mkcl loc (Pcl_structure {
pcstr_pat = patt p;
pcstr_self = patt p;
pcstr_fields = cil;
})
| CeTyc loc ce ct ->

View File

@ -15106,7 +15106,7 @@ module Struct =
in
mkexp loc
(Pexp_object
{ pcstr_pat = patt p; pcstr_fields = cil; })
{ pcstr_self = patt p; pcstr_fields = cil; })
| ExOlb (loc, _, _) ->
error loc "labeled expression not allowed here"
| ExOvr (loc, iel) ->
@ -15609,7 +15609,7 @@ module Struct =
in
mkcl loc
(Pcl_structure
{ pcstr_pat = patt p; pcstr_fields = cil; })
{ pcstr_self = patt p; pcstr_fields = cil; })
| CeTyc (loc, ce, ct) ->
mkcl loc
(Pcl_constraint ((class_expr ce), (class_type ct)))

View File

@ -292,9 +292,9 @@ module CE = struct
| Pcf_constr (t1, t2) -> constr ~loc (sub # typ t1) (sub # typ t2)
| Pcf_init e -> init ~loc (sub # expr e)
let map_structure sub {pcstr_pat; pcstr_fields} =
let map_structure sub {pcstr_self; pcstr_fields} =
{
pcstr_pat = sub # pat pcstr_pat;
pcstr_self = sub # pat pcstr_self;
pcstr_fields = List.map (sub # class_field) pcstr_fields;
}

View File

@ -792,7 +792,7 @@ class_simple_expr:
;
class_structure:
class_self_pattern class_fields
{ { pcstr_pat = $1; pcstr_fields = List.rev $2 } }
{ { pcstr_self = $1; pcstr_fields = List.rev $2 } }
;
class_self_pattern:
LPAREN pattern RPAREN

View File

@ -222,7 +222,7 @@ and class_expr_desc =
| Pcl_constraint of class_expr * class_type
and class_structure = {
pcstr_pat: pattern;
pcstr_self: pattern;
pcstr_fields: class_field list;
}

View File

@ -790,7 +790,7 @@ class printer ()= object(self:'self)
| Pcf_init (e) ->
pp f "@[<2>initializer@ %a@]" self#expression e
method class_structure f { pcstr_pat = p; pcstr_fields = l } =
method class_structure f { pcstr_self = p; pcstr_fields = l } =
pp f "@[<hv0>@[<hv2>object %a@;%a@]@;end@]"
(fun f p -> match p.ppat_desc with
| Ppat_any -> ()

View File

@ -493,7 +493,7 @@ and class_expr i ppf x =
class_expr i ppf ce;
class_type i ppf ct;
and class_structure i ppf { pcstr_pat = p; pcstr_fields = l } =
and class_structure i ppf { pcstr_self = p; pcstr_fields = l } =
line i ppf "class_structure\n";
pattern (i+1) ppf p;
list (i+1) class_field ppf l;

View File

@ -296,7 +296,7 @@ let rec add_labels_expr ~text ~values ~classes expr =
let rec add_labels_class ~text ~classes ~values ~methods cl =
match cl.pcl_desc with
Pcl_constr _ -> ()
| Pcl_structure { pcstr_pat = p; pcstr_fields = l } ->
| Pcl_structure { pcstr_self = p; pcstr_fields = l } ->
let values = SMap.removes (pattern_vars p) values in
let values =
match pattern_name p with None -> values

View File

@ -170,7 +170,7 @@ let rec add_expr bv exp =
| Pexp_assertfalse -> ()
| Pexp_lazy (e) -> add_expr bv e
| Pexp_poly (e, t) -> add_expr bv e; add_opt add_type bv t
| Pexp_object { pcstr_pat = pat; pcstr_fields = fieldl } ->
| Pexp_object { pcstr_self = pat; pcstr_fields = fieldl } ->
let bv = add_pattern bv pat in List.iter (add_class_field bv) fieldl
| Pexp_newtype (_, e) -> add_expr bv e
| Pexp_pack m -> add_module bv m
@ -308,7 +308,7 @@ and add_class_expr bv ce =
match ce.pcl_desc with
Pcl_constr(l, tyl) ->
add bv l; List.iter (add_type bv) tyl
| Pcl_structure { pcstr_pat = pat; pcstr_fields = fieldl } ->
| Pcl_structure { pcstr_self = pat; pcstr_fields = fieldl } ->
let bv = add_pattern bv pat in List.iter (add_class_field bv) fieldl
| Pcl_fun(_, opte, pat, ce) ->
add_opt add_expr bv opte;

View File

@ -471,8 +471,8 @@ and eq_class_field : (class_field * class_field) -> 'result =
and eq_class_structure :
(class_structure * class_structure) -> 'result =
fun
({ pcstr_pat = a0; pcstr_fields = a1 },
{ pcstr_pat = b0; pcstr_fields = b1 })
({ pcstr_self = a0; pcstr_fields = a1 },
{ pcstr_self = b0; pcstr_fields = b1 })
-> (eq_pattern (a0, b0)) && (eq_list eq_class_field (a1, b1))
and eq_class_expr_desc :
(class_expr_desc * class_expr_desc) -> 'result =

View File

@ -304,7 +304,7 @@ let core_type sub ct =
| Ttyp_package pack -> sub # package_type pack
let class_structure sub cs =
sub # pattern cs.cstr_pat;
sub # pattern cs.cstr_self;
List.iter (sub # class_field) cs.cstr_fields
let row_field sub rf =

View File

@ -507,7 +507,7 @@ and untype_core_type ct =
Typ.mk ~loc:ct.ctyp_loc desc
and untype_class_structure cs =
{ pcstr_pat = untype_pattern cs.cstr_pat;
{ pcstr_self = untype_pattern cs.cstr_self;
pcstr_fields = List.map untype_class_field cs.cstr_fields;
}

View File

@ -511,7 +511,7 @@ and class_expr i ppf x =
| Tcl_constraint (_, None, _, _, _) -> assert false
(* TODO : is it possible ? see parsetree *)
and class_structure i ppf { cstr_pat = p; cstr_fields = l } =
and class_structure i ppf { cstr_self = p; cstr_fields = l } =
line i ppf "class_structure\n";
pattern (i+1) ppf p;
list (i+1) class_field ppf l;

View File

@ -678,7 +678,7 @@ let rec class_field self_loc cl_num self_type meths vars
(val_env, met_env, par_env, field::fields, concr_meths, warn_vals, inher)
and class_structure cl_num final val_env met_env loc
{ pcstr_pat = spat; pcstr_fields = str } =
{ pcstr_self = spat; pcstr_fields = str } =
(* Environment for substructures *)
let par_env = met_env in
@ -790,7 +790,7 @@ and class_structure cl_num final val_env met_env loc
let sign = if final then sign else
{sign with cty_self = Ctype.expand_head val_env public_self} in
{
cstr_pat = pat;
cstr_self = pat;
cstr_fields = fields;
cstr_type = sign;
cstr_meths = meths}, sign (* redondant, since already in cstr_type *)

View File

@ -133,10 +133,12 @@ and class_expr_desc =
(* Visible instance variables, methods and concretes methods *)
and class_structure =
{ cstr_pat : pattern;
cstr_fields: class_field list;
cstr_type : Types.class_signature;
cstr_meths: Ident.t Meths.t }
{
cstr_self: pattern;
cstr_fields: class_field list;
cstr_type: Types.class_signature;
cstr_meths: Ident.t Meths.t;
}
and class_field =
{

View File

@ -132,10 +132,12 @@ and class_expr_desc =
(* Visible instance variables, methods and concretes methods *)
and class_structure =
{ cstr_pat : pattern;
cstr_fields: class_field list;
cstr_type : Types.class_signature;
cstr_meths: Ident.t Meths.t }
{
cstr_self: pattern;
cstr_fields: class_field list;
cstr_type: Types.class_signature;
cstr_meths: Ident.t Meths.t;
}
and class_field =
{

View File

@ -525,7 +525,7 @@ module MakeIterator(Iter : IteratorArgument) : sig
and iter_class_structure cs =
Iter.enter_class_structure cs;
iter_pattern cs.cstr_pat;
iter_pattern cs.cstr_self;
List.iter iter_class_field cs.cstr_fields;
Iter.leave_class_structure cs;

View File

@ -565,10 +565,9 @@ module MakeMap(Map : MapArgument) = struct
and map_class_structure cs =
let cs = Map.enter_class_structure cs in
let cstr_pat = map_pattern cs.cstr_pat in
let cstr_self = map_pattern cs.cstr_self in
let cstr_fields = List.map map_class_field cs.cstr_fields in
Map.leave_class_structure { cs with cstr_pat = cstr_pat;
cstr_fields = cstr_fields }
Map.leave_class_structure { cs with cstr_self; cstr_fields }
and map_row_field rf =
match rf with