Skip to content
This repository
Newer
Older
100644 96 lines (77 sloc) 2.539 kb
fccc6851 » MLstate
2011-06-21 Initial open-source release
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 Various utilities that can be used from every module of the backend
20 *)
21
22
23 val pp_esc : Format.formatter -> string -> unit
24 val pp_path : Format.formatter -> string list -> unit
25 val pp_fieldset : Format.formatter -> StringSet.t -> unit
26
27 (**
d3757ec6 » Arthur Milchior
2011-07-11 [fix] typos: various corrections
28 Interface to the runtime lib
fccc6851 » MLstate
2011-06-21 Initial open-source release
29 *)
30 module ClientLib :
31 sig
32 val build_bool : bool -> JsAst.expr
33 val build_false : JsAst.expr
34 val build_true : JsAst.expr
35
36 val dot_bool : bool -> JsAst.expr
37 val dot_false : JsAst.expr
38 val dot_true : JsAst.expr
39
91768108 » OpaOnWindowsNow
2011-08-12 [feature] closure serialisation: adding the runtime to implement clos…
40 val env_apply_with_ty : JsAst.expr
41
fccc6851 » MLstate
2011-06-21 Initial open-source release
42 val error : JsAst.expr
43 val extend_record : JsAst.expr
44
45 val match_failure : FilePos.pos -> JsAst.expr
46
47 val size : JsAst.expr
48
49 val void : JsAst.expr
50
51 val type_string : JsAst.expr
52 val type_char : JsAst.expr
53 val type_int : JsAst.expr
54 val type_float : JsAst.expr
55 val type_fun : JsAst.expr
56 val type_fun_arity : JsAst.expr
57 val type_var : JsAst.expr
58 val type_option : JsAst.expr
59 val type_void : JsAst.expr
60 val type_native_option : JsAst.expr
61 val type_native_void : JsAst.expr
62 val type_bool : JsAst.expr
63 val type_extern : JsAst.expr
64 val type_opavalue : JsAst.expr
65 val assert_length : JsAst.expr
66 end
67
68 (**
69 General purpose analysis
70 *)
71
72 val does_side_effects : JsAst.expr -> bool
73
74 (**
75 [maybe_js_false ty] tell if an inhabitant of the opa type ty,
76 once represented in javascript could be evaluated to false in
77 a condition test.
78 This is used for optimizing condition mixed with affectation.
79 If not any value of the type [ty] could be evaluated to [false],
80 we can generate :
81 {[
82 if (x = a.some)
83 ]}
84 instead of
85 {[
86 if (x = a.some && x != undefined)
87 ]}
88
89 We should add a cache in named type in this function for performance.
90 *)
91 val maybe_js_false : QmlTypes.gamma -> QmlAst.ty -> bool
92
93 (**
94 Transform a QML constant into a Javascript constant.
95 *)
96 val const : QmlAst.const_expr -> JsAst.expr
Something went wrong with that request. Please try again.