summaryrefslogtreecommitdiff
path: root/parsing/ast_helper.ml
diff options
context:
space:
mode:
authorAlain Frisch <alain@frisch.fr>2013-04-09 15:54:41 +0000
committerAlain Frisch <alain@frisch.fr>2013-04-09 15:54:41 +0000
commitd84ae411827a04f4240f94139e2d8c4aa64b139e (patch)
tree475f98289a7dc345dda3c8f5afb1c2d7be1e3820 /parsing/ast_helper.ml
parent3df9fa27623d2c23fc3af6b78361a0134eaa8de5 (diff)
downloadocaml-d84ae411827a04f4240f94139e2d8c4aa64b139e.tar.gz
Item attributes on class fields.
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/extension_points@13493 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'parsing/ast_helper.ml')
-rw-r--r--parsing/ast_helper.ml24
1 files changed, 15 insertions, 9 deletions
diff --git a/parsing/ast_helper.ml b/parsing/ast_helper.ml
index 19018a6327..f8a64c5ee9 100644
--- a/parsing/ast_helper.ml
+++ b/parsing/ast_helper.ml
@@ -191,15 +191,21 @@ module Ctf = struct
end
module Cf = struct
- let mk ?(loc = Location.none) d = {pcf_desc = d; pcf_loc = loc}
-
- let inher ?loc a b c = mk ?loc (Pcf_inher (a, b, c))
- let valvirt ?loc a b c = mk ?loc (Pcf_valvirt (a, b, c))
- let val_ ?loc a b c d = mk ?loc (Pcf_val (a, b, c, d))
- let virt ?loc a b c = mk ?loc (Pcf_virt (a, b, c))
- let meth ?loc a b c d = mk ?loc (Pcf_meth (a, b, c, d))
- let constr ?loc a b = mk ?loc (Pcf_constr (a, b))
- let init ?loc a = mk ?loc (Pcf_init a)
+ let mk ?(attrs = []) ?(loc = Location.none) d =
+ {
+ pcf_desc = d;
+ pcf_loc = loc;
+ pcf_attributes = attrs;
+ }
+ let attr d a = {d with pcf_attributes = d.pcf_attributes @ [a]}
+
+ let inher ?loc ?attrs a b c = mk ?loc ?attrs (Pcf_inher (a, b, c))
+ let valvirt ?loc ?attrs a b c = mk ?loc ?attrs (Pcf_valvirt (a, b, c))
+ let val_ ?loc ?attrs a b c d = mk ?loc ?attrs (Pcf_val (a, b, c, d))
+ let virt ?loc ?attrs a b c = mk ?loc ?attrs (Pcf_virt (a, b, c))
+ let meth ?loc ?attrs a b c d = mk ?loc ?attrs (Pcf_meth (a, b, c, d))
+ let constr ?loc ?attrs a b = mk ?loc ?attrs (Pcf_constr (a, b))
+ let init ?loc ?attrs a = mk ?loc ?attrs (Pcf_init a)
end
module Val = struct