Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 59 lines (49 sloc) 2.177 kb
fccc685 Initial open-source release
MLstate authored
1 (*
2 Copyright © 2011 MLstate
3
4 This file is part of OPA.
5
6 OPA is free software: you can redistribute it and/or modify it under the
7 terms of the GNU Affero General Public License, version 3, as published by
8 the Free Software Foundation.
9
10 OPA is distributed in the hope that it will be useful, but WITHOUT ANY
11 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
13 more details.
14
15 You should have received a copy of the GNU Affero General Public License
16 along with OPA. If not, see <http://www.gnu.org/licenses/>.
17 *)
18
19 (* -- *)
20
21 let reorder_code ?(val_=OpaMapToIdent.val_noerr ~side:`server) roots roots_addon lcode =
22 QmlDependencies.reorder val_ roots roots_addon Reordering.create_group_list lcode
23
24 let reorder_in_new_qml ?val_ lcode =
25 reorder_code ?val_ [] IdentMap.empty lcode
26
27 (*FIXME : This reorder is hackie because put the init server at end of
28 code and hope that all initialisations values are before init
29 server. The really fix is to really create dependencies beetween
30 init server and some init values like css. *)
31 let perform ~client ~server =
32 let client =
33 reorder_in_new_qml
34 ~val_:(OpaMapToIdent.val_noerr ~side:`client)
35 client in
36 let start_server_at_end =
37 match OpaMapToIdent.val_start_server () with
38 | None -> server
39 | Some iserver ->
40 let rec aux = function
41 | ((QmlAst.NewVal (_, vlist)) as d)::tail
42 | ((QmlAst.NewValRec (_, vlist)) as d)::tail ->
43 if
44 List.exists
45 (fun (i, _) -> Ident.equal iserver i)
46 vlist
47 then tail@[d]
48 else d::(aux tail)
49
50 | h::t -> h::(aux t)
51 (* FIXME: use standard modules for reporting internal Error *)
52 | [] -> failwith "Unconsistent beetwen server code and OpaMapToIdent\n No start_server on server_code but val_start_server is setted to Some..."
53 in aux server
54 in let server =
55 reorder_in_new_qml
56 ~val_:(OpaMapToIdent.val_noerr ~side:`server)
57 start_server_at_end
58 in (client, server)
Something went wrong with that request. Please try again.