Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 438 lines (332 sloc) 12.883 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 open Passes
19
20 (** Pass and pass utils for OPA S3. *)
21
22 (** {6 Type alias to passHandler for OPA}*)
23 (** Shortcut for [opa_options] *)
24 type opa_options = OpaEnv.opa_options
25
26 (** Type of OPA environments. *)
27 type 'env opa_env = (opa_options, 'env) PassHandler.one_env
28
29 (** Type of OPA passes. *)
30 type ('env, 'env2) opa_pass =
31 (opa_options, opa_options, 'env, 'env2) PassHandler.pass
32
33 (** Type of old OPA passes. *)
34 type ('env, 'env2) opa_old_pass =
35 (opa_options, 'env, 'env2) PassHandler.old_pass
36
37 (** {6 Some environment} *)
38
39 (**
40 Environment for keeping (server * client) environments.
41 *)
42 type env_bothFinalCompile = (env_NewFinalCompile * env_NewFinalCompile)
43
44 (**
45 Environment returned by the QmlCompilation.
46 *)
47 type env_QmlCompilation = {
48 qmlCompilation_options : Qml2ocamlOptions.argv_options ;
49 qmlCompilation_env_ocaml_input : Qml2ocaml.env_ocaml_input ;
50 }
51
52 (**
53 Environment returned after splitting ocaml code into smaller files
54 *)
55 type env_OcamlSplitCode = {
56 ocamlSplitCode_options : Qml2ocamlOptions.argv_options ;
57 ocamlSplitCode_env_ocaml_split : Qml2ocaml.env_ocaml_split ;
58 }
59
60 (**
61 Environment returned by the OcamlGeneration.
62 *)
63 type env_OcamlGeneration = {
64 ocamlGeneration_options : Qml2ocamlOptions.argv_options ;
65 ocamlGeneration_env_ocaml_output : Qml2ocaml.env_ocaml_output ;
66 }
67
68 (**
69 Environment returned by the OcamlCompilation.
70 *)
71 type env_OcamlCompilation = {
72 ocamlCompilation_returned_code : int ;
73 }
74
75 (**{6 S3 Passes} All value bellow should be type of
76 [opa_pass].*)
77
78 val pass_Welcome : (unit, opa_options, unit, unit) PassHandler.pass
79
80 val pass_CheckOptions : (unit, env_ArgParse) opa_pass
81
82 (**
83 {6 Stdlib files}
84
85 This pass adds OPA's standard include list.
86 *)
87 val pass_AddStdlibFiles : (env_ArgParse, env_AddStdlibFiles) opa_pass
88
89 val pass_PreProcess : (env_OpenFiles, env_OpenFiles) opa_pass
90
91 val pass_Parse :
92 (
93 env_OpenFiles,
4692879 @OpaOnWindowsNow [feature] Internationalisation: add @i18n directive and start support fo...
OpaOnWindowsNow authored
94 ( SurfaceAst.parsing_directive SurfaceAstPassesTypes.parsed_file list
95 * SurfaceAst.parsing_directive SurfaceAstPassesTypes.parsed_file list
fccc685 Initial open-source release
MLstate authored
96 ) * env_OpenFiles
97 )
98 opa_pass
99
415cfc3 @BourgerieQuentin [feature] syntax: syntax helper
BourgerieQuentin authored
100 val pass_Print :
101 (
102 ((
103 ( SurfaceAst.parsing_directive SurfaceAstPassesTypes.parsed_file list
104 * SurfaceAst.parsing_directive SurfaceAstPassesTypes.parsed_file list
105 )
106 )
107 * env_OpenFiles) as 'parsed_files
108 ,
109 'parsed_files
110 ) opa_pass
111
fccc685 Initial open-source release
MLstate authored
112 val pass_RegisterAppSrcCode :
113 (
114 (
4692879 @OpaOnWindowsNow [feature] Internationalisation: add @i18n directive and start support fo...
OpaOnWindowsNow authored
115 ( SurfaceAst.parsing_directive SurfaceAstPassesTypes.parsed_file list
116 * SurfaceAst.parsing_directive SurfaceAstPassesTypes.parsed_file list
fccc685 Initial open-source release
MLstate authored
117 ) as 'parsed_files
118 )
119 * env_OpenFiles
120 ,
121 'parsed_files
122 ) opa_pass
123
6019e3a @BourgerieQuentin [feature] dbGen: Import database runtime corresponding to the selected b...
BourgerieQuentin authored
124 val pass_DbEngineImportation :
125 ((
126 ( SurfaceAst.parsing_directive SurfaceAstPassesTypes.parsed_file list
127 * SurfaceAst.parsing_directive SurfaceAstPassesTypes.parsed_file list
128 ) as 'parsed_files)
129 ,
130 'parsed_files)
131 opa_pass
415cfc3 @BourgerieQuentin [feature] syntax: syntax helper
BourgerieQuentin authored
132
fccc685 Initial open-source release
MLstate authored
133 val pass_BslLoading :
134 ((((SurfaceAst.nonuid, SurfaceAst.parsing_directive)
135 SurfaceAst.code_elt) ObjectFiles.parsed_code) as 'parsed_code
136 ,
137 'parsed_code * BslLib.env_bsl) opa_pass
138
139 val pass_ConvertStructure :
140 (
141 ((SurfaceAst.nonuid, SurfaceAst.parsing_directive as 'directive)
142 SurfaceAst.code_elt) ObjectFiles.parsed_code * BslLib.env_bsl
143 ,
4692879 @OpaOnWindowsNow [feature] Internationalisation: add @i18n directive and start support fo...
OpaOnWindowsNow authored
144 (SurfaceAst.nonuid, 'directive) SurfaceAstPassesTypes.env_both_lcodes
fccc685 Initial open-source release
MLstate authored
145 ) opa_pass
146
147 val pass_LoadObjects :
148 (
149 (
4692879 @OpaOnWindowsNow [feature] Internationalisation: add @i18n directive and start support fo...
OpaOnWindowsNow authored
150 SurfaceAstPassesTypes.options,
fccc685 Initial open-source release
MLstate authored
151 (SurfaceAst.nonuid,
152 [< SurfaceAst.all_directives >
153 `static_content `static_content_directory `static_resource `static_resource_directory ] as 'a)
154 SurfaceAst.code_elt ObjectFiles.parsed_code
155 ) PassHandler.one_env
156 -> unit
157 )
158 ->
159 (
4692879 @OpaOnWindowsNow [feature] Internationalisation: add @i18n directive and start support fo...
OpaOnWindowsNow authored
160 SurfaceAstPassesTypes.options, unit,
161 ('a SurfaceAstPassesTypes.parsed_file list * 'a SurfaceAstPassesTypes.parsed_file list)
fccc685 Initial open-source release
MLstate authored
162 , unit
163 )
164 PassHandler.pass
165
166 val pass_CheckServerEntryPoint :
167 (
4692879 @OpaOnWindowsNow [feature] Internationalisation: add @i18n directive and start support fo...
OpaOnWindowsNow authored
168 (SurfaceAst.nonuid, SurfaceAst.parsing_directive) SurfaceAstPassesTypes.env_both_lcodes,
169 (SurfaceAst.nonuid, SurfaceAst.parsing_directive) SurfaceAstPassesTypes.env_both_lcodes
fccc685 Initial open-source release
MLstate authored
170 )
171 opa_pass
172
173 val pass_ParserGeneration :
174 (
4692879 @OpaOnWindowsNow [feature] Internationalisation: add @i18n directive and start support fo...
OpaOnWindowsNow authored
175 (SurfaceAst.nonuid, SurfaceAst.parsing_directive) SurfaceAstPassesTypes.env_both_lcodes,
176 (SurfaceAst.nonuid, SurfaceAst.renaming_directive) SurfaceAstPassesTypes.env_both_lcodes
fccc685 Initial open-source release
MLstate authored
177 )
178 opa_pass
179
180 val pass_CheckDuplication :
181 (
4692879 @OpaOnWindowsNow [feature] Internationalisation: add @i18n directive and start support fo...
OpaOnWindowsNow authored
182 (SurfaceAst.nonuid, SurfaceAst.renaming_directive) SurfaceAstPassesTypes.env_both_lcodes,
183 (SurfaceAst.uids, SurfaceAst.dependency_directive) SurfaceAstPassesTypes.env_both_lcodes
184 )
185 opa_pass
186
187 val pass_I18nAndComputedString :
188 (
189 (SurfaceAst.uids, SurfaceAst.dependency_directive) SurfaceAstPassesTypes.env_both_lcodes,
190 (SurfaceAst.uids, SurfaceAst.dependency_directive) SurfaceAstPassesTypes.env_both_lcodes
fccc685 Initial open-source release
MLstate authored
191 )
192 opa_pass
51f92b4 [feature] adding: a no_client_calls directive
Hugo Heuzard authored
193
194 val pass_TreatNoClientCalls : unit ->
195 (
196 (SurfaceAstCons.ExprIdentCons.ident, [< SurfaceAst.all_directives >
197 `no_client_calls `with_thread_context] as 'a ) Passes.sa_env_Gen,
198 (SurfaceAstCons.ExprIdentCons.ident, 'a) Passes.sa_env_Gen
199 )
200 opa_pass
fccc685 Initial open-source release
MLstate authored
201
202 val pass_ConvertStructure2 : unit ->
203 (
4692879 @OpaOnWindowsNow [feature] Internationalisation: add @i18n directive and start support fo...
OpaOnWindowsNow authored
204 (Ident.t, [< SurfaceAst.all_directives ] as 'a) SurfaceAstPassesTypes.env_both_lcodes,
fccc685 Initial open-source release
MLstate authored
205 (Ident.t, 'a) Passes.sa_env_Gen
206 )
207 opa_pass
208
209 val pass_AddDocApiDirectives : unit ->
210 (
211 (SurfaceAstCons.ExprIdentCons.ident,
212 [< SurfaceAst.all_directives
213 > `coerce `deprecated `doctype `local `module_ `package
214 `private_ `public `side_annotation `visibility_annotation ]
215 as 'c) Passes.sa_env_Gen,
216 (SurfaceAstCons.ExprIdentCons.ident, 'c) Passes.sa_env_Gen)
217 opa_pass
218
219 val pass_ReorderToplevel : unit ->
220 (
221 (Ident.t, SurfaceAst.dependency_directive) Passes.sa_env_Gen,
222 (Ident.t, SurfaceAst.dependency_directive) Passes.sa_env_Gen)
223 opa_pass
224
225 val pass_RewriteModules : unit ->
226 (
227 (Ident.t, SurfaceAst.dependency_directive) Passes.sa_env_Gen,
228 (Ident.t, SurfaceAst.basic_directive) Passes.sa_env_Gen)
229 opa_pass
230
231 (**********************************************)
232 (* QML AST PASSES *****************************)
233
234 val pass_SaToQml :
235 (
236 (SurfaceAst.uids, SurfaceAst.basic_directive) Passes.sa_env_Gen,
237 unit Passes.env_Gen) opa_pass
238
239 val pass_AddCSS :
240 (unit Passes.env_Gen, unit Passes.env_Gen) opa_pass
241
242 val pass_CheckPatternMatching :
243 (unit Passes.env_Gen, unit Passes.env_Gen) opa_pass
244
245 val pass_EndOfSeparateCompilation :
4692879 @OpaOnWindowsNow [feature] Internationalisation: add @i18n directive and start support fo...
OpaOnWindowsNow authored
246 ((SurfaceAstPassesTypes.options, unit Passes.env_Gen) PassHandler.one_env -> unit) ->
fccc685 Initial open-source release
MLstate authored
247 (opa_options, unit, unit Passes.env_Gen, unit) PassHandler.pass
248
249 (*
250 (Passes.env_Gen, Passes.env_Gen) opa_pass
251
4692879 @OpaOnWindowsNow [feature] Internationalisation: add @i18n directive and start support fo...
OpaOnWindowsNow authored
252 ((SurfaceAstPassesTypes.options, ('a, 'b, SurfaceAstCons.ExprIdentCons.ident, SurfaceAst.basic_directive) Passes.sa_env_Gen_aux) PassHandler.one_env -> unit) ->
253 (SurfaceAstPassesTypes.options, unit, ('a, 'b, SurfaceAstCons.ExprIdentCons.ident, SurfaceAst.basic_directive) Passes.sa_env_Gen_aux, unit) PassHandler.pass
fccc685 Initial open-source release
MLstate authored
254 *)
255
256 val pass_FunActionLifting :
257 (unit Passes.env_Gen, unit Passes.env_Gen) opa_pass
258
259 val pass_TypesDefinitions :
260 (unit Passes.env_Gen, unit Passes.env_Gen) opa_pass
261
262 val pass_DbSchemaGeneration :
263 (unit Passes.env_Gen, unit Passes.env_Gen) opa_pass
264
265 val pass_DbPathCoercion :
266 (unit Passes.env_Gen, unit Passes.env_Gen) opa_pass
267
268 (** {b Descr}: The typechecking passe. *)
269 val pass_Typing :
270 (unit Passes.env_Gen, unit Passes.env_Gen) opa_pass
271
272 val pass_Retyping :
273 (unit Passes.env_Gen, unit Passes.env_Gen) opa_pass
274
00818f9 [refactor] removing most typing directives sooner
Valentin Gatien-Baron authored
275 val pass_PurgeTypeDirectiveAfterTyping :
276 (unit Passes.env_Gen, unit Passes.env_Gen) opa_pass
277
ccded04 @BourgerieQuentin [enhance] compiler: (big) added mongo accessors generation + database ba...
BourgerieQuentin authored
278 val pass_BadopCodeGeneration :
279 (unit Passes.env_Gen, unit Passes.env_Gen) opa_pass
fccc685 Initial open-source release
MLstate authored
280
ccded04 @BourgerieQuentin [enhance] compiler: (big) added mongo accessors generation + database ba...
BourgerieQuentin authored
281 val pass_MongoCodeGeneration :
282 (unit Passes.env_Gen, unit Passes.env_Gen) opa_pass
fccc685 Initial open-source release
MLstate authored
283
284 val pass_DocApiGeneration :
285 (unit Passes.env_Gen, unit Passes.env_Gen) opa_pass
286
287 val pass_WarnCoerce :
288 (unit Passes.env_Gen, unit Passes.env_Gen) opa_pass
289
290 val pass_CompileRecursiveValues :
291 (unit Passes.env_Gen, unit Passes.env_Gen) opa_pass
292
8edc001 [feature] adding: an @async directive on bindings to perform asynchronou...
Valentin Gatien-Baron authored
293 val pass_RewriteAsyncLambda :
294 (unit Passes.env_Gen, unit Passes.env_Gen) opa_pass
295
fccc685 Initial open-source release
MLstate authored
296 val pass_MacroExpansion :
297 (unit Passes.env_Gen, unit Passes.env_Gen) opa_pass
298
299 val pass_EnrichMagic :
300 (unit Passes.env_Gen, Pass_SimplifyMagic.env Passes.env_Gen) opa_pass
301
302 val pass_EnrichMagicPurge :
303 (unit Passes.env_Gen, Pass_SimplifyMagic.env Passes.env_Gen) opa_pass
304
305 val pass_SimplifyEquality :
306 (Pass_SimplifyMagic.env Passes.env_Gen,
307 Pass_SimplifyMagic.env Passes.env_Gen) opa_pass
308
309 val pass_SimplifyMagic :
310 (Pass_SimplifyMagic.env Passes.env_Gen, unit Passes.env_Gen) opa_pass
311
936d60a [feature] closure serialisation: adding closure instrumentation (compile...
Valentin Gatien-Baron authored
312 val pass_InstrumentForClosureSerialization :
313 (unit Passes.env_Gen, unit Passes.env_Gen) opa_pass
314
fccc685 Initial open-source release
MLstate authored
315 val pass_ReorderEnvGen :
316 (unit Passes.env_Gen, unit Passes.env_Gen) opa_pass
317
318 val pass_BypassHoisting :
319 (unit Passes.env_Gen, unit Passes.env_Gen) opa_pass
320
321 val pass_RegisterFields :
322 (unit Passes.env_Gen, unit Passes.env_Gen) opa_pass
323
324 val pass_QmlUndot :
325 (unit Passes.env_Gen, unit Passes.env_Gen) opa_pass
326
327 val pass_CodingDirectives :
328 (unit Passes.env_Gen, unit Passes.env_Gen) opa_pass
329
330 (**********************************************)
331 (* SLICED PASSES ******************************)
332
333 val pass_NoSlicer :
334 (unit env_Gen, unit env_Gen_sliced) opa_pass
335
336 val pass_SimpleSlicer :
337 (unit env_Gen, unit env_Gen_sliced) opa_pass
338
339 val pass_ExplicitInstantiation :
340 (unit env_Gen_sliced, unit env_Gen_sliced) opa_pass
341
342 val pass_FunActionEnvSerialize :
343 (unit env_Gen_sliced, unit env_Gen_sliced) opa_pass
344
345 val pass_OptimizeExplicitInstantiation :
346 (unit env_Gen_sliced, unit env_Gen_sliced) opa_pass
347
348 val pass_Assertion :
349 (unit env_Gen_sliced, unit env_Gen_sliced) opa_pass
350
351 val pass_SlicedCleaning :
352 (unit env_Gen_sliced, unit env_Gen_sliced) opa_pass
353
354 val pass_FunActionJsCallGeneration :
355 (unit env_Gen_sliced, unit env_Gen_sliced) opa_pass
356
00818f9 [refactor] removing most typing directives sooner
Valentin Gatien-Baron authored
357 val pass_PurgeTypeDirectiveAfterEi :
fccc685 Initial open-source release
MLstate authored
358 (unit env_Gen_sliced, unit env_Gen_sliced) opa_pass
359
360 val pass_ResolveRemoteCalls :
361 (unit env_Gen_sliced, unit env_Gen_sliced) opa_pass
362
363 val pass_InsertMemoizedTypes :
364 (unit env_Gen_sliced, unit env_Gen_sliced) opa_pass
365
366 val pass_SlicedReorder :
367 (unit env_Gen_sliced, unit env_Gen_sliced) opa_pass
368
369 (* ***********************************************)
370 (* FINAL COMPILATION *****************************)
371
372 val pass_SlicedToFinal :
373 (unit env_Gen_sliced, env_bothFinalCompile) opa_pass
374
375 (* ***********************************************)
376 (* FINAL CLIENT COMPILATION **********************)
377
378 val pass_ClientCpsRewriter :
379 (env_bothFinalCompile, env_bothFinalCompile) opa_pass
380
381 val pass_ClientLambdaLifting :
382 (env_bothFinalCompile, env_bothFinalCompile) opa_pass
383
384 val pass_ClientQmlUncurry :
385 (env_bothFinalCompile, env_bothFinalCompile) opa_pass
386
387 val pass_ClientQmlClosure :
388 (env_bothFinalCompile, env_bothFinalCompile) opa_pass
389
390 val pass_ClientQmlConstantSharing :
391 (env_bothFinalCompile, env_bothFinalCompile) opa_pass
392
393 val pass_JavascriptCompilation :
394 (env_bothFinalCompile, env_NewFinalCompile) opa_pass
395
396 val pass_ResolveJsIdent :
397 (env_NewFinalCompile, env_NewFinalCompile) opa_pass
398
399 val pass_GenerateServerAst : bool ->
400 (env_NewFinalCompile, env_NewFinalCompile) opa_pass
401
402 (* ***********************************************)
403 (* FINAL SERVER COMPILATION **********************)
404
405 val pass_CleanLambdaLiftingDirectives :
406 (env_NewFinalCompile, env_NewFinalCompile) opa_pass
407
408 val pass_InitializeBslValues :
409 (env_NewFinalCompile, env_NewFinalCompile) opa_pass
410
411 val pass_ServerCpsRewriter :
412 (env_NewFinalCompile, env_NewFinalCompile) opa_pass
413
414 val pass_ServerQmlClosure :
415 (env_NewFinalCompile, env_NewFinalCompile) opa_pass
416
417 val pass_QmlLiftDeepRecords :
418 (env_NewFinalCompile, env_NewFinalCompile) opa_pass
419
420 val pass_QmlConstantSharing :
421 (env_NewFinalCompile, env_NewFinalCompile) opa_pass
422
423 val pass_QmlCompilation :
424 (env_NewFinalCompile, env_QmlCompilation) opa_pass
425
426 val pass_OcamlSplitCode :
427 (env_QmlCompilation, env_OcamlSplitCode) opa_pass
428
429 val pass_OcamlGeneration :
430 (env_OcamlSplitCode, env_OcamlGeneration) opa_pass
431
432 val pass_OcamlCompilation :
433 (env_OcamlGeneration, env_OcamlCompilation) opa_pass
434
435 val pass_CleanUp : ('opt, 'opt, env_OcamlCompilation, env_OcamlCompilation) PassHandler.pass
436
437 val pass_ByeBye : (_, unit, env_OcamlCompilation, unit) PassHandler.pass
Something went wrong with that request. Please try again.