Move typed_impl to Typedtree.t
parent
3be9e19c17
commit
ee2f3b428c
2
.depend
2
.depend
|
@ -1010,7 +1010,6 @@ typing/printtyp.cmi : \
|
||||||
parsing/asttypes.cmi
|
parsing/asttypes.cmi
|
||||||
typing/printtyped.cmo : \
|
typing/printtyped.cmo : \
|
||||||
typing/types.cmi \
|
typing/types.cmi \
|
||||||
typing/typemod.cmi \
|
|
||||||
typing/typedtree.cmi \
|
typing/typedtree.cmi \
|
||||||
parsing/printast.cmi \
|
parsing/printast.cmi \
|
||||||
typing/path.cmi \
|
typing/path.cmi \
|
||||||
|
@ -1023,7 +1022,6 @@ typing/printtyped.cmo : \
|
||||||
typing/printtyped.cmi
|
typing/printtyped.cmi
|
||||||
typing/printtyped.cmx : \
|
typing/printtyped.cmx : \
|
||||||
typing/types.cmx \
|
typing/types.cmx \
|
||||||
typing/typemod.cmx \
|
|
||||||
typing/typedtree.cmx \
|
typing/typedtree.cmx \
|
||||||
parsing/printast.cmx \
|
parsing/printast.cmx \
|
||||||
typing/path.cmx \
|
typing/path.cmx \
|
||||||
|
|
|
@ -27,7 +27,7 @@ let interface ~source_file ~output_prefix =
|
||||||
|
|
||||||
(** Bytecode compilation backend for .ml files. *)
|
(** Bytecode compilation backend for .ml files. *)
|
||||||
|
|
||||||
let to_bytecode i Typemod.{structure; coercion; _} =
|
let to_bytecode i Typedtree.{structure; coercion; _} =
|
||||||
(structure, coercion)
|
(structure, coercion)
|
||||||
|> Profile.(record transl)
|
|> Profile.(record transl)
|
||||||
(Translmod.transl_implementation i.module_name)
|
(Translmod.transl_implementation i.module_name)
|
||||||
|
|
|
@ -25,7 +25,7 @@ val implementation:
|
||||||
|
|
||||||
val to_bytecode :
|
val to_bytecode :
|
||||||
Compile_common.info ->
|
Compile_common.info ->
|
||||||
Typemod.typed_impl ->
|
Typedtree.t ->
|
||||||
Instruct.instruction list * Ident.Set.t
|
Instruct.instruction list * Ident.Set.t
|
||||||
(** [to_bytecode info typed] takes a typechecked implementation
|
(** [to_bytecode info typed] takes a typechecked implementation
|
||||||
and returns its bytecode.
|
and returns its bytecode.
|
||||||
|
|
|
@ -68,13 +68,13 @@ val interface : info -> unit
|
||||||
val parse_impl : info -> Parsetree.structure
|
val parse_impl : info -> Parsetree.structure
|
||||||
(** [parse_impl info] parses an implementation (usually an [.ml] file). *)
|
(** [parse_impl info] parses an implementation (usually an [.ml] file). *)
|
||||||
|
|
||||||
val typecheck_impl : info -> Parsetree.structure -> Typemod.typed_impl
|
val typecheck_impl : info -> Parsetree.structure -> Typedtree.t
|
||||||
(** [typecheck_impl info parsetree] typechecks an implementation and returns
|
(** [typecheck_impl info parsetree] typechecks an implementation and returns
|
||||||
the typedtree of the associated module, its public interface, and a
|
the typedtree of the associated module, its public interface, and a
|
||||||
coercion against that public interface.
|
coercion against that public interface.
|
||||||
*)
|
*)
|
||||||
|
|
||||||
val implementation : info -> backend:(info -> Typemod.typed_impl -> unit) -> unit
|
val implementation : info -> backend:(info -> Typedtree.t -> unit) -> unit
|
||||||
(** The complete compilation pipeline for implementations. *)
|
(** The complete compilation pipeline for implementations. *)
|
||||||
|
|
||||||
(** {2 Build artifacts} *)
|
(** {2 Build artifacts} *)
|
||||||
|
|
|
@ -31,7 +31,7 @@ let (|>>) (x, y) f = (x, f y)
|
||||||
|
|
||||||
(** Native compilation backend for .ml files. *)
|
(** Native compilation backend for .ml files. *)
|
||||||
|
|
||||||
let flambda i backend Typemod.{structure; coercion; _} =
|
let flambda i backend Typedtree.{structure; coercion; _} =
|
||||||
if !Clflags.classic_inlining then begin
|
if !Clflags.classic_inlining then begin
|
||||||
Clflags.default_simplify_rounds := 1;
|
Clflags.default_simplify_rounds := 1;
|
||||||
Clflags.use_inlining_arguments_set Clflags.classic_arguments;
|
Clflags.use_inlining_arguments_set Clflags.classic_arguments;
|
||||||
|
@ -66,7 +66,7 @@ let flambda i backend Typemod.{structure; coercion; _} =
|
||||||
program);
|
program);
|
||||||
Compilenv.save_unit_info (cmx i))
|
Compilenv.save_unit_info (cmx i))
|
||||||
|
|
||||||
let clambda i backend Typemod.{structure; coercion; _} =
|
let clambda i backend Typedtree.{structure; coercion; _} =
|
||||||
Clflags.use_inlining_arguments_set Clflags.classic_arguments;
|
Clflags.use_inlining_arguments_set Clflags.classic_arguments;
|
||||||
(structure, coercion)
|
(structure, coercion)
|
||||||
|> Profile.(record transl)
|
|> Profile.(record transl)
|
||||||
|
|
|
@ -25,13 +25,13 @@ val implementation:
|
||||||
(** {2 Internal functions} **)
|
(** {2 Internal functions} **)
|
||||||
|
|
||||||
val clambda :
|
val clambda :
|
||||||
Compile_common.info -> (module Backend_intf.S) -> Typemod.typed_impl-> unit
|
Compile_common.info -> (module Backend_intf.S) -> Typedtree.t-> unit
|
||||||
(** [clambda info typed] applies the regular compilation pipeline to the
|
(** [clambda info typed] applies the regular compilation pipeline to the
|
||||||
given typechecked implementation and outputs the resulting files.
|
given typechecked implementation and outputs the resulting files.
|
||||||
*)
|
*)
|
||||||
|
|
||||||
val flambda :
|
val flambda :
|
||||||
Compile_common.info -> (module Backend_intf.S) -> Typemod.typed_impl -> unit
|
Compile_common.info -> (module Backend_intf.S) -> Typedtree.t -> unit
|
||||||
(** [flambda info backend typed] applies the Flambda compilation pipeline to the
|
(** [flambda info backend typed] applies the Flambda compilation pipeline to the
|
||||||
given typechecked implementation and outputs the resulting files.
|
given typechecked implementation and outputs the resulting files.
|
||||||
*)
|
*)
|
||||||
|
|
|
@ -151,7 +151,7 @@ let process_file sourcefile =
|
||||||
match parsetree_typedtree_opt with
|
match parsetree_typedtree_opt with
|
||||||
None ->
|
None ->
|
||||||
None
|
None
|
||||||
| Some (parsetree, Typemod.{structure; coercion; _}) ->
|
| Some (parsetree, Typedtree.{structure; coercion; _}) ->
|
||||||
let typedtree = (structure, coercion) in
|
let typedtree = (structure, coercion) in
|
||||||
let file_module = Ast_analyser.analyse_typed_tree file
|
let file_module = Ast_analyser.analyse_typed_tree file
|
||||||
input_file parsetree typedtree
|
input_file parsetree typedtree
|
||||||
|
|
|
@ -942,4 +942,4 @@ let interface ppf x = list 0 signature_item ppf x.sig_items;;
|
||||||
|
|
||||||
let implementation ppf x = list 0 structure_item ppf x.str_items;;
|
let implementation ppf x = list 0 structure_item ppf x.str_items;;
|
||||||
|
|
||||||
let implementation_with_coercion ppf Typemod.{structure; _} = implementation ppf structure
|
let implementation_with_coercion ppf Typedtree.{structure; _} = implementation ppf structure
|
||||||
|
|
|
@ -19,4 +19,4 @@ open Format;;
|
||||||
val interface : formatter -> signature -> unit;;
|
val interface : formatter -> signature -> unit;;
|
||||||
val implementation : formatter -> structure -> unit;;
|
val implementation : formatter -> structure -> unit;;
|
||||||
|
|
||||||
val implementation_with_coercion : formatter -> Typemod.typed_impl -> unit;;
|
val implementation_with_coercion : formatter -> Typedtree.t -> unit;;
|
||||||
|
|
|
@ -613,6 +613,13 @@ and 'a class_infos =
|
||||||
ci_attributes: attribute list;
|
ci_attributes: attribute list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type t = {
|
||||||
|
structure: structure;
|
||||||
|
coercion: module_coercion;
|
||||||
|
signature: Types.signature
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
(* Auxiliary functions over the a.s.t. *)
|
(* Auxiliary functions over the a.s.t. *)
|
||||||
|
|
||||||
let as_computation_pattern (p : pattern) : computation general_pattern =
|
let as_computation_pattern (p : pattern) : computation general_pattern =
|
||||||
|
|
|
@ -752,6 +752,12 @@ and 'a class_infos =
|
||||||
ci_attributes: attributes;
|
ci_attributes: attributes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type t = {
|
||||||
|
structure: structure;
|
||||||
|
coercion: module_coercion;
|
||||||
|
signature: Types.signature
|
||||||
|
}
|
||||||
|
|
||||||
(* Auxiliary functions over the a.s.t. *)
|
(* Auxiliary functions over the a.s.t. *)
|
||||||
|
|
||||||
(** [as_computation_pattern p] is a computation pattern with description
|
(** [as_computation_pattern p] is a computation pattern with description
|
||||||
|
|
|
@ -106,12 +106,6 @@ type error =
|
||||||
exception Error of Location.t * Env.t * error
|
exception Error of Location.t * Env.t * error
|
||||||
exception Error_forward of Location.error
|
exception Error_forward of Location.error
|
||||||
|
|
||||||
type typed_impl = {
|
|
||||||
structure: Typedtree.structure;
|
|
||||||
coercion: Typedtree.module_coercion;
|
|
||||||
signature: Types.signature
|
|
||||||
}
|
|
||||||
|
|
||||||
open Typedtree
|
open Typedtree
|
||||||
|
|
||||||
let rec path_concat head p =
|
let rec path_concat head p =
|
||||||
|
|
|
@ -29,12 +29,6 @@ module Signature_names : sig
|
||||||
val simplify: Env.t -> t -> signature -> signature
|
val simplify: Env.t -> t -> signature -> signature
|
||||||
end
|
end
|
||||||
|
|
||||||
type typed_impl = {
|
|
||||||
structure: Typedtree.structure;
|
|
||||||
coercion: Typedtree.module_coercion;
|
|
||||||
signature: Types.signature
|
|
||||||
}
|
|
||||||
|
|
||||||
val type_module:
|
val type_module:
|
||||||
Env.t -> Parsetree.module_expr -> Typedtree.module_expr
|
Env.t -> Parsetree.module_expr -> Typedtree.module_expr
|
||||||
val type_structure:
|
val type_structure:
|
||||||
|
@ -44,7 +38,7 @@ val type_toplevel_phrase:
|
||||||
Env.t -> Parsetree.structure ->
|
Env.t -> Parsetree.structure ->
|
||||||
Typedtree.structure * Types.signature * Signature_names.t * Env.t
|
Typedtree.structure * Types.signature * Signature_names.t * Env.t
|
||||||
val type_implementation:
|
val type_implementation:
|
||||||
string -> string -> string -> Env.t -> Parsetree.structure -> typed_impl
|
string -> string -> string -> Env.t -> Parsetree.structure -> Typedtree.t
|
||||||
val type_interface:
|
val type_interface:
|
||||||
Env.t -> Parsetree.signature -> Typedtree.signature
|
Env.t -> Parsetree.signature -> Typedtree.signature
|
||||||
val transl_signature:
|
val transl_signature:
|
||||||
|
|
|
@ -605,7 +605,7 @@ let functor_parameter sub : functor_parameter -> Parsetree.functor_parameter =
|
||||||
| Unit -> Unit
|
| Unit -> Unit
|
||||||
| Named (_, name, mtype) -> Named (name, sub.module_type sub mtype)
|
| Named (_, name, mtype) -> Named (name, sub.module_type sub mtype)
|
||||||
|
|
||||||
let module_type sub mty =
|
let module_type (sub : mapper) mty =
|
||||||
let loc = sub.location sub mty.mty_loc in
|
let loc = sub.location sub mty.mty_loc in
|
||||||
let attrs = sub.attributes sub mty.mty_attributes in
|
let attrs = sub.attributes sub mty.mty_attributes in
|
||||||
let desc = match mty.mty_desc with
|
let desc = match mty.mty_desc with
|
||||||
|
@ -633,7 +633,7 @@ let with_constraint sub (_path, lid, cstr) =
|
||||||
| Twith_modsubst (_path, lid2) ->
|
| Twith_modsubst (_path, lid2) ->
|
||||||
Pwith_modsubst (map_loc sub lid, map_loc sub lid2)
|
Pwith_modsubst (map_loc sub lid, map_loc sub lid2)
|
||||||
|
|
||||||
let module_expr sub mexpr =
|
let module_expr (sub : mapper) mexpr =
|
||||||
let loc = sub.location sub mexpr.mod_loc in
|
let loc = sub.location sub mexpr.mod_loc in
|
||||||
let attrs = sub.attributes sub mexpr.mod_attributes in
|
let attrs = sub.attributes sub mexpr.mod_attributes in
|
||||||
match mexpr.mod_desc with
|
match mexpr.mod_desc with
|
||||||
|
@ -882,10 +882,10 @@ let default_mapper =
|
||||||
object_field = object_field ;
|
object_field = object_field ;
|
||||||
}
|
}
|
||||||
|
|
||||||
let untype_structure ?(mapper=default_mapper) structure =
|
let untype_structure ?(mapper : mapper = default_mapper) structure =
|
||||||
mapper.structure mapper structure
|
mapper.structure mapper structure
|
||||||
|
|
||||||
let untype_signature ?(mapper=default_mapper) signature =
|
let untype_signature ?(mapper : mapper = default_mapper) signature =
|
||||||
mapper.signature mapper signature
|
mapper.signature mapper signature
|
||||||
|
|
||||||
let untype_expression ?(mapper=default_mapper) expression =
|
let untype_expression ?(mapper=default_mapper) expression =
|
||||||
|
|
Loading…
Reference in New Issue