Skip to content
Newer
Older
100644 399 lines (298 sloc) 11.5 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,
94 ( SurfaceAst.parsing_directive SurfaceAstPasses.parsed_file list
95 * SurfaceAst.parsing_directive SurfaceAstPasses.parsed_file list
96 ) * env_OpenFiles
97 )
98 opa_pass
99
100 val pass_RegisterAppSrcCode :
101 (
102 (
103 ( SurfaceAst.parsing_directive SurfaceAstPasses.parsed_file list
104 * SurfaceAst.parsing_directive SurfaceAstPasses.parsed_file list
105 ) as 'parsed_files
106 )
107 * env_OpenFiles
108 ,
109 'parsed_files
110 ) opa_pass
111
112 val pass_BslLoading :
113 ((((SurfaceAst.nonuid, SurfaceAst.parsing_directive)
114 SurfaceAst.code_elt) ObjectFiles.parsed_code) as 'parsed_code
115 ,
116 'parsed_code * BslLib.env_bsl) opa_pass
117
118 val pass_ConvertStructure :
119 (
120 ((SurfaceAst.nonuid, SurfaceAst.parsing_directive as 'directive)
121 SurfaceAst.code_elt) ObjectFiles.parsed_code * BslLib.env_bsl
122 ,
123 (SurfaceAst.nonuid, 'directive) SurfaceAstPasses.env_both_lcodes
124 ) opa_pass
125
126 val pass_LoadObjects :
127 (
128 (
129 SurfaceAstPasses.options,
130 (SurfaceAst.nonuid,
131 [< SurfaceAst.all_directives >
132 `static_content `static_content_directory `static_resource `static_resource_directory ] as 'a)
133 SurfaceAst.code_elt ObjectFiles.parsed_code
134 ) PassHandler.one_env
135 -> unit
136 )
137 ->
138 (
139 SurfaceAstPasses.options, unit,
140 ('a SurfaceAstPasses.parsed_file list * 'a SurfaceAstPasses.parsed_file list)
141 , unit
142 )
143 PassHandler.pass
144
145 val pass_CheckServerEntryPoint :
146 (
147 (SurfaceAst.nonuid, SurfaceAst.parsing_directive) SurfaceAstPasses.env_both_lcodes,
148 (SurfaceAst.nonuid, SurfaceAst.parsing_directive) SurfaceAstPasses.env_both_lcodes
149 )
150 opa_pass
151
152 val pass_ParserGeneration :
153 (
154 (SurfaceAst.nonuid, SurfaceAst.parsing_directive) SurfaceAstPasses.env_both_lcodes,
155 (SurfaceAst.nonuid, SurfaceAst.renaming_directive) SurfaceAstPasses.env_both_lcodes
156 )
157 opa_pass
158
159 val pass_CheckDuplication :
160 (
161 (SurfaceAst.nonuid, SurfaceAst.renaming_directive) SurfaceAstPasses.env_both_lcodes,
162 (SurfaceAst.uids, SurfaceAst.dependency_directive) SurfaceAstPasses.env_both_lcodes
163 )
164 opa_pass
165
166 val pass_ConvertStructure2 : unit ->
167 (
168 (Ident.t, [< SurfaceAst.all_directives ] as 'a) SurfaceAstPasses.env_both_lcodes,
169 (Ident.t, 'a) Passes.sa_env_Gen
170 )
171 opa_pass
172
173 val pass_AddDocApiDirectives : unit ->
174 (
175 (SurfaceAstCons.ExprIdentCons.ident,
176 [< SurfaceAst.all_directives
177 > `coerce `deprecated `doctype `local `module_ `package
178 `private_ `public `side_annotation `visibility_annotation ]
179 as 'c) Passes.sa_env_Gen,
180 (SurfaceAstCons.ExprIdentCons.ident, 'c) Passes.sa_env_Gen)
181 opa_pass
182
183 val pass_ReorderToplevel : unit ->
184 (
185 (Ident.t, SurfaceAst.dependency_directive) Passes.sa_env_Gen,
186 (Ident.t, SurfaceAst.dependency_directive) Passes.sa_env_Gen)
187 opa_pass
188
189 val pass_RewriteModules : unit ->
190 (
191 (Ident.t, SurfaceAst.dependency_directive) Passes.sa_env_Gen,
192 (Ident.t, SurfaceAst.basic_directive) Passes.sa_env_Gen)
193 opa_pass
194
195 (**********************************************)
196 (* QML AST PASSES *****************************)
197
198 val pass_SaToQml :
199 (
200 (SurfaceAst.uids, SurfaceAst.basic_directive) Passes.sa_env_Gen,
201 unit Passes.env_Gen) opa_pass
202
203 val pass_AddCSS :
204 (unit Passes.env_Gen, unit Passes.env_Gen) opa_pass
205
206 val pass_CheckPatternMatching :
207 (unit Passes.env_Gen, unit Passes.env_Gen) opa_pass
208
209 val pass_EndOfSeparateCompilation :
210 ((SurfaceAstPasses.options, unit Passes.env_Gen) PassHandler.one_env -> unit) ->
211 (opa_options, unit, unit Passes.env_Gen, unit) PassHandler.pass
212
213 (*
214 (Passes.env_Gen, Passes.env_Gen) opa_pass
215
216 ((SurfaceAstPasses.options, ('a, 'b, SurfaceAstCons.ExprIdentCons.ident, SurfaceAst.basic_directive) Passes.sa_env_Gen_aux) PassHandler.one_env -> unit) ->
217 (SurfaceAstPasses.options, unit, ('a, 'b, SurfaceAstCons.ExprIdentCons.ident, SurfaceAst.basic_directive) Passes.sa_env_Gen_aux, unit) PassHandler.pass
218 *)
219
220 val pass_FunActionLifting :
221 (unit Passes.env_Gen, unit Passes.env_Gen) opa_pass
222
223 val pass_TypesDefinitions :
224 (unit Passes.env_Gen, unit Passes.env_Gen) opa_pass
225
226 val pass_DbSchemaGeneration :
227 (unit Passes.env_Gen, unit Passes.env_Gen) opa_pass
228
229 val pass_DbPathCoercion :
230 (unit Passes.env_Gen, unit Passes.env_Gen) opa_pass
231
232 (** {b Descr}: The typechecking passe. *)
233 val pass_Typing :
234 (unit Passes.env_Gen, unit Passes.env_Gen) opa_pass
235
236 val pass_Retyping :
237 (unit Passes.env_Gen, unit Passes.env_Gen) opa_pass
238
00818f9 [refactor] removing most typing directives sooner
Valentin Gatien-Baron authored
239 val pass_PurgeTypeDirectiveAfterTyping :
240 (unit Passes.env_Gen, unit Passes.env_Gen) opa_pass
241
fccc685 Initial open-source release
MLstate authored
242 val pass_DbAccessorsGeneration :
243 (unit Passes.env_Gen, (QmlDbGen.dbinfo StringListMap.t * QmlAlphaConv.t option) Passes.env_Gen) opa_pass
244
245 val pass_DbCodeGeneration :
246 ((QmlDbGen.dbinfo StringListMap.t * QmlAlphaConv.t option) Passes.env_Gen, unit Passes.env_Gen) opa_pass
247
248 val pass_DocApiGeneration :
249 (unit Passes.env_Gen, unit Passes.env_Gen) opa_pass
250
251 val pass_WarnCoerce :
252 (unit Passes.env_Gen, unit Passes.env_Gen) opa_pass
253
254 val pass_CompileRecursiveValues :
255 (unit Passes.env_Gen, unit Passes.env_Gen) opa_pass
256
8edc001 [feature] adding: an @async directive on bindings to perform asynchro…
Valentin Gatien-Baron authored
257 val pass_RewriteAsyncLambda :
258 (unit Passes.env_Gen, unit Passes.env_Gen) opa_pass
259
fccc685 Initial open-source release
MLstate authored
260 val pass_MacroExpansion :
261 (unit Passes.env_Gen, unit Passes.env_Gen) opa_pass
262
263 val pass_EnrichMagic :
264 (unit Passes.env_Gen, Pass_SimplifyMagic.env Passes.env_Gen) opa_pass
265
266 val pass_EnrichMagicPurge :
267 (unit Passes.env_Gen, Pass_SimplifyMagic.env Passes.env_Gen) opa_pass
268
269 val pass_SimplifyEquality :
270 (Pass_SimplifyMagic.env Passes.env_Gen,
271 Pass_SimplifyMagic.env Passes.env_Gen) opa_pass
272
273 val pass_SimplifyMagic :
274 (Pass_SimplifyMagic.env Passes.env_Gen, unit Passes.env_Gen) opa_pass
275
276 val pass_ReorderEnvGen :
277 (unit Passes.env_Gen, unit Passes.env_Gen) opa_pass
278
279 val pass_BypassHoisting :
280 (unit Passes.env_Gen, unit Passes.env_Gen) opa_pass
281
282 val pass_RegisterFields :
283 (unit Passes.env_Gen, unit Passes.env_Gen) opa_pass
284
285 val pass_QmlUndot :
286 (unit Passes.env_Gen, unit Passes.env_Gen) opa_pass
287
288 val pass_CodingDirectives :
289 (unit Passes.env_Gen, unit Passes.env_Gen) opa_pass
290
291 (**********************************************)
292 (* SLICED PASSES ******************************)
293
294 val pass_NoSlicer :
295 (unit env_Gen, unit env_Gen_sliced) opa_pass
296
297 val pass_SimpleSlicer :
298 (unit env_Gen, unit env_Gen_sliced) opa_pass
299
300 val pass_ExplicitInstantiation :
301 (unit env_Gen_sliced, unit env_Gen_sliced) opa_pass
302
303 val pass_FunActionEnvSerialize :
304 (unit env_Gen_sliced, unit env_Gen_sliced) opa_pass
305
306 val pass_OptimizeExplicitInstantiation :
307 (unit env_Gen_sliced, unit env_Gen_sliced) opa_pass
308
309 val pass_Assertion :
310 (unit env_Gen_sliced, unit env_Gen_sliced) opa_pass
311
312 val pass_SlicedCleaning :
313 (unit env_Gen_sliced, unit env_Gen_sliced) opa_pass
314
315 val pass_FunActionJsCallGeneration :
316 (unit env_Gen_sliced, unit env_Gen_sliced) opa_pass
317
00818f9 [refactor] removing most typing directives sooner
Valentin Gatien-Baron authored
318 val pass_PurgeTypeDirectiveAfterEi :
fccc685 Initial open-source release
MLstate authored
319 (unit env_Gen_sliced, unit env_Gen_sliced) opa_pass
320
321 val pass_ResolveRemoteCalls :
322 (unit env_Gen_sliced, unit env_Gen_sliced) opa_pass
323
324 val pass_InsertMemoizedTypes :
325 (unit env_Gen_sliced, unit env_Gen_sliced) opa_pass
326
327 val pass_SlicedReorder :
328 (unit env_Gen_sliced, unit env_Gen_sliced) opa_pass
329
330 (* ***********************************************)
331 (* FINAL COMPILATION *****************************)
332
333 val pass_SlicedToFinal :
334 (unit env_Gen_sliced, env_bothFinalCompile) opa_pass
335
336 (* ***********************************************)
337 (* FINAL CLIENT COMPILATION **********************)
338
339 val pass_ClientCpsRewriter :
340 (env_bothFinalCompile, env_bothFinalCompile) opa_pass
341
342 val pass_ClientLambdaLifting :
343 (env_bothFinalCompile, env_bothFinalCompile) opa_pass
344
345 val pass_ClientQmlUncurry :
346 (env_bothFinalCompile, env_bothFinalCompile) opa_pass
347
348 val pass_ClientQmlClosure :
349 (env_bothFinalCompile, env_bothFinalCompile) opa_pass
350
351 val pass_ClientQmlConstantSharing :
352 (env_bothFinalCompile, env_bothFinalCompile) opa_pass
353
354 val pass_JavascriptCompilation :
355 (env_bothFinalCompile, env_NewFinalCompile) opa_pass
356
357 val pass_ResolveJsIdent :
358 (env_NewFinalCompile, env_NewFinalCompile) opa_pass
359
360 val pass_GenerateServerAst : bool ->
361 (env_NewFinalCompile, env_NewFinalCompile) opa_pass
362
363 (* ***********************************************)
364 (* FINAL SERVER COMPILATION **********************)
365
366 val pass_CleanLambdaLiftingDirectives :
367 (env_NewFinalCompile, env_NewFinalCompile) opa_pass
368
369 val pass_InitializeBslValues :
370 (env_NewFinalCompile, env_NewFinalCompile) opa_pass
371
372 val pass_ServerCpsRewriter :
373 (env_NewFinalCompile, env_NewFinalCompile) opa_pass
374
375 val pass_ServerQmlClosure :
376 (env_NewFinalCompile, env_NewFinalCompile) opa_pass
377
378 val pass_QmlLiftDeepRecords :
379 (env_NewFinalCompile, env_NewFinalCompile) opa_pass
380
381 val pass_QmlConstantSharing :
382 (env_NewFinalCompile, env_NewFinalCompile) opa_pass
383
384 val pass_QmlCompilation :
385 (env_NewFinalCompile, env_QmlCompilation) opa_pass
386
387 val pass_OcamlSplitCode :
388 (env_QmlCompilation, env_OcamlSplitCode) opa_pass
389
390 val pass_OcamlGeneration :
391 (env_OcamlSplitCode, env_OcamlGeneration) opa_pass
392
393 val pass_OcamlCompilation :
394 (env_OcamlGeneration, env_OcamlCompilation) opa_pass
395
396 val pass_CleanUp : ('opt, 'opt, env_OcamlCompilation, env_OcamlCompilation) PassHandler.pass
397
398 val pass_ByeBye : (_, unit, env_OcamlCompilation, unit) PassHandler.pass
Something went wrong with that request. Please try again.