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 type ctx
= { class_tparams
: Nast.tparam list
}
17 inherit [ctx
] Nast_visitor.iter_with_state
as super
19 method! on_hint
(env
, state
) (pos
, h
) =
22 | Habstr
(tp_name
, args
) ->
25 ~f
:(fun { tp_name
= (c_tp_pos
, c_tp_name
); _
} ->
26 if String.equal c_tp_name tp_name
then
30 @@ Typeconst_depends_on_external_tparam
31 { pos
; ext_pos
= c_tp_pos
; ext_name
= c_tp_name
}));
32 List.iter args ~f
:(this#on_hint
(env
, state
))
35 super#on_hint
(env
, state
) (pos
, h
)
40 inherit Nast_visitor.handler_base
42 method! at_class_ env c
=
43 let state = { class_tparams
= c
.c_tparams
} in
44 let on_hint = visitor#
on_hint (env
, state) in
45 List.iter c
.c_typeconsts ~f
:(fun t
->
46 match t
.c_tconst_kind
with
49 c_atc_as_constraint
= a
;
50 c_atc_super_constraint
= s
;
53 Option.iter a ~f
:on_hint;
54 Option.iter s ~f
:on_hint;
55 Option.iter d ~f
:on_hint
56 | TCConcrete
{ c_tc_type
= t
} -> on_hint t
)