package merlin-lib
Merlin's libraries
Install
Dune Dependency
Authors
Maintainers
Sources
merlin-4.16-501.tbz
sha256=da5bf309b040645c292ae4572cc6a0a700dbd2bcfc996ac13c8e5c3836c21e26
sha512=99eba17b2bdec5411d239093f4e8e11ada79b2b84ae88074a1b46e47eb836bbf8cb7836c472c22e7f9e68cff1b9ea6d9b9989b70055c3277edb4cddc4a86460c
doc/src/merlin-lib.ocaml_typing/typedecl_properties.ml.html
Source file typedecl_properties.ml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73
(**************************************************************************) (* *) (* OCaml *) (* *) (* Gabriel Scherer, projet Parsifal, INRIA Saclay *) (* Rodolphe Lepigre, projet Deducteam, INRIA Saclay *) (* *) (* Copyright 2018 Institut National de Recherche en Informatique et *) (* en Automatique. *) (* *) (* All rights reserved. This file is distributed under the terms of *) (* the GNU Lesser General Public License version 2.1, with the *) (* special exception on linking described in the file LICENSE. *) (* *) (**************************************************************************) type decl = Types.type_declaration type ('prop, 'req) property = { eq : 'prop -> 'prop -> bool; merge : prop:'prop -> new_prop:'prop -> 'prop; default : decl -> 'prop; compute : Env.t -> decl -> 'req -> 'prop; update_decl : decl -> 'prop -> decl; check : Env.t -> Ident.t -> decl -> 'req -> unit; } let add_type ~check id decl env = let open Types in Builtin_attributes.warning_scope ~ppwarning:false decl.type_attributes (fun () -> Env.add_type ~check id decl env) let add_types_to_env decls env = List.fold_right (fun (id, decl) env -> add_type ~check:true id decl env) decls env let compute_property : ('prop, 'req) property -> Env.t -> (Ident.t * decl) list -> 'req list -> (Ident.t * decl) list = fun property env decls required -> (* [decls] and [required] must be lists of the same size, with [required] containing the requirement for the corresponding declaration in [decls]. *) let props = List.map (fun (_id, decl) -> property.default decl) decls in let rec compute_fixpoint props = let new_decls = List.map2 (fun (id, decl) prop -> (id, property.update_decl decl prop)) decls props in let new_env = add_types_to_env new_decls env in let new_props = List.map2 (fun (_id, decl) (prop, req) -> let new_prop = property.compute new_env decl req in property.merge ~prop ~new_prop) new_decls (List.combine props required) in if not (List.for_all2 property.eq props new_props) then compute_fixpoint new_props else begin List.iter2 (fun (id, decl) req -> property.check new_env id decl req) new_decls required; new_decls end in compute_fixpoint props let compute_property_noreq property env decls = let req = List.map (fun _ -> ()) decls in compute_property property env decls req
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>