Module IR.Annot

The Smallfoot Intermediate Language: Annotations

module F = Stdlib.Format
type t = {
  1. class_name : string;
    (*

    name of the annotation

    *)
  2. parameters : parameter list;
}

Type to represent an @Annotation with potentially complex parameter values such as arrays or other annotations.

and parameter = {
  1. name : string option;
  2. value : value;
}
and value =
  1. | Str of string
  2. | Bool of bool
  3. | Enum of {
    1. class_typ : Typ.t;
    2. value : string;
    }
  4. | Array of value list
  5. | Class of Typ.t
  6. | Annot of t

Type to represent possible annotation parameter values. Note that support for numeric parameters is missing for now due to an issue with MaximumSharing and int64.

val equal : t -> t -> bool
val equal_parameter : parameter -> parameter -> bool
val equal_value : value -> value -> bool
val hash_normalize : t -> t
val hash_normalize_opt : t option -> t option
val hash_normalize_list : t list -> t list
val hash_normalize_parameter : parameter -> parameter
val hash_normalize_parameter_opt : parameter option -> parameter option
val hash_normalize_parameter_list : parameter list -> parameter list
val hash_normalize_value : value -> value
val hash_normalize_value_opt : value option -> value option
val hash_normalize_value_list : value list -> value list
val compare : t -> t -> int
val compare_parameter : parameter -> parameter -> int
val compare_value : value -> value -> int
val abstract : t

annotation for fields marked with the "abstract" keyword

val volatile : t

annotation for fields marked with the "volatile" keyword

val final : t

annotation for fields marked with the "final" keyword

val notnull : t

annotation for fields/params marked as "never null"

val has_matching_str_value : pred:(string -> bool) -> value -> bool

Check if annotation parameter value contains a string satisfying a predicate. For convenience it works both with raw Str, Str inside Array and Enum values.

val find_parameter : t -> name:string -> value option
val pp : F.formatter -> t -> unit

Pretty print an annotation.

module Item : sig ... end
module Class : sig ... end