-module(internal@checker). -compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch]). -export([not_used_functions/2, not_used_const/2, not_used_types/2]). -spec not_used_base( internal@fs:files_dir(), list({internal@fs:file_path(), JBQ, JBR}), fun((JBQ) -> list(JBW)), fun((JBR, JBW, internal@fs:module_full_name()) -> {ok, nil} | {error, nil}) ) -> list({JBW, internal@fs:file_path()}). not_used_base(Dir, Ast_info, Get_public_members, Is_pub_used) -> gleam@list:flat_map( Ast_info, fun(_use0) -> {File_path, File_ast, Another_files_ast} = _use0, Public_members = Get_public_members(File_ast), gleam@list:flat_map( Public_members, fun(Public_member) -> Is_public_used = Is_pub_used( Another_files_ast, Public_member, internal@fs:file_path_to_module_full_name( Dir, File_path ) ), case Is_public_used of {ok, nil} -> []; {error, nil} -> [{Public_member, File_path}] end end ) end ). -spec not_used_functions( internal@fs:files_dir(), list({internal@fs:file_path(), internal@ast:file_ast(), internal@ast:another_files_ast()}) ) -> list({internal@ast:public_member(), internal@fs:file_path()}). not_used_functions(Dir, Ast_info) -> not_used_base( Dir, Ast_info, fun internal@ast_fun:public_funs/1, fun internal@ast_fun:is_pub_fun_used/3 ). -spec not_used_const( internal@fs:files_dir(), list({internal@fs:file_path(), internal@ast:file_ast(), internal@ast:another_files_ast()}) ) -> list({internal@ast:public_member(), internal@fs:file_path()}). not_used_const(Dir, Ast_info) -> not_used_base( Dir, Ast_info, fun internal@ast_const:public_const/1, fun internal@ast_const:is_pub_const_used/3 ). -spec not_used_types( internal@fs:files_dir(), list({internal@fs:file_path(), internal@ast:file_ast(), internal@ast:another_files_ast()}) ) -> list({internal@ast:public_member(), internal@fs:file_path()}). not_used_types(Dir, Ast_info) -> not_used_base( Dir, Ast_info, fun internal@ast_type:public_type/1, fun internal@ast_type:is_pub_type_used/3 ).