Skip to content

Commit

Permalink
purge unnecessary dune libs and unnecessary warning corrections
Browse files Browse the repository at this point in the history
  • Loading branch information
John Christopher McAlpine committed Apr 16, 2019
1 parent 4376b77 commit 2601a53
Show file tree
Hide file tree
Showing 51 changed files with 363 additions and 394 deletions.
2 changes: 0 additions & 2 deletions src/lib/client/common/dune
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@
(public_name eliom.client.common)
(libraries
eliom.common
js_of_ocaml
js_of_ocaml.tyxml
js_of_ocaml-lwt.logger
ocsigenserver
react
reactiveData)
(preprocess
Expand Down
2 changes: 1 addition & 1 deletion src/lib/client/common/eliom_content_core.ml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ module Xml = struct
Lazy.force elt.elt
in
{ node_id = id; elt = Lazy.from_fun f }
let force_lazy { elt; _ } = ignore (Lazy.force elt)
let force_lazy { elt } = ignore (Lazy.force elt)

let make_react ?(id = NoId) signal =
{elt = Lazy.from_val (ReactNode signal); node_id = id; }
Expand Down
12 changes: 6 additions & 6 deletions src/lib/client/common/eliom_lib.ml
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@ module Url = struct
String.concat "/" l

let path_of_url = function
| Url.Http {Url.hu_path = path; _}
| Url.Https {Url.hu_path = path; _}
| Url.File {Url.fu_path = path; _} ->
| Url.Http {Url.hu_path = path}
| Url.Https {Url.hu_path = path}
| Url.File {Url.fu_path = path} ->
path

let path_of_url_string s =
Expand Down Expand Up @@ -148,8 +148,8 @@ end
(* We do not use the deriving (un)marshaling even if typ is available
because direct jsn (un)marshaling is very fast client side
*)
let to_json ?typ:_ s = Js.to_string (Json.output s)
let of_json ?typ:_ v = Json.unsafe_input (Js.string v)
let to_json ?typ s = Js.to_string (Json.output s)
let of_json ?typ v = Json.unsafe_input (Js.string v)

(* to marshal data and put it in a form *)
let encode_form_value x = to_json x
Expand All @@ -166,5 +166,5 @@ let unmarshal_js var =

type file_info = File.file Js.t

let make_cryptographic_safe_string ?len:_ () =
let make_cryptographic_safe_string ?len () =
failwith "make_cryptographic_safe_string not implemented client-side"
2 changes: 1 addition & 1 deletion src/lib/client/common/eliom_unwrap.ml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ let map : (Obj.t,Obj.t) weakMap Js.t = jsnew weakMap ()
open Js_of_ocaml
open Eliom_lib

let _section = Lwt_log.Section.make "eliom:unwrap"
let section = Lwt_log.Section.make "eliom:unwrap"

module Mark : sig
type t
Expand Down
15 changes: 1 addition & 14 deletions src/lib/client/dune
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,9 @@
(libraries
eliom.common
eliom.client.common
ipaddr
lwt
js_of_ocaml
js_of_ocaml-lwt
js_of_ocaml-lwt.logger
js_of_ocaml.tyxml
lwt_log
lwt_log.core
lwt_react
netstring-pcre
ocsigenserver
ocsigenserver.cookies
ocsigenserver.ext
react
reactiveData
tyxml)
lwt_react)
(preprocess
(pps
js_of_ocaml-ppx
Expand Down
10 changes: 4 additions & 6 deletions src/lib/client/eliom_bus.ml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ let consume (t,u) s =
| Lwt.Sleep -> Lwt.wakeup_exn u e;
| _ -> ());
[%lwt raise ( e)]
[@ocaml.warning "-22"]
in
Lwt.choose [Lwt.bind t (fun _ -> Lwt.return_unit);t']

Expand All @@ -58,8 +57,7 @@ let clone_exn (t,u) s =
(match Lwt.state t with
| Lwt.Sleep -> Lwt.wakeup_exn u e;
| _ -> ());
[%lwt raise ( e)]
[@ocaml.warning "-22"])
[%lwt raise ( e)])

type ('a, 'att, 'co, 'ext, 'reg) callable_bus_service =
(unit, 'a list, Eliom_service.post,
Expand All @@ -80,7 +78,7 @@ let create service channel waiter =
in
let error_h =
let t,u = Lwt.wait () in
(try%lwt let%lwt _ = t in assert false with e -> [%lwt raise ( e)][@ocaml.warning "-22"]), u in
(try%lwt let%lwt _ = t in assert false with e -> [%lwt raise ( e)]), u in
let stream =
lazy (
let stream = Eliom_comet.register channel in
Expand Down Expand Up @@ -110,7 +108,7 @@ let create service channel waiter =
in
t

let internal_unwrap ((wrapped_bus:('a, 'b) Ecb.wrapped_bus),_unwrapper) =
let internal_unwrap ((wrapped_bus:('a, 'b) Ecb.wrapped_bus),unwrapper) =
let waiter () = Lwt_js.sleep 0.05 in
let channel, Eliom_comet_base.Bus_send_service service = wrapped_bus in
create service channel waiter
Expand Down Expand Up @@ -143,7 +141,7 @@ let write t v =
Queue.add v t.queue;
try_flush t

let close {channel; _} = Eliom_comet.close channel
let close {channel} = Eliom_comet.close channel

let set_queue_size b s =
b.max_size <- s
Expand Down
23 changes: 10 additions & 13 deletions src/lib/client/eliom_client.ml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ let get_global_data () =
match
Eliom_unwrap.unwrap (Url.decode (Js.to_string v)) 0
with
| {Eliom_runtime.ecs_data = `Success v; _} ->
| {Eliom_runtime.ecs_data = `Success v} ->
Lwt_log.ign_debug_f "Unwrap __global_data success";
Some v
| _ ->
Expand Down Expand Up @@ -153,12 +153,12 @@ let init () =
match
Url.url_of_string (Js.to_string (Js.Unsafe.global##.___eliom_server_))
with
| Some (Http { hu_host; hu_port; hu_path = _; _ }) ->
| Some (Http { hu_host; hu_port; hu_path; _ }) ->
init_client_app
~app_name
~ssl:false ~hostname:hu_host ~port:hu_port ~site_dir
()
| Some (Https { hu_host; hu_port; hu_path = _; _ }) ->
| Some (Https { hu_host; hu_port; hu_path; _ }) ->
init_client_app
~app_name
~ssl:true ~hostname:hu_host ~port:hu_port ~site_dir ()
Expand Down Expand Up @@ -196,7 +196,7 @@ let init () =

let onload_handler = ref None in

let onload _ev =
let onload ev =
let js_data = Lazy.force js_data in
Lwt_log.ign_debug ~section "onload (client main)";
begin match !onload_handler with
Expand Down Expand Up @@ -361,7 +361,7 @@ let raw_call_service
?progress ?upload_progress ?override_mime_type
uri post_params Eliom_request.string_result in
match content with
| None -> [%lwt raise ( (Eliom_request.Failed_request 204))][@ocaml.warning "-22"]
| None -> [%lwt raise ( (Eliom_request.Failed_request 204))]
| Some content -> Lwt.return (uri, content)

let call_service
Expand Down Expand Up @@ -507,13 +507,11 @@ let garbage_collect_cached_doms () =
in
let rec accum_past = function
| Some idx when !size < n ->
begin
try
let dom = HistCache.find idx !history_doms in
add idx dom;
accum_past dom.page.previous_page
with Not_found -> ()
end
| _ -> ()
in
let _, _, future = HistCache.split cur_index !history_doms in
Expand Down Expand Up @@ -699,7 +697,8 @@ let set_template_content ~replace ~uri ?fragment =
(match fragment with
| None -> change_url_string ~replace uri
| Some fragment ->
change_url_string ~replace (uri ^ "#" ^ fragment));
change_url_string ~replace (uri ^ "#" ^ fragment)
| _ -> ());
let%lwt () = Lwt_mutex.lock load_mutex in
let%lwt (), request_data = unwrap_caml_content content in
do_request_data request_data;
Expand Down Expand Up @@ -783,7 +782,6 @@ let set_content_local ?offset ?fragment new_page =
recover ();
Lwt_log.ign_debug ~section ~exn "set_content_local";
[%lwt raise ( exn)]
[@@ocaml.warning "-22"]

(* Function to be called for server side services: *)
let set_content ~replace ~uri ?offset ?fragment content =
Expand Down Expand Up @@ -887,7 +885,6 @@ let set_content ~replace ~uri ?offset ?fragment content =
recover ();
Lwt_log.ign_debug ~section ~exn "set_content";
[%lwt raise ( exn)]
[@@ocaml.warning "-22"]

let ocamlify_params =
List.map
Expand Down Expand Up @@ -942,7 +939,7 @@ let make_uri subpath params =
Eliom_uri.make_string_uri_from_components (base, params, None)

let route ~replace ?(keep_url = false)
({ Eliom_route.i_subpath ; i_get_params ; i_post_params; _ } as info) =
({ Eliom_route.i_subpath ; i_get_params ; i_post_params } as info) =
Lwt_log.ign_debug ~section:section_page "Route";
let r = !Eliom_request_info.get_sess_info
and info, i_subpath =
Expand All @@ -969,7 +966,7 @@ let perform_reload () =
Lwt_log.ign_debug ~section:section_page "Perform reload";
let uri = !current_uri in
let
({ Eliom_common.si_all_get_params ; si_all_post_params = _; _ }
({ Eliom_common.si_all_get_params ; si_all_post_params }
as i_sess_info) =
!Eliom_request_info.get_sess_info ()
and i_subpath = Url.path_of_url_string uri in
Expand Down Expand Up @@ -1114,7 +1111,7 @@ type _ redirection =
'a redirection

let change_page_unknown
?meth ?hostname:_ ?(replace = false) i_subpath i_get_params i_post_params =
?meth ?hostname ?(replace = false) i_subpath i_get_params i_post_params =
Lwt_log.ign_debug ~section:section_page "Change page unknown";
let i_sess_info = !Eliom_request_info.get_sess_info ()
and i_meth =
Expand Down
16 changes: 8 additions & 8 deletions src/lib/client/eliom_client_core.ml
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ end = struct
Lwt_log.raise_error_f "Did not find injection %s" name))

let initialize ~compilation_unit_id
{ Eliom_runtime.injection_id; injection_value; _ } =
{ Eliom_runtime.injection_id; injection_value } =
Lwt_log.ign_debug_f ~section "Initialize injection %d" injection_id;
(* BBB One should assert that injection_value doesn't contain any
value marked for late unwrapping. How to do this efficiently? *)
Expand Down Expand Up @@ -269,7 +269,7 @@ let check_global_data global_data =
"Code generating the following client values is not linked on the client:\n%s"
(String.concat "\n"
(List.rev_map
(fun {Eliom_runtime.closure_id; value; _} ->
(fun {Eliom_runtime.closure_id; value} ->
let instance_id =
Eliom_runtime.Client_value_server_repr.instance_id value
in
Expand Down Expand Up @@ -404,14 +404,14 @@ let in_onload, broadcast_load_end, wait_load_end, set_loading_phase =
(* forward declaration... *)
let change_page_uri_
: (?cookies_info:bool * string list -> ?tmpl:string -> string -> unit) ref
= ref (fun ?cookies_info:_ ?tmpl:_ _href -> assert false)
= ref (fun ?cookies_info ?tmpl href -> assert false)
let change_page_get_form_
: (?cookies_info:bool * string list ->
?tmpl:string -> Dom_html.formElement Js.t -> string -> unit)
ref
= ref (fun ?cookies_info:_ ?tmpl:_ _form _href -> assert false)
= ref (fun ?cookies_info ?tmpl form href -> assert false)
let change_page_post_form_ =
ref (fun ?cookies_info:_ ?tmpl:_ _form _href -> assert false)
ref (fun ?cookies_info ?tmpl form href -> assert false)

type client_form_handler = Dom_html.event Js.t -> bool Lwt.t

Expand Down Expand Up @@ -540,7 +540,7 @@ let rebuild_attrib_val = function
let class_list_of_racontent = function
| Xml.AStr s ->
[s]
| Xml.AStrL (_space, l) ->
| Xml.AStrL (space, l) ->
l
| _ ->
failwith "attribute class is not a string"
Expand Down Expand Up @@ -861,7 +861,7 @@ let form_handler
(fun () -> Lwt_log.raise_error_f ~section "not a form element")
in
let kind =
if String.lowercase_ascii(Js.to_string form##._method) = "get"
if String.lowercase(Js.to_string form##._method) = "get"
then `Form_get
else `Form_post
and f _ = Lwt.return_false in
Expand Down Expand Up @@ -1008,7 +1008,7 @@ let is_attrib_attrib,get_attrib_id =
attr##.name##(substring (0) n_len) = n_prefix_js),
(fun attr -> attr##.value##(substring_toEnd v_len))

let relink_attrib _root table (node:Dom_html.element Js.t) =
let relink_attrib root table (node:Dom_html.element Js.t) =
Lwt_log.ign_debug ~section "Relink attribute";
let aux attr =
if is_attrib_attrib attr
Expand Down
26 changes: 13 additions & 13 deletions src/lib/client/eliom_comet.ml
Original file line number Diff line number Diff line change
Expand Up @@ -393,14 +393,14 @@ struct

let call_service_after_load_end service p1 p2 =
let%lwt () = Eliom_client.wait_load_end () in
Eliom_client.call_service ~service p1 p2
Eliom_client.call_service service p1 p2

let make_request hd =
match hd.hd_state with
| Stateful_state count -> (Ecb.Stateful (Ecb.Request_data !count))
| Stateless_state map ->
let l = Eliom_lib.String.Table.fold
(fun channel { position; _ } l -> (channel,position)::l) !map []
(fun channel { position } l -> (channel,position)::l) !map []
in
Ecb.Stateless (Array.of_list l)

Expand All @@ -414,8 +414,8 @@ struct
| Stateful_state r ->
incr r;
List.iter (function
| ( _chan_id, Ecb.Data _ ) -> ()
| ( _chan_id, Ecb.Closed ) ->
| ( chan_id, Ecb.Data _ ) -> ()
| ( chan_id, Ecb.Closed ) ->
Eliom_lib.Lwt_log.ign_warning ~section
"update_stateful_state: received Closed: should not happen, this is an eliom bug, please report it"
| ( chan_id, Ecb.Full ) ->
Expand Down Expand Up @@ -468,7 +468,7 @@ struct
raise (Comet_error ("update_stateless_state on stateful one"))

let call_service
({ hd_activity; hd_service = Ecb.Comet_service srv; _ } as hd) =
({ hd_activity; hd_service = Ecb.Comet_service srv } as hd) =
let%lwt () =
Configuration.sleep_before_next_request
(fun () -> hd_activity.focused)
Expand Down Expand Up @@ -554,7 +554,7 @@ struct
update_activity hd;
aux 0

let call_commands {hd_service = Ecb.Comet_service srv; _} command =
let call_commands {hd_service = Ecb.Comet_service srv} command =
ignore
(try%lwt
call_service_after_load_end srv ()
Expand Down Expand Up @@ -684,22 +684,22 @@ let get_stateless_hd (service:Ecb.comet_service) : Service_handler.stateless han
| Not_found -> init service Service_handler.stateless stateless_handler_table

let activate () =
let f _ { hd_service_handler; _ } =
let f _ { hd_service_handler } =
Service_handler.activate hd_service_handler in
Hashtbl.iter f stateless_handler_table;
Hashtbl.iter f stateful_handler_table

let restart () =
let f _ { hd_service_handler; _ } = Service_handler.restart hd_service_handler in
let f _ { hd_service_handler } = Service_handler.restart hd_service_handler in
Hashtbl.iter f stateless_handler_table;
Hashtbl.iter f stateful_handler_table

let close = function
| Ecb.Stateful_channel (chan_service,chan_id) ->
let { hd_service_handler; _ } = get_stateful_hd chan_service in
let { hd_service_handler } = get_stateful_hd chan_service in
Service_handler.close hd_service_handler (Ecb.string_of_chan_id chan_id)
| Ecb.Stateless_channel (chan_service,chan_id,_kind) ->
let { hd_service_handler; _ } = get_stateless_hd chan_service in
| Ecb.Stateless_channel (chan_service,chan_id,kind) ->
let { hd_service_handler } = get_stateless_hd chan_service in
Service_handler.close hd_service_handler (Ecb.string_of_chan_id chan_id)

let unmarshal s : 'a = Eliom_unwrap.unwrap (Eliom_lib.Url.decode s) 0
Expand Down Expand Up @@ -738,7 +738,7 @@ let check_and_update_position position msg_pos data =
(* stateless channels are registered with a position: when a channel
is registered more than one time, it is possible to receive old
messages: the position is used to filter them out. *)
let register' hd position (_chan_service:Ecb.comet_service) (chan_id:'a Ecb.chan_id) =
let register' hd position (chan_service:Ecb.comet_service) (chan_id:'a Ecb.chan_id) =
let chan_id = Ecb.string_of_chan_id chan_id in
let stream = Lwt_stream.filter_map_s
(function
Expand Down Expand Up @@ -786,7 +786,7 @@ let register ?(wake=true) (wrapped_chan:'a Ecb.wrapped_channel) =
| Ecb.Stateless_channel (s,c,kind) ->
register_stateless ~wake s c kind

let internal_unwrap ( wrapped_chan, _unwrapper ) = register wrapped_chan
let internal_unwrap ( wrapped_chan, unwrapper ) = register wrapped_chan

let () = Eliom_unwrap.register_unwrapper Eliom_common.comet_channel_unwrap_id internal_unwrap

Expand Down
Loading

0 comments on commit 2601a53

Please sign in to comment.