2 * Copyright (c) 2015, Facebook, Inc.
5 * This source code is licensed under the MIT license found in the
6 * LICENSE file in the "hack" directory of this source tree.
10 type t
= GlobalOptions.t
[@@deriving show
]
12 let auto_namespace_map = GlobalOptions.po_auto_namespace_map
14 let with_auto_namespace_map po m
=
15 { po
with GlobalOptions.po_auto_namespace_map
= m
}
17 let codegen = GlobalOptions.po_codegen
19 let deregister_php_stdlib = GlobalOptions.po_deregister_php_stdlib
21 let disallow_toplevel_requires = GlobalOptions.po_disallow_toplevel_requires
23 let default = GlobalOptions.default
25 let disable_nontoplevel_declarations =
26 GlobalOptions.po_disable_nontoplevel_declarations
28 let const_default_func_args = GlobalOptions.po_const_default_func_args
30 let with_const_default_func_args po b
=
31 { po
with GlobalOptions.po_const_default_func_args
= b
}
33 let const_default_lambda_args = GlobalOptions.po_const_default_lambda_args
35 let with_const_default_lambda_args po b
=
36 { po
with GlobalOptions.po_const_default_lambda_args
= b
}
38 let with_codegen po b
= { po
with GlobalOptions.po_codegen
= b
}
40 let with_disable_lval_as_an_expression po b
=
41 { po
with GlobalOptions.po_disable_lval_as_an_expression
= b
}
43 let disable_lval_as_an_expression =
44 GlobalOptions.po_disable_lval_as_an_expression
46 let enable_class_level_where_clauses =
47 GlobalOptions.po_enable_class_level_where_clauses
49 let disable_legacy_soft_typehints =
50 GlobalOptions.po_disable_legacy_soft_typehints
52 let with_disable_legacy_soft_typehints po b
=
53 { po
with GlobalOptions.po_disable_legacy_soft_typehints
= b
}
55 let allowed_decl_fixme_codes = GlobalOptions.po_allowed_decl_fixme_codes
57 let allow_new_attribute_syntax = GlobalOptions.po_allow_new_attribute_syntax
59 let with_allow_new_attribute_syntax po b
=
60 { po
with GlobalOptions.po_allow_new_attribute_syntax
= b
}
62 let disable_legacy_attribute_syntax =
63 GlobalOptions.po_disable_legacy_attribute_syntax
65 let with_disable_legacy_attribute_syntax po b
=
66 { po
with GlobalOptions.po_disable_legacy_attribute_syntax
= b
}
68 let disallow_silence = GlobalOptions.po_disallow_silence
70 let const_static_props = GlobalOptions.tco_const_static_props
72 let with_const_static_props po b
=
73 { po
with GlobalOptions.tco_const_static_props
= b
}
75 let abstract_static_props = GlobalOptions.po_abstract_static_props
77 let with_abstract_static_props po b
=
78 { po
with GlobalOptions.po_abstract_static_props
= b
}
80 let disable_unset_class_const = GlobalOptions.po_disable_unset_class_const
82 let parser_errors_only = GlobalOptions.po_parser_errors_only
84 let with_parser_errors_only po b
=
85 { po
with GlobalOptions.po_parser_errors_only
= b
}
87 let disallow_func_ptrs_in_constants =
88 GlobalOptions.po_disallow_func_ptrs_in_constants
90 let with_disallow_func_ptrs_in_constants po b
=
91 { po
with GlobalOptions.po_disallow_func_ptrs_in_constants
= b
}
93 let disable_xhp_element_mangling = GlobalOptions.po_disable_xhp_element_mangling
95 let with_disable_xhp_element_mangling po b
=
96 { po
with GlobalOptions.po_disable_xhp_element_mangling
= b
}
98 let allow_unstable_features = GlobalOptions.po_allow_unstable_features
100 let with_allow_unstable_features po b
=
101 { po
with GlobalOptions.po_allow_unstable_features
= b
}
103 let disable_xhp_children_declarations =
104 GlobalOptions.po_disable_xhp_children_declarations
106 let with_disable_xhp_children_declarations po b
=
107 { po
with GlobalOptions.po_disable_xhp_children_declarations
= b
}
109 let enable_xhp_class_modifier = GlobalOptions.po_enable_xhp_class_modifier
111 let with_enable_xhp_class_modifier po b
=
112 { po
with GlobalOptions.po_enable_xhp_class_modifier
= b
}
114 let enable_enum_classes = GlobalOptions.po_enable_enum_classes
116 let with_enable_enum_classes po b
=
117 { po
with GlobalOptions.po_enable_enum_classes
= b
}
119 let with_enable_enum_supertyping po b
=
120 { po
with GlobalOptions.po_enable_enum_supertyping
= b
}
122 let disable_modes = GlobalOptions.po_disable_modes
124 let disable_hh_ignore_error = GlobalOptions.po_disable_hh_ignore_error
126 let disable_array = GlobalOptions.po_disable_array
128 let disable_array_typehint = GlobalOptions.po_disable_array_typehint
130 let disallow_hash_comments = GlobalOptions.po_disallow_hash_comments
132 let with_disallow_hash_comments po b
=
133 { po
with GlobalOptions.po_disallow_hash_comments
= b
}
135 let disallow_fun_and_cls_meth_pseudo_funcs =
136 GlobalOptions.po_disallow_fun_and_cls_meth_pseudo_funcs
138 let with_disallow_fun_and_cls_meth_pseudo_funcs po b
=
139 { po
with GlobalOptions.po_disallow_fun_and_cls_meth_pseudo_funcs
= b
}
141 let disallow_inst_meth = GlobalOptions.po_disallow_inst_meth
143 let with_disallow_inst_meth po b
=
144 { po
with GlobalOptions.po_disallow_inst_meth
= b
}
146 let enable_readonly_in_emitter = GlobalOptions.po_enable_readonly_in_emitter
148 let with_enable_readonly_in_emitter po b
=
149 { po
with GlobalOptions.po_enable_readonly_in_emitter
= b
}
151 let escape_brace = GlobalOptions.po_escape_brace
153 let with_escape_brace po b
= { po
with GlobalOptions.po_escape_brace
= b
}
155 let interpret_soft_types_as_like_types =
156 GlobalOptions.po_interpret_soft_types_as_like_types
158 let with_interpret_soft_types_as_like_types po b
=
159 { po
with GlobalOptions.po_interpret_soft_types_as_like_types
= b
}
161 let with_everything_sdt po b
= { po
with GlobalOptions.tco_everything_sdt
= b
}
166 ~
disable_nontoplevel_declarations
167 ~
disable_lval_as_an_expression
168 ~
enable_class_level_where_clauses
169 ~
disable_legacy_soft_typehints
170 ~
allow_new_attribute_syntax
171 ~
disable_legacy_attribute_syntax
172 ~
const_default_func_args
173 ~
const_default_lambda_args
176 ~
abstract_static_props
177 ~
disable_unset_class_const
178 ~
disallow_func_ptrs_in_constants
179 ~
enable_xhp_class_modifier
180 ~
disable_xhp_element_mangling
181 ~
allow_unstable_features
182 ~
disable_xhp_children_declarations
185 ~
disable_hh_ignore_error
187 ~
disable_array_typehint
188 ~
disallow_hash_comments
189 ~
disallow_fun_and_cls_meth_pseudo_funcs
190 ~
interpret_soft_types_as_like_types
192 ~
enable_readonly_in_emitter
197 po_auto_namespace_map
= auto_namespace_map;
198 po_codegen
= codegen;
199 po_disable_nontoplevel_declarations
= disable_nontoplevel_declarations;
200 po_disable_lval_as_an_expression
= disable_lval_as_an_expression;
201 po_enable_class_level_where_clauses
= enable_class_level_where_clauses;
202 po_disable_legacy_soft_typehints
= disable_legacy_soft_typehints;
203 po_allow_new_attribute_syntax
= allow_new_attribute_syntax;
204 po_disable_legacy_attribute_syntax
= disable_legacy_attribute_syntax;
205 po_const_default_func_args
= const_default_func_args;
206 po_const_default_lambda_args
= const_default_lambda_args;
207 po_disallow_silence
= disallow_silence;
208 tco_const_static_props
= const_static_props;
209 po_abstract_static_props
= abstract_static_props;
210 po_disable_unset_class_const
= disable_unset_class_const;
211 po_disallow_func_ptrs_in_constants
= disallow_func_ptrs_in_constants;
212 po_enable_xhp_class_modifier
= enable_xhp_class_modifier;
213 po_disable_xhp_element_mangling
= disable_xhp_element_mangling;
214 po_allow_unstable_features
= allow_unstable_features;
215 po_disable_xhp_children_declarations
= disable_xhp_children_declarations;
216 po_enable_enum_classes
= enable_enum_classes;
217 po_disable_modes
= disable_modes;
218 po_disable_hh_ignore_error
= disable_hh_ignore_error;
219 po_disable_array
= disable_array;
220 po_disable_array_typehint
= disable_array_typehint;
221 po_disallow_hash_comments
= disallow_hash_comments;
222 po_disallow_fun_and_cls_meth_pseudo_funcs
=
223 disallow_fun_and_cls_meth_pseudo_funcs;
224 po_interpret_soft_types_as_like_types
= interpret_soft_types_as_like_types;
225 po_disallow_inst_meth
= disallow_inst_meth;
226 po_enable_readonly_in_emitter
= enable_readonly_in_emitter;
227 po_escape_brace
= escape_brace;
230 (* Changes here need to be synchronized with rust_parser_errors_ffi.rs *)
258 let to_rust_ffi_t po ~hhvm_compat_mode ~hhi_mode ~
codegen =
262 disable_lval_as_an_expression po
,
263 disable_legacy_soft_typehints po
,
264 const_static_props po
,
265 disable_legacy_attribute_syntax po
,
266 const_default_func_args po
,
267 abstract_static_props po
,
268 disallow_func_ptrs_in_constants po
,
269 enable_xhp_class_modifier po
,
270 disable_xhp_element_mangling po
,
271 disable_xhp_children_declarations po
,
272 enable_enum_classes po
,
275 const_default_lambda_args po
,
276 disable_array_typehint po
,
277 allow_unstable_features po
,
278 disallow_hash_comments po
,
279 disallow_fun_and_cls_meth_pseudo_funcs po
,
280 interpret_soft_types_as_like_types po
,
281 disallow_inst_meth po
,
282 enable_readonly_in_emitter po
,