diff --git a/src/compiler/server.ml b/src/compiler/server.ml index b2f6bc408b3..a1277d9cad6 100644 --- a/src/compiler/server.ml +++ b/src/compiler/server.ml @@ -410,7 +410,7 @@ let get_hxb_module com cc path = class hxb_reader_api_server (com : Common.context) (cc : context_cache) - (delay : Typecore.typer_pass -> (unit -> unit) -> unit) + (delay : TyperPass.typer_pass -> (unit -> unit) -> unit) = object(self) method make_module (path : path) (file : string) = diff --git a/src/context/display/syntaxExplorer.ml b/src/context/display/syntaxExplorer.ml index 2a7b2bd4978..98232cdfe06 100644 --- a/src/context/display/syntaxExplorer.ml +++ b/src/context/display/syntaxExplorer.ml @@ -177,7 +177,7 @@ let explore_uncached_modules tctx cs symbols = begin try let m = tctx.g.do_load_module tctx (cfile.c_package,module_name) null_pos in (* We have to flush immediately so we catch exceptions from weird modules *) - Typecore.flush_pass tctx.g Typecore.PFinal ("final",cfile.c_package @ [module_name]); + Typecore.flush_pass tctx.g PFinal ("final",cfile.c_package @ [module_name]); m :: acc with _ -> acc diff --git a/src/context/typecore.ml b/src/context/typecore.ml index c9fce0b9b7b..5052eb5e9d6 100644 --- a/src/context/typecore.ml +++ b/src/context/typecore.ml @@ -21,6 +21,7 @@ open Globals open Ast open Common open Type +open TyperPass open Error open Resolution open FieldCallCandidate @@ -50,21 +51,6 @@ type access_mode = | MSet of Ast.expr option (* rhs, if exists *) | MCall of Ast.expr list (* call arguments *) -type typer_pass = - | PBuildModule (* build the module structure and setup module type parameters *) - | PBuildClass (* build the class structure *) - | PConnectField (* handle associated fields, which may affect each other. E.g. a property and its getter *) - | PTypeField (* type the class field, allow access to types structures *) - | PCheckConstraint (* perform late constraint checks with inferred types *) - | PForce (* usually ensure that lazy have been evaluated *) - | PFinal (* not used, only mark for finalize *) - -let all_typer_passes = [ - PBuildModule;PBuildClass;PConnectField;PTypeField;PCheckConstraint;PForce;PFinal -] - -let all_typer_passes_length = List.length all_typer_passes - type typer_module = { curmod : module_def; import_resolution : resolution_list; @@ -478,7 +464,7 @@ let delay_if_mono g p t f = match follow t with | _ -> f() -let rec flush_pass g p where = +let rec flush_pass g (p : typer_pass) where = let rec loop i = if i > (Obj.magic p) then () diff --git a/src/context/typerPass.ml b/src/context/typerPass.ml new file mode 100644 index 00000000000..1936334244a --- /dev/null +++ b/src/context/typerPass.ml @@ -0,0 +1,14 @@ +type typer_pass = + | PBuildModule (* build the module structure and setup module type parameters *) + | PBuildClass (* build the class structure *) + | PConnectField (* handle associated fields, which may affect each other. E.g. a property and its getter *) + | PTypeField (* type the class field, allow access to types structures *) + | PCheckConstraint (* perform late constraint checks with inferred types *) + | PForce (* usually ensure that lazy have been evaluated *) + | PFinal (* not used, only mark for finalize *) + +let all_typer_passes = [ + PBuildModule;PBuildClass;PConnectField;PTypeField;PCheckConstraint;PForce;PFinal +] + +let all_typer_passes_length = List.length all_typer_passes diff --git a/src/typing/typeloadCacheHook.ml b/src/typing/typeloadCacheHook.ml index 2ad5b31fc91..aebf1b299e1 100644 --- a/src/typing/typeloadCacheHook.ml +++ b/src/typing/typeloadCacheHook.ml @@ -1,5 +1,6 @@ open Globals open TType +open TyperPass open Common open TFunctions @@ -9,7 +10,7 @@ type find_module_result = | BinaryModule of HxbData.module_cache | NoModule -let type_module_hook : (Common.context -> (Typecore.typer_pass -> (unit -> unit) -> unit) -> path -> pos -> find_module_result) ref = ref (fun _ _ _ _ -> NoModule) +let type_module_hook : (Common.context -> (typer_pass -> (unit -> unit) -> unit) -> path -> pos -> find_module_result) ref = ref (fun _ _ _ _ -> NoModule) let fake_modules = Hashtbl.create 0 diff --git a/src/typing/typerEntry.ml b/src/typing/typerEntry.ml index 6761c9cbcde..d5d632ec15e 100644 --- a/src/typing/typerEntry.ml +++ b/src/typing/typerEntry.ml @@ -14,7 +14,7 @@ let create com macros = core_api = None; macros = macros; module_check_policies = []; - delayed = Array.init all_typer_passes_length (fun _ -> { tasks = []}); + delayed = Array.init TyperPass.all_typer_passes_length (fun _ -> { tasks = []}); delayed_min_index = 0; debug_delayed = []; doinline = com.display.dms_inline && not (Common.defined com Define.NoInline);