jon.recoil.org

Module Mode_hint

type lock_item =
  1. | Value
  2. | Module
  3. | Class
  4. | Constructor

A description of what type of item is being closed over

type ident = {
  1. category : lock_item;
  2. lid : Longident.t;
    (*

    Sometimes we want the ident to represent M.x but the loc can only point to M. This field would store M.x.

    *)
}
type structure_item = lock_item * Ident.t
type pinpoint_desc =
  1. | Unknown
  2. | Ident of ident
    (*

    An identifier

    *)
  3. | Function
    (*

    A function definition

    *)
  4. | Module
    (*

    A module definition

    *)
  5. | Functor
    (*

    A functor definition

    *)
  6. | Structure
    (*

    A structure definition

    *)
  7. | Lazy
    (*

    A lazy expression

    *)
  8. | Quote
    (*

    A quoted expression

    *)
  9. | Allocation
    (*

    An allocation

    *)
  10. | Expression
    (*

    An arbitrary expression

    *)
  11. | Class
    (*

    A class declaration

    *)
  12. | Object
    (*

    An object declaration

    *)
  13. | Loop
    (*

    A loop

    *)
  14. | Letop
    (*

    A let op expression

    *)
  15. | Cases_result
    (*

    The result of cases

    *)
  16. | Pattern
    (*

    A pattern

    *)
  17. | Structure_item of structure_item
    (*

    an item in a structure being pointed at

    *)

Pinpoint's description to accompany pinpoint's location. It's about the syntax rather than the value. For example, we distinguish:

  • between a module identifer and a module definition
  • between a structure definition and a functor definition
  • BUT NOT between two module identifiers where one is a functor and the other is a structure.

The constructors are not mutually exclusive - some might be more precise than others.

type pinpoint = Location.t * pinpoint_desc

A pinpoint is a location in the source code, accompanied by additional description

type mutable_part =
  1. | Record_field of string
  2. | Array_elements
type always_dynamic =
  1. | Application
  2. | Try_with
type legacy =
  1. | Compilation_unit
  2. | Toplevel
  3. | Class
  4. | Quoted
type region_desc =
  1. | Borrow
type region = Location.t * region_desc
type ('d0, 'd1) polarity =
  1. | Monadic : ('l * 'r, 'r * 'l) polarity
  2. | Comonadic : ('l * 'r, 'l * 'r) polarity
constraint 'd0 = _ * _ constraint 'd1 = _ * _
type 'd const =
  1. | Unknown : ('l * 'r) const
    (*

    The constant bound is not explained.

    *)
  2. | Lazy_allocated_on_heap : (Allowance.disallowed * 'r) Allowance.pos const
  3. | Legacy : legacy -> ('l * 'r) const
  4. | Toplevel_expression : (Allowance.disallowed * 'r) Allowance.pos const
  5. | Tailcall_function : (Allowance.disallowed * 'r) Allowance.pos const
  6. | Tailcall_argument : (Allowance.disallowed * 'r) Allowance.pos const
  7. | Mutable_read : mutable_part -> (Allowance.disallowed * 'r) Allowance.neg const
  8. | Mutable_write : mutable_part -> (Allowance.disallowed * 'r) Allowance.neg const
  9. | Lazy_forced : (Allowance.disallowed * 'r) Allowance.neg const
  10. | Function_return : (Allowance.disallowed * 'r) Allowance.pos const
  11. | Stack_expression : ('l * Allowance.disallowed) Allowance.pos const
  12. | Module_allocated_on_heap : (Allowance.disallowed * 'r) Allowance.pos const
  13. | Always_dynamic : always_dynamic -> ('l * Allowance.disallowed) Allowance.neg const
  14. | Branching : ('l * Allowance.disallowed) Allowance.neg const
  15. | Lpoly_inst : (Allowance.disallowed * 'r) Allowance.neg const
  16. | Is_used_in : pinpoint -> (Allowance.disallowed * 'r) const
    (*

    A variant of Is_closed_by where the closure mode is constant. INVARIANT: The pinpoint cannot be Unknown.

    *)
  17. | Borrowed : Location.t * ('l * 'r, 'd) polarity -> 'd const
  18. | Escape_region : region -> (Allowance.disallowed * 'r) const
  19. | Quoted_computation : ('l * Allowance.disallowed) Allowance.pos const
  20. | Spliced : ('l * 'r, 'd) polarity -> 'd const
constraint 'd = _ * _

Hint for a constant bound. See Mode.Report.print_const for what each non-trivial constructor means.

type closure_details = {
  1. closure : pinpoint;
  2. closed : pinpoint;
}
type modality =
  1. | Modality
type containing =
  1. | Tuple
  2. | Record of string * modality
  3. | Array of modality
  4. | Constructor of string * modality
  5. | Structure of structure_item * modality
type contains = {
  1. containing : containing;
  2. contained : pinpoint;
}
type is_contained_by = {
  1. containing : containing;
  2. container : pinpoint;
}
type allocation_desc =
  1. | Unknown
  2. | Optional_argument
  3. | Function_coercion
  4. | Float_projection
  5. | Lpoly_captured_environment
type allocation = allocation_desc Location.loc
type 'd morph =
  1. | Unknown : ('l * 'r) morph
    (*

    The morphism is not explained.

    *)
  2. | Skip : ('l * 'r) morph
    (*

    The morphism doesn't change the bound and should be skipped in printing.

    *)
  3. | Close_over : ('d, 'l * Allowance.disallowed) polarity * closure_details -> ('l * Allowance.disallowed) morph
  4. | Is_closed_by : ('d, Allowance.disallowed * 'r) polarity * closure_details -> (Allowance.disallowed * 'r) morph
  5. | Captured_by_partial_application : (Allowance.disallowed * 'r) morph
  6. | Adj_captured_by_partial_application : ('l * Allowance.disallowed) morph
  7. | Crossing : ('l * 'r) morph
  8. | Allocation_r : allocation -> (Allowance.disallowed * 'r) morph
  9. | Allocation_l : allocation -> ('l * Allowance.disallowed) morph
  10. | Contains_l : ('l * Allowance.disallowed, 'd) polarity * contains -> 'd morph
  11. | Is_contained_by : ('l * 'r, 'd) polarity * is_contained_by -> 'd morph
  12. | Contains_r : (Allowance.disallowed * 'r, 'd) polarity * contains -> 'd morph
constraint 'd = _ * _

Hint for morphisms. When acompanied by a destination pinpoint, morph gives a source pinpoint and explains the relation between them. See Mode.Report.print_morph for what each non-trivial constructor means.