2 * Copyright (c) 2018, 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.
13 module SN
= Naming_special_names
15 let has_const attrs
= Naming_attributes.mem
SN.UserAttributes.uaConst attrs
17 let error_if_const pos attrs
=
18 if has_const attrs
then
19 Errors.experimental_feature pos
"The __Const attribute is not supported."
23 inherit Nast_visitor.handler_base
25 method! at_class_ env c
=
27 * disallow __Const attribute unless typechecker option is enabled
29 let pos = fst c
.c_name
in
30 if not
(TypecheckerOptions.const_attribute
(get_tcopt env
)) then (
31 error_if_const pos c
.c_user_attributes
;
32 List.iter c
.c_vars
(fun cv
-> error_if_const pos cv
.cv_user_attributes
)