Summary: Now, that we consistently use `AnnotatedType`, `AnnotatedNullability`, and `AnnotatedSignature`, `AnnotatedField` is a natural name for this datatype. Together `AnnotatedSignature` and `AnnotatedField` represent two entry points for fetching information about Java type from the codebase. Reviewed By: artempyanykh Differential Revision: D17570534 fbshipit-source-id: 31ef52033master
parent
34cfa20faf
commit
df5ccc1b10
@ -0,0 +1,24 @@
|
||||
(*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*)
|
||||
|
||||
open! IStd
|
||||
|
||||
(* TODO(T54088319) get rid of annotation_deprecated:
|
||||
Introduce "field flags" and move all other usages to this dedicated datatype
|
||||
*)
|
||||
type t = {annotation_deprecated: Annot.Item.t; annotated_type: AnnotatedType.t}
|
||||
|
||||
let get tenv fn typ =
|
||||
let lookup = Tenv.lookup tenv in
|
||||
let type_and_annotation_to_field_type (typ, annotation) =
|
||||
{ annotation_deprecated= annotation
|
||||
; annotated_type=
|
||||
AnnotatedType.{nullability= AnnotatedNullability.of_annot_item annotation; typ} }
|
||||
in
|
||||
Option.map
|
||||
(Typ.Struct.get_field_type_and_annotation ~lookup fn typ)
|
||||
~f:type_and_annotation_to_field_type
|
@ -0,0 +1,15 @@
|
||||
(*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*)
|
||||
|
||||
open! IStd
|
||||
|
||||
(** Representation of a declared class field with nullsafe-specific data *)
|
||||
|
||||
type t = {annotation_deprecated: Annot.Item.t; annotated_type: AnnotatedType.t}
|
||||
|
||||
val get : Tenv.t -> Typ.Fieldname.t -> Typ.t -> t option
|
||||
(** Looks up for a field declaration and, in case of success, converts it to {t} *)
|
Loading…
Reference in new issue