Module Js_of_ocaml_compiler.Javascript

module Num : sig ... end
module Label : sig ... end
type location =
  1. | Pi of Parse_info.t
  2. | N
  3. | U
type identifier = Stdlib.Utf8_string.t
type ident_string = {
  1. name : identifier;
  2. var : Code.Var.t option;
  3. loc : location;
}
type early_error = {
  1. loc : Parse_info.t;
  2. reason : string option;
}
type ident =
  1. | S of ident_string
  2. | V of Code.Var.t
and array_litteral = element_list
and element_list = element list
and element =
  1. | ElementHole
  2. | Element of expression
  3. | ElementSpread of expression
and binop =
  1. | Eq
  2. | StarEq
  3. | SlashEq
  4. | ModEq
  5. | PlusEq
  6. | MinusEq
  7. | LslEq
  8. | AsrEq
  9. | LsrEq
  10. | BandEq
  11. | BxorEq
  12. | BorEq
  13. | Or
  14. | OrEq
  15. | And
  16. | AndEq
  17. | Bor
  18. | Bxor
  19. | Band
  20. | EqEq
  21. | NotEq
  22. | EqEqEq
  23. | NotEqEq
  24. | Lt
  25. | Le
  26. | Gt
  27. | Ge
  28. | LtInt
  29. | LeInt
  30. | GtInt
  31. | GeInt
  32. | InstanceOf
  33. | In
  34. | Lsl
  35. | Lsr
  36. | Asr
  37. | Plus
  38. | Minus
  39. | Mul
  40. | Div
  41. | Mod
  42. | Exp
  43. | ExpEq
  44. | Coalesce
  45. | CoalesceEq
and unop =
  1. | Not
  2. | Neg
  3. | Pl
  4. | Typeof
  5. | Void
  6. | Delete
  7. | Bnot
  8. | IncrA
  9. | DecrA
  10. | IncrB
  11. | DecrB
  12. | Await
and arguments = argument list
and argument =
  1. | Arg of expression
  2. | ArgSpread of expression
and property_list = property list
and property =
  1. | Property of property_name * expression
  2. | PropertySpread of expression
  3. | PropertyMethod of property_name * method_
  4. | CoverInitializedName of early_error * ident * initialiser
and method_ =
  1. | MethodGet of function_declaration
  2. | MethodSet of function_declaration
  3. | Method of function_declaration
and property_name =
  1. | PNI of identifier
  2. | PNS of Stdlib.Utf8_string.t
  3. | PNN of Num.t
  4. | PComputed of expression
and expression =
  1. | ESeq of expression * expression
  2. | ECond of expression * expression * expression
  3. | EAssignTarget of assignment_target
  4. | EBin of binop * expression * expression
  5. | EUn of unop * expression
  6. | ECall of expression * access_kind * arguments * location
  7. | ECallTemplate of expression * template * location
  8. | EAccess of expression * access_kind * expression
  9. | EDot of expression * access_kind * identifier
  10. | EDotPrivate of expression * access_kind * identifier
  11. | ENew of expression * arguments option * location
  12. | EVar of ident
  13. | EFun of ident option * function_declaration
  14. | EClass of ident option * class_declaration
  15. | EArrow of function_declaration * bool * arrow_info
  16. | EStr of Stdlib.Utf8_string.t
  17. | ETemplate of template
  18. | EArr of array_litteral
  19. | EBool of bool
  20. | ENum of Num.t
  21. | EObj of property_list
  22. | ERegexp of string * string option
  23. | EYield of {
    1. delegate : bool;
    2. expr : expression option;
    }
  24. | EPrivName of identifier
  25. | CoverParenthesizedExpressionAndArrowParameterList of early_error
  26. | CoverCallExpressionAndAsyncArrowHead of early_error
and arrow_info =
  1. | AUnknown
  2. | AUse_parent_fun_context
  3. | ANo_fun_context
and template = template_part list
and template_part =
  1. | TStr of Stdlib.Utf8_string.t
  2. | TExp of expression
and access_kind =
  1. | ANormal
  2. | ANullish
  3. | AChain
and statement =
  1. | Block of block
  2. | Variable_statement of variable_declaration_kind * variable_declaration list
  3. | Function_declaration of ident * function_declaration
  4. | Class_declaration of ident * class_declaration
  5. | Empty_statement
  6. | Expression_statement of expression
  7. | If_statement of expression * statement * location * (statement * location) option
  8. | Do_while_statement of statement * location * expression
  9. | While_statement of expression * statement * location
  10. | For_statement of (expression option, variable_declaration_kind * variable_declaration list) either * expression option * expression option * statement * location
  11. | ForIn_statement of (expression, variable_declaration_kind * for_binding) either * expression * statement * location
  12. | ForOf_statement of (expression, variable_declaration_kind * for_binding) either * expression * statement * location
  13. | ForAwaitOf_statement of (expression, variable_declaration_kind * for_binding) either * expression * statement * location
  14. | Continue_statement of Label.t option
  15. | Break_statement of Label.t option
  16. | Return_statement of expression option * location
  17. | With_statement of expression * statement * location
  18. | Labelled_statement of Label.t * statement * location
  19. | Switch_statement of expression * case_clause list * statement_list option * case_clause list
  20. | Throw_statement of expression
  21. | Try_statement of block * (formal_parameter option * block) option * block option
  22. | Debugger_statement
  23. | Import of import * Parse_info.t
  24. | Export of export * Parse_info.t
and ('left, 'right) either =
  1. | Left of 'left
  2. | Right of 'right
and block = statement_list
and statement_list = (statement * location) list
and variable_declaration =
  1. | DeclIdent of ident * initialiser option
  2. | DeclPattern of binding_pattern * initialiser
and variable_declaration_kind =
  1. | Var
  2. | Let
  3. | Const
  4. | Using
  5. | AwaitUsing
and case_clause = expression * statement_list
and initialiser = expression * location
and function_kind = {
  1. async : bool;
  2. generator : bool;
}
and decorator = expression
and class_declaration = {
  1. decorators : decorator list;
  2. extends : expression option;
  3. body : class_element list;
}
and class_element =
  1. | CEMethod of decorator list * bool * class_element_name * method_
  2. | CEField of decorator list * bool * class_element_name * initialiser option
  3. | CEAccessor of decorator list * bool * class_element_name * initialiser option
  4. | CEStaticBLock of statement_list
and class_element_name =
  1. | PropName of property_name
  2. | PrivName of identifier
and ('a, 'b) list_with_rest = {
  1. list : 'a list;
  2. rest : 'b option;
}
and formal_parameter_list = (formal_parameter, binding) list_with_rest
and formal_parameter = binding_element
and for_binding = binding
and binding_element = binding * initialiser option
and binding =
  1. | BindingIdent of ident
  2. | BindingPattern of binding_pattern
and binding_pattern =
  1. | ObjectBinding of (binding_property, ident) list_with_rest
  2. | ArrayBinding of (binding_element option, binding) list_with_rest
and object_target_elt =
  1. | TargetPropertyId of ident_prop * initialiser option
  2. | TargetProperty of property_name * expression * initialiser option
  3. | TargetPropertySpread of expression
  4. | TargetPropertyMethod of property_name * method_
and array_target_elt =
  1. | TargetElementId of ident * initialiser option
  2. | TargetElementHole
  3. | TargetElement of expression
  4. | TargetElementSpread of expression
and assignment_target =
  1. | ObjectTarget of object_target_elt list
  2. | ArrayTarget of array_target_elt list
and ident_prop =
  1. | Prop_and_ident of ident
and binding_property =
  1. | Prop_binding of property_name * binding_element
  2. | Prop_ident of ident_prop * initialiser option
and function_body = statement_list
and program = statement_list
and export =
  1. | ExportVar of variable_declaration_kind * variable_declaration list
  2. | ExportFun of ident * function_declaration
  3. | ExportClass of ident * class_declaration
  4. | ExportNames of (ident * Stdlib.Utf8_string.t) list
  5. | ExportDefaultFun of ident option * function_declaration
  6. | ExportDefaultClass of ident option * class_declaration
  7. | ExportDefaultExpression of expression
  8. | ExportFrom of {
    1. kind : export_from_kind;
    2. from : Stdlib.Utf8_string.t;
    3. withClause : withClause option;
    }
  9. | CoverExportFrom of early_error
and export_from_kind =
  1. | Export_all of Stdlib.Utf8_string.t option
  2. | Export_names of (Stdlib.Utf8_string.t * Stdlib.Utf8_string.t) list
and import = {
  1. from : Stdlib.Utf8_string.t;
  2. kind : import_kind;
  3. withClause : withClause option;
}
and withClause = (Stdlib.Utf8_string.t * Stdlib.Utf8_string.t) list
and import_default = ident
and import_kind =
  1. | Source of ident
  2. | DeferNamespace of ident
  3. | Namespace of import_default option * ident
  4. | Named of import_default option * (Stdlib.Utf8_string.t * ident) list
  5. | Default of import_default
  6. | SideEffect
and program_with_annots = (statement_list * (Js_token.Annot.t * Parse_info.t) list) list
val compare_ident : ident -> ident -> int
val is_ident : string -> bool
val is_ident' : Stdlib.Utf8_string.t -> bool
val ident_equal : ident -> ident -> bool
val ident : ?loc:location -> ?var:Code.Var.t -> identifier -> ident
val param : ?loc:location -> ?var:Code.Var.t -> identifier -> formal_parameter
val param' : ident -> formal_parameter
val ident_unsafe : ?loc:location -> ?var:Code.Var.t -> identifier -> ident
val bound_idents_of_params : formal_parameter_list -> ident list
val bound_idents_of_variable_declaration : variable_declaration -> ident list
val bound_idents_of_pattern : binding_pattern -> ident list
val bound_idents_of_binding : binding -> ident list
module IdentSet : Stdlib.Set.S with type elt = ident
module IdentMap : Stdlib.Map.S with type key = ident
val is_optional_chain : expression -> bool

Whether an expression is an optional chain, possibly continued by accesses of kind AChain. Such an expression is put between parentheses when it is the object of an access of kind ANormal, a template tag, or the operand of new.

val array : expression list -> expression
val call : expression -> expression list -> location -> expression
val variable_declaration : ?kind:variable_declaration_kind -> (ident * initialiser) list -> statement
val list : 'a list -> ('a, _) list_with_rest
val early_error : ?reason:string -> Parse_info.t -> early_error
val assignment_target_of_expr : binop option -> expression -> expression
val location_equal : location -> location -> bool