Skip to content

Commit

Permalink
Delete Implementation of AutoloadMap and ArcFacts
Browse files Browse the repository at this point in the history
Differential Revision: D5135137

fbshipit-source-id: 0f30512164709ca5a45194b7d9508832661cf051
  • Loading branch information
dlreeves authored and hhvm-bot committed May 27, 2017
1 parent 493bdc2 commit 1ac87a4
Show file tree
Hide file tree
Showing 10 changed files with 11 additions and 28 deletions.
15 changes: 4 additions & 11 deletions hphp/hack/src/deps/fileInfo.ml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ type t = {
typedefs : id list;
consts : id list;
comments : (Pos.t * string) list option; (* None if loaded from saved state *)
consider_names_just_for_autoload: bool;
}

let empty_t = {
Expand All @@ -66,7 +65,6 @@ let empty_t = {
typedefs = [];
consts = [];
comments = Some [];
consider_names_just_for_autoload = false;
}

let pos_full (p, name) =
Expand All @@ -91,7 +89,6 @@ type names = {
type saved = {
s_names : names;
s_mode: mode option;
s_autoload: bool;
}


Expand Down Expand Up @@ -120,15 +117,13 @@ let saved_to_fast fast =

(* Filter out all PHP files from saved fileInfo object. *)
let saved_to_hack_files fast =
let fast = Relative_path.Map.filter fast
(fun _ {s_autoload; _} -> not s_autoload) in
saved_to_fast fast


let saved_to_info fast =
Relative_path.Map.fold fast ~init:Relative_path.Map.empty
~f:(fun fn saved acc ->
let {s_names; s_mode; s_autoload} = saved in
let {s_names; s_mode} = saved in
let {n_funs; n_classes; n_types; n_consts;} = s_names in
let funs = List.map (SSet.elements n_funs)
(fun x -> File (Fun, fn), x) in
Expand All @@ -145,26 +140,24 @@ let saved_to_info fast =
typedefs;
consts;
comments = None;
consider_names_just_for_autoload = s_autoload;
} in
Relative_path.Map.add acc fn fileinfo
)

let info_to_saved fileinfo =
Relative_path.Map.map fileinfo
(fun info ->
let {funs; classes; typedefs; consts; file_mode= s_mode; comments = _;
consider_names_just_for_autoload = s_autoload } = info in
let {funs; classes; typedefs; consts; file_mode= s_mode; comments = _; } = info in
let n_funs = name_set_of_idl funs in
let n_classes = name_set_of_idl classes in
let n_types = name_set_of_idl typedefs in
let n_consts = name_set_of_idl consts in
let s_names = { n_funs; n_classes; n_types; n_consts; } in
{ s_names; s_mode; s_autoload })
{ s_names; s_mode })

let simplify info =
let {funs; classes; typedefs; consts; file_mode = _; comments = _;
consider_names_just_for_autoload = _ } = info in
} = info in
let n_funs = name_set_of_idl funs in
let n_classes = name_set_of_idl classes in
let n_types = name_set_of_idl typedefs in
Expand Down
1 change: 0 additions & 1 deletion hphp/hack/src/deps/fileInfo.mli
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ type t = {
typedefs : id list;
consts : id list;
comments : (Pos.t * string) list option;
consider_names_just_for_autoload: bool;
}

val empty_t: t
Expand Down
1 change: 0 additions & 1 deletion hphp/hack/src/deps/typing_deps.ml
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,6 @@ let update_files fileInfo =
consts = _ (* TODO probably a bug #3844332 *);
comments = _;
file_mode = _;
consider_names_just_for_autoload = _;
} = info in
let funs = List.fold_left funs ~f:begin fun acc (_, fun_id) ->
DepSet.add acc (Dep.make (Dep.Fun fun_id))
Expand Down
3 changes: 1 addition & 2 deletions hphp/hack/src/hh_file_parse.ml
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ let parse_with_regular file content =
Ast_utils.get_defs parser_ret.Parser_hack.ast in
let defs =
{FileInfo.funs; classes; typedefs; consts;
comments = Some []; file_mode = None;
consider_names_just_for_autoload = false}
comments = Some []; file_mode = None}
in
Printf.printf "FileInfo with regular parser:\n";
if not (Errors.is_empty errorl) then
Expand Down
2 changes: 1 addition & 1 deletion hphp/hack/src/hh_single_compile.ml
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ let parse_name compiler_options popt files_contents =
let funs, classes, typedefs, consts = Ast_utils.get_defs ast in
{ FileInfo.
file_mode; funs; classes; typedefs; consts; comments = Some comments;
consider_names_just_for_autoload = false }, ast
}, ast
end parsed_files in

files_info
Expand Down
2 changes: 1 addition & 1 deletion hphp/hack/src/hh_single_type_check.ml
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,7 @@ let parse_name_and_decl popt files_contents tcopt =
let funs, classes, typedefs, consts = Ast_utils.get_defs ast in
{ FileInfo.
file_mode; funs; classes; typedefs; consts; comments = Some comments;
consider_names_just_for_autoload = false }
}
end parsed_files in

Relative_path.Map.iter files_info begin fun fn fileinfo ->
Expand Down
5 changes: 2 additions & 3 deletions hphp/hack/src/naming/namingGlobal.ml
Original file line number Diff line number Diff line change
Expand Up @@ -288,11 +288,10 @@ let ndecl_file_fast fn ~funs ~classes ~typedefs ~consts =

let ndecl_file popt fn
{ FileInfo.file_mode = _; funs; classes; typedefs; consts;
consider_names_just_for_autoload; comments = _} =
comments = _} =
let errors, _, _ = Errors.do_ begin fun () ->
dn ("Naming decl: "^Relative_path.to_absolute fn);
if not consider_names_just_for_autoload then
make_env popt ~funs ~classes ~typedefs ~consts
make_env popt ~funs ~classes ~typedefs ~consts
end in
if Errors.is_empty errors
then errors, Relative_path.Set.empty
Expand Down
4 changes: 1 addition & 3 deletions hphp/hack/src/parser/parsing_service.ml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ let empty_file_info : FileInfo.t = {
typedefs = [];
consts = [];
comments = Some [];
consider_names_just_for_autoload = false;
}

let legacy_php_file_info = ref (fun fn ->
Expand All @@ -53,8 +52,7 @@ let process_parse_result
Parser_heap.ParserHeap.write_through fn (ast, mode);
let comments = Some comments in
let defs =
{FileInfo.funs; classes; typedefs; consts; comments; file_mode;
consider_names_just_for_autoload = false}
{FileInfo.funs; classes; typedefs; consts; comments; file_mode}
in
let acc = Relative_path.Map.add acc ~key:fn ~data:defs in
let errorl = Errors.merge errorl' errorl in
Expand Down
1 change: 0 additions & 1 deletion hphp/hack/src/server/serverCheckUtils.ml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ let extend_fast fast files_info additional_files =
| None ->
(try
let info = Relative_path.Map.find_unsafe files_info x in
if info.FileInfo.consider_names_just_for_autoload then acc else
let info_names = FileInfo.simplify info in
Relative_path.Map.add acc ~key:x ~data:info_names
with Not_found ->
Expand Down
5 changes: 1 addition & 4 deletions hphp/hack/src/server/serverTypeCheck.ml
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,6 @@ let set_of_idl l =
let add_old_decls old_files_info fast =
Relative_path.Map.fold fast ~f:begin fun filename info_names acc ->
match Relative_path.Map.get old_files_info filename with
| Some {FileInfo.consider_names_just_for_autoload = true; _}
| None -> acc
| Some old_info ->
let old_info_names = FileInfo.simplify old_info in
Expand All @@ -151,7 +150,6 @@ let reparse_infos files_info fast =
Relative_path.Map.fold fast ~f:begin fun x _y acc ->
try
let info = Relative_path.Map.find_unsafe files_info x in
if info.FileInfo.consider_names_just_for_autoload then acc else
Relative_path.Map.add acc ~key:x ~data:info
with Not_found -> acc
end ~init:Relative_path.Map.empty
Expand All @@ -163,7 +161,6 @@ let reparse_infos files_info fast =
let remove_decls env fast_parsed =
Relative_path.Map.iter fast_parsed begin fun fn _ ->
match Relative_path.Map.get env.files_info fn with
| Some {FileInfo.consider_names_just_for_autoload = true; _}
| None -> ()
| Some {FileInfo.
funs = funl;
Expand All @@ -172,7 +169,7 @@ let remove_decls env fast_parsed =
consts = constl;
file_mode = _;
comments = _;
consider_names_just_for_autoload = _} ->
} ->
let funs = set_of_idl funl in
let classes = set_of_idl classel in
let typedefs = set_of_idl typel in
Expand Down

0 comments on commit 1ac87a4

Please sign in to comment.