Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 103 lines (82 sloc) 2.751 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 Fun action resolution : Insertion of environment serialization.
21
22 @author Rudy Sicard
23 @author Mathieu Barbin
24 *)
25
26 (**
27 This module implements part of the funactions resolution for opa.
28 This is the step 2), taking place :
29 + after Typing and Slicing
30 + before Explicit instantation.
31
32
33 This pass insert in the code generating the xhml sent to clients containing fun actions
34 the serialization of the environment of the fun action, corresponding to the argument
35 already applied.
36
37 Initial expressions
38 {[
39 < onclick=\{EXPR = \@funaction(e)\}>
40 ]}
41
42 After [FunActionLifting]
43 {[
44 f(arg1,arg2,...)=e
45 < onclick=\{EXPR = \@funaction( f(arg1,arg2,...) ) \}>
46 ]}
47
48 Then, [typing, slicing].
49
50 After [FunActionEnvSerialize]
51 {[
52 f(arg1,arg2,...)=e
53 < onclick=\{EXPR = \@funaction(
54 arg1_ = FunActionServer_serialize_argument(arg1)
55 arg2_ = FunActionServer_serialize_argument(arg2)
56 ...
57 (\@funaction[client_id](f))(
58 \@funaction[Deserialize](arg1_),
59 \@funaction[Deserialize](arg2_),
60 ...
61 )
62 )
63 \} >
64 ]}
65
66 The pass is after typing, and should preserve types.
67
68 Types of directive:
69 + {[\@funaction('a) : 'a]}
70 + {[\@funaction[Deserialized]({arg : 'a ; serialized_arg : string}) : 'a]}
71 + {[\@funaction[cliend_id]('a) : 'a]}
72
73 So, essentially, the kernel of this pass is the following, applied only
74 on the server side code :
75
76 From all directives :
77 {[
78 \@funaction( f(arg1,arg2,...) )
79 ]}
80
81 To
82 {[
83 \@funaction(
84 arg1_ = FunActionServer_serialize_argument(arg1)
85 arg2_ = FunActionServer_serialize_argument(arg2)
86 ...
87 (\@funaction[client_id](f))(
88 \@funaction[Deserialize](arg1_),
89 \@funaction[Deserialize](arg2_),
90 ...
91 )
92 )
93 ]}
94
95 *)
96
97 val process_server_code:
98 stdlib_gamma:QmlTypes.gamma ->
99 QmlTypes.gamma ->
100 QmlAst.annotmap ->
101 QmlAst.code ->
102 (QmlTypes.gamma * QmlAst.annotmap) * QmlAst.code
Something went wrong with that request. Please try again.