Skip to content

Commit

Permalink
Revert renaming
Browse files Browse the repository at this point in the history
  • Loading branch information
kLabz committed Apr 3, 2024
1 parent 908c894 commit a793bea
Show file tree
Hide file tree
Showing 10 changed files with 20 additions and 20 deletions.
2 changes: 1 addition & 1 deletion src/compiler/server.ml
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ let check_module sctx com m_path m_extra p =
check_module_shadowing (get_changed_directories sctx mcom) m_path m_extra
end
in
let has_policy policy = List.mem policy m_extra.m_fs_check_policy || match policy with
let has_policy policy = List.mem policy m_extra.m_check_policy || match policy with
| NoFileSystemCheck when !ServerConfig.do_not_check_modules && !Parser.display_mode <> DMNone -> true
| _ -> false
in
Expand Down
2 changes: 1 addition & 1 deletion src/context/typecore.ml
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ type typer_globals = {
mutable core_api : typer option;
mutable macros : ((unit -> unit) * typer) option;
mutable std_types : module_def;
mutable module_fs_check_policies : (string list * filesystem_check_policy list * bool) list;
mutable module_check_policies : (string list * module_check_policy list * bool) list;
mutable global_using : (tclass * pos) list;
(* Indicates that Typer.create() finished building this instance *)
mutable complete : bool;
Expand Down
2 changes: 1 addition & 1 deletion src/core/tFunctions.ml
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ let module_extra file sign time kind added policy =
m_kind = kind;
m_cache_bound_objects = DynArray.create ();
m_features = Hashtbl.create 0;
m_fs_check_policy = policy;
m_check_policy = policy;
}

let mk_class_field_ref (c : tclass) (cf : tclass_field) (kind : class_field_ref_kind) (is_macro : bool) = {
Expand Down
4 changes: 2 additions & 2 deletions src/core/tType.ml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ and method_kind =
| MethDynamic
| MethMacro

type filesystem_check_policy =
type module_check_policy =
| NoFileSystemCheck
| CheckFileModificationTime
| CheckFileContentModification
Expand Down Expand Up @@ -410,7 +410,7 @@ and module_def_extra = {
m_file : Path.UniqueKey.lazy_t;
m_sign : Digest.t;
m_display : module_def_display;
mutable m_fs_check_policy : filesystem_check_policy list;
mutable m_check_policy : module_check_policy list;
mutable m_time : float;
mutable m_cache_state : module_cache_state;
mutable m_added : int;
Expand Down
6 changes: 3 additions & 3 deletions src/macro/macroApi.ml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ type 'value compiler_api = {
add_global_metadata : string -> string -> (bool * bool * bool) -> pos -> unit;
register_define : string -> Define.user_define -> unit;
register_metadata : string -> Meta.user_meta -> unit;
add_module_fs_check_policy : string list -> int list -> bool -> unit;
add_module_check_policy : string list -> int list -> bool -> unit;
decode_expr : 'value -> Ast.expr;
encode_expr : Ast.expr -> 'value;
encode_ctype : Ast.type_hint -> 'value;
Expand Down Expand Up @@ -2292,10 +2292,10 @@ let macro_api ccom get_api =
vnull
);
(* Compilation server *)
"server_add_module_fs_check_policy", vfun3 (fun filter policy recursive ->
"server_add_module_check_policy", vfun3 (fun filter policy recursive ->
let filter = List.map decode_string (decode_array filter) in
let policy = List.map decode_int (decode_array policy) in
(get_api()).add_module_fs_check_policy filter policy (decode_bool recursive);
(get_api()).add_module_check_policy filter policy (decode_bool recursive);
vnull
);
"server_invalidate_files", vfun1 (fun a ->
Expand Down
4 changes: 2 additions & 2 deletions src/typing/generic.ml
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ let static_method_container gctx c cf p =
m_path = (pack,name);
m_types = [];
m_statics = None;
m_extra = module_extra (s_type_path (pack,name)) m.m_extra.m_sign 0. MFake gctx.ctx.com.compilation_step m.m_extra.m_fs_check_policy;
m_extra = module_extra (s_type_path (pack,name)) m.m_extra.m_sign 0. MFake gctx.ctx.com.compilation_step m.m_extra.m_check_policy;
} in
gctx.mg <- Some mg;
let cg = mk_class mg (pack,name) c.cl_pos c.cl_name_pos in
Expand Down Expand Up @@ -297,7 +297,7 @@ let build_generic_class ctx c p tl =
m_path = (pack,name);
m_types = [];
m_statics = None;
m_extra = module_extra (s_type_path (pack,name)) m.m_extra.m_sign 0. MFake gctx.ctx.com.compilation_step m.m_extra.m_fs_check_policy;
m_extra = module_extra (s_type_path (pack,name)) m.m_extra.m_sign 0. MFake gctx.ctx.com.compilation_step m.m_extra.m_check_policy;
} in
let ctx = TyperManager.clone_for_module ctx.g.root_typer (TypeloadModule.make_curmod ctx.com ctx.g mg) in
gctx.mg <- Some mg;
Expand Down
8 changes: 4 additions & 4 deletions src/typing/macroContext.ml
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ let make_macro_com_api com mcom p =
com.global_metadata <- (ExtString.String.nsplit s1 ".",m,config) :: com.global_metadata;
) meta;
);
add_module_fs_check_policy = (fun sl il b ->
add_module_check_policy = (fun sl il b ->
Interp.exc_string "unsupported"
);
register_define = (fun s data -> Define.register_user_define com.user_defines s data);
Expand Down Expand Up @@ -526,10 +526,10 @@ let make_macro_api ctx mctx p =
ctx.com.global_metadata <- (ExtString.String.nsplit s1 ".",m,config) :: ctx.com.global_metadata;
) meta;
);
MacroApi.add_module_fs_check_policy = (fun sl il b ->
MacroApi.add_module_check_policy = (fun sl il b ->
let add ctx =
ctx.g.module_fs_check_policies <- (List.fold_left (fun acc s -> (ExtString.String.nsplit s ".",List.map Obj.magic il,b) :: acc) ctx.g.module_fs_check_policies sl);
ctx.com.module_lut#iter (fun _ m -> m.m_extra.m_fs_check_policy <- TypeloadModule.get_policy ctx.g m.m_path);
ctx.g.module_check_policies <- (List.fold_left (fun acc s -> (ExtString.String.nsplit s ".",List.map Obj.magic il,b) :: acc) ctx.g.module_check_policies sl);
ctx.com.module_lut#iter (fun _ m -> m.m_extra.m_check_policy <- TypeloadModule.get_policy ctx.g m.m_path);
in
add ctx;
match ctx.g.macros with
Expand Down
2 changes: 1 addition & 1 deletion src/typing/typeloadModule.ml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ open Resolution

let get_policy g mpath =
let sl1 = full_dot_path2 mpath mpath in
List.fold_left (fun acc (sl2,policy,recursive) -> if match_path recursive sl1 sl2 then policy @ acc else acc) [] g.module_fs_check_policies
List.fold_left (fun acc (sl2,policy,recursive) -> if match_path recursive sl1 sl2 then policy @ acc else acc) [] g.module_check_policies

let field_of_static_definition d p =
{
Expand Down
2 changes: 1 addition & 1 deletion src/typing/typerEntry.ml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ let create com macros =
g = {
core_api = None;
macros = macros;
module_fs_check_policies = [];
module_check_policies = [];
delayed = Array.init all_typer_passes_length (fun _ -> { tasks = []});
delayed_min_index = 0;
debug_delayed = [];
Expand Down
8 changes: 4 additions & 4 deletions std/haxe/macro/CompilationServer.hx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ package haxe.macro;

import haxe.macro.Compiler;

enum abstract FileSystemCheckPolicy(Int) {
enum abstract ModuleCheckPolicy(Int) {
/**
Disables file modification checks, avoiding some filesystem operations.
**/
Expand All @@ -49,7 +49,7 @@ enum abstract FileSystemCheckPolicy(Int) {
class CompilationServer {
#if macro
/**
Sets the `FileSystemCheckPolicy` of all files whose dot-path matches an
Sets the `ModuleCheckPolicy` of all files whose dot-path matches an
element of `pathFilters`.
If `recursive` is true, a dot-path is considered matched if it starts
Expand All @@ -63,9 +63,9 @@ class CompilationServer {
If a call to this function is added to the compilation parameters, the
compilation server should be restarted to ensure it takes effect.
**/
static public function setModuleFileSystemCheckPolicy(pathFilters:Array<String>, policy:Array<FileSystemCheckPolicy>, ?recursive = true) {
static public function setModuleFileSystemCheckPolicy(pathFilters:Array<String>, policy:Array<ModuleCheckPolicy>, ?recursive = true) {
Context.onAfterInitMacros(() -> {
@:privateAccess Compiler.load("server_add_module_fs_check_policy", 4)(pathFilters, policy, recursive);
@:privateAccess Compiler.load("server_add_module_check_policy", 4)(pathFilters, policy, recursive);
});
}

Expand Down

0 comments on commit a793bea

Please sign in to comment.