Add readonly to decl and function types
[hiphop-php.git] / hphp / hack / src / decl / shallow_decl_defs.mli
blob1608344adca3c6eeb3e1fc8f783bc74f76e5e2c8
1 (*
2 * Copyright (c) 2018, Facebook, Inc.
3 * All rights reserved.
5 * This source code is licensed under the MIT license found in the
6 * LICENSE file in the "hack" directory of this source tree.
8 *)
10 open Typing_defs
12 module PropFlags : sig
13 type t [@@deriving eq, show]
15 val empty : t
17 val get_abstract : t -> bool
18 val get_const : t -> bool
19 val get_lateinit : t -> bool
20 val get_lsb : t -> bool
21 val get_needs_init : t -> bool
22 val get_php_std_lib : t -> bool
23 val get_readonly : t -> bool
25 val set_abstract : bool -> t -> t
26 val set_const : bool -> t -> t
27 val set_lateinit : bool -> t -> t
28 val set_lsb : bool -> t -> t
29 val set_needs_init : bool -> t -> t
30 val set_php_std_lib : bool -> t -> t
31 val set_readonly : bool -> t -> t
33 val make :
34 abstract:bool ->
35 const:bool ->
36 lateinit:bool ->
37 lsb:bool ->
38 needs_init:bool ->
39 php_std_lib:bool ->
40 readonly: bool ->
42 end
43 [@@ocamlformat "disable"]
45 module MethodFlags : sig
46 type t [@@deriving eq, show]
48 val empty : t
50 val get_abstract : t -> bool
51 val get_final : t -> bool
52 val get_override : t -> bool
53 val get_dynamicallycallable : t -> bool
54 val get_php_std_lib : t -> bool
56 val set_abstract : bool -> t -> t
57 val set_final : bool -> t -> t
58 val set_override : bool -> t -> t
59 val set_dynamicallycallable : bool -> t -> t
60 val set_php_std_lib : bool -> t -> t
62 val make :
63 abstract:bool ->
64 final:bool ->
65 override:bool ->
66 dynamicallycallable:bool ->
67 php_std_lib:bool ->
69 end
70 [@@ocamlformat "disable"]
72 type shallow_class_const = {
73 scc_abstract: bool;
74 scc_name: Ast_defs.id;
75 scc_type: decl_ty;
77 [@@deriving eq, show]
79 type shallow_typeconst = {
80 stc_abstract: typeconst_abstract_kind;
81 stc_as_constraint: decl_ty option;
82 stc_name: Ast_defs.id;
83 stc_type: decl_ty option;
84 stc_enforceable: Pos.t * bool;
85 stc_reifiable: Pos.t option;
87 [@@deriving eq, show]
89 type shallow_prop = {
90 sp_name: Ast_defs.id;
91 sp_xhp_attr: xhp_attr option;
92 sp_type: decl_ty option;
93 sp_visibility: Ast_defs.visibility;
94 sp_flags: PropFlags.t;
96 [@@deriving eq, show]
98 type shallow_method = {
99 sm_name: Ast_defs.id;
100 sm_reactivity: Decl_defs.method_reactivity option;
101 sm_type: decl_ty;
102 sm_visibility: Ast_defs.visibility;
103 sm_deprecated: string option;
104 sm_flags: MethodFlags.t;
106 [@@deriving eq, show]
108 type shallow_class = {
109 sc_mode: FileInfo.mode;
110 sc_final: bool;
111 sc_is_xhp: bool;
112 sc_has_xhp_keyword: bool;
113 sc_kind: Ast_defs.class_kind;
114 sc_name: Ast_defs.id;
115 sc_tparams: decl_tparam list;
116 sc_where_constraints: decl_where_constraint list;
117 sc_extends: decl_ty list;
118 sc_uses: decl_ty list;
119 sc_xhp_attr_uses: decl_ty list;
120 sc_req_extends: decl_ty list;
121 sc_req_implements: decl_ty list;
122 sc_implements: decl_ty list;
123 sc_implements_dynamic: bool;
124 sc_consts: shallow_class_const list;
125 sc_typeconsts: shallow_typeconst list;
126 sc_props: shallow_prop list;
127 sc_sprops: shallow_prop list;
128 sc_constructor: shallow_method option;
129 sc_static_methods: shallow_method list;
130 sc_methods: shallow_method list;
131 sc_user_attributes: user_attribute list;
132 sc_enum_type: enum_type option;
134 [@@deriving eq, show]
136 val sp_abstract : shallow_prop -> bool
138 val sp_const : shallow_prop -> bool
140 val sp_lateinit : shallow_prop -> bool
142 val sp_lsb : shallow_prop -> bool
144 val sp_needs_init : shallow_prop -> bool
146 val sp_php_std_lib : shallow_prop -> bool
148 val sp_readonly : shallow_prop -> bool
150 val sm_abstract : shallow_method -> bool
152 val sm_final : shallow_method -> bool
154 val sm_override : shallow_method -> bool
156 val sm_dynamicallycallable : shallow_method -> bool
158 val sm_php_std_lib : shallow_method -> bool
160 type fun_decl = fun_elt [@@deriving show]
162 type class_decl = shallow_class [@@deriving show]
164 type record_decl = record_def_type [@@deriving show]
166 type typedef_decl = typedef_type [@@deriving show]
168 type const_decl = Typing_defs.const_decl [@@deriving show]
170 type decl =
171 | Class of class_decl
172 | Fun of fun_decl
173 | Record of record_decl
174 | Typedef of typedef_decl
175 | Const of const_decl
176 [@@deriving show]