Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 166 lines (135 sloc) 6.758 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 Javascript Constructor Helpers
20 @author Mathieu Barbin
21 *)
22
23 module Expr :
24 sig
25 val array : ?label:Annot.label -> JsAst.expr list -> JsAst.expr
26
27 val assign : ?label:Annot.label -> JsAst.expr -> JsAst.expr -> JsAst.expr
28 val assign_ident : ?label:Annot.label -> JsAst.ident -> JsAst.expr -> JsAst.expr
29 val binop : ?label:Annot.label -> JsAst.binop -> JsAst.expr -> JsAst.expr -> JsAst.expr
30
31 val true_ : ?label:Annot.label -> unit -> JsAst.expr
32 val false_ : ?label:Annot.label -> unit -> JsAst.expr
33
34 val bool : ?label:Annot.label -> bool -> JsAst.expr
35 val call : ?label:Annot.label -> pure:bool -> JsAst.expr -> JsAst.expr list -> JsAst.expr
36 val cond : ?label:Annot.label -> JsAst.expr -> JsAst.expr -> JsAst.expr -> JsAst.expr
37
38 (**
39 Do not build a comma when the prefix list is empty,
40 simply returns the expr.
41 *)
42 val comma : ?label:Annot.label -> JsAst.expr list -> JsAst.expr -> JsAst.expr
43 val dot : ?label:Annot.label -> JsAst.expr -> string -> JsAst.expr
44 val equality : ?label:Annot.label -> JsAst.expr -> JsAst.expr -> JsAst.expr
45 val exprident : ?label:Annot.label -> Ident.t -> JsAst.expr
46
47 (**
48 Build a local native ident.
49 Global native ident should rather not be created directly, but produced with an analysis, except for identifer known statically to be global.
50 *)
51 val native : ?label:Annot.label -> string -> JsAst.expr
52 val native_global : ?label:Annot.label -> string -> JsAst.expr
53
54
55
56 (**
57 @deprecated use [dot] instead
58 *)
59 val field : ?label:Annot.label -> JsAst.expr -> string -> JsAst.expr
60 val float : ?label:Annot.label -> float -> JsAst.expr
61 val function_: ?label:Annot.label -> JsAst.ident option -> JsAst.ident list -> JsAst.statement list -> JsAst.expr
62 val greater : ?label:Annot.label -> JsAst.expr -> JsAst.expr -> JsAst.expr
63 val hashref : ?label:Annot.label -> JsAst.expr -> JsAst.expr -> JsAst.expr
64 val hole : ?label:Annot.label -> QmlAst.expr -> JsAst.expr
65 val ident : ?label:Annot.label -> JsAst.ident -> JsAst.expr
66 val in_ : ?label:Annot.label -> JsAst.expr -> JsAst.expr -> JsAst.expr
67 val int : ?label:Annot.label -> int -> JsAst.expr
68 val int_as_string : ?label:Annot.label -> string -> JsAst.expr
69 val land_ : ?label:Annot.label -> JsAst.expr -> JsAst.expr -> JsAst.expr
70 val list : ?label:Annot.label -> JsAst.expr list -> JsAst.expr
71 val lor_ : ?label:Annot.label -> JsAst.expr -> JsAst.expr -> JsAst.expr
72 val neq : ?label:Annot.label -> JsAst.expr -> JsAst.expr -> JsAst.expr
73 val not_ : ?label:Annot.label -> JsAst.expr -> JsAst.expr
74 val null : ?label:Annot.label -> unit -> JsAst.expr
75 val obj : ?label:Annot.label -> (string * JsAst.expr) list -> JsAst.expr
76 val runtime : ?label:Annot.label -> JsAstRuntime.expr -> JsAst.expr
77 val strict_equality : ?label:Annot.label -> JsAst.expr -> JsAst.expr -> JsAst.expr
78 val strict_neq : ?label:Annot.label -> JsAst.expr -> JsAst.expr -> JsAst.expr
79 val string : ?label:Annot.label -> string -> JsAst.expr
80 val this : ?label:Annot.label -> unit -> JsAst.expr
81 val unop : ?label:Annot.label -> JsAst.unop -> JsAst.expr -> JsAst.expr
82 val undefined : ?label:Annot.label -> unit -> JsAst.expr
83
84 (* builds (function(){ var [idents]; return [expr]})() *)
85 val scope : JsIdent.t list -> JsAst.expr -> JsAst.expr
86 (* as scope, but just return the expression when the list of local vars is empty *)
87 val maybe_scope : JsIdent.t list -> JsAst.expr -> JsAst.expr
88
89 (** {6 Deprecated API} *)
90
91 (**
92 Used in the transition between jslang/jslang2.
93 *)
94
95 (**
96 After the transition, remove this function, and use [comma] combine with [affect] instead.
97 It is preferable to lift affectation to the higher level of the current scope, rather than
98 having imbrication of affectation. (lisibility of code for debuging)
99 *)
100 val deprecated_letin : ?label:Annot.label -> (JsAst.ident * JsAst.expr) list -> JsAst.expr -> JsAst.expr
101
102 (**
103 After the transition, remove this function, and use [function_] instead
104 *)
105 val deprecated_lambda :
106 ?label:Annot.label ->
107 JsAst.ident list ->
108 JsAst.ident list ->
109 JsAst.expr ->
110 JsAst.expr
111 end
112
113 module Statement :
114 sig
115 val def : ?label:Annot.label -> JsAst.ident -> JsAst.statement
116
117 val assign : ?label:Annot.label -> JsAst.expr -> JsAst.expr -> JsAst.statement
118 val assign_ident : ?label:Annot.label -> JsAst.ident -> JsAst.expr -> JsAst.statement
119 val block : ?label:Annot.label -> JsAst.statement list -> JsAst.statement
120 val continue : ?label:Annot.label -> ?label:JsAst.label -> unit -> JsAst.statement
121 val comment : ?label:Annot.label -> ?kind:[`doc|`simple|`one_line] -> string -> JsAst.statement
122 val expr : ?label:Annot.label -> JsAst.expr -> JsAst.statement
123 val function_ : ?label:Annot.label -> JsAst.ident -> JsAst.ident list -> JsAst.statement list -> JsAst.statement
124 val if_ : ?label:Annot.label -> JsAst.expr -> JsAst.statement -> JsAst.statement -> JsAst.statement
125 val if_no_else : ?label:Annot.label -> JsAst.expr -> JsAst.statement -> JsAst.statement
126 val return : ?label:Annot.label -> JsAst.expr -> JsAst.statement
127 val switch : ?label:Annot.label -> ?default:JsAst.statement -> JsAst.expr -> (JsAst.expr * JsAst.statement) list -> JsAst.statement
128 val var : ?label:Annot.label -> ?expr:JsAst.expr -> JsAst.ident -> JsAst.statement
129 val while_ : ?label:Annot.label -> JsAst.expr -> JsAst.statement -> JsAst.statement
130
131 (** {6 Deprecated API} *)
132
133 (**
134 Used in the transition between jslang/jslang2.
135 *)
136
137 (**
138 After the transition, remove this function, and use [function_] instead
139 *)
140 val deprecated_function :
141 ?label:Annot.label ->
142 JsAst.ident -> JsAst.ident list ->
143 JsAst.ident list ->
144 JsAst.expr ->
145 JsAst.statement
146 end
147
148 module Ident :
149 sig
150 val ident : Ident.t -> JsAst.ident
151
152
153 val fresh : JsAst.ident -> JsAst.ident
154 val fresh_qml : Ident.t -> JsAst.ident
155
156 (**
157 Build a local native ident.
158 Global native ident should rather not be created directly, but produced with an analysis.
159 *)
160 val native : string -> JsAst.ident
161 val native_global : string -> JsAst.ident
162
163
164
165 end
Something went wrong with that request. Please try again.