1
1
2
2
open J
3
3
let unknown : 'a. 'a -> 'a = fun x -> x
4
+ let option sub = fun v ->
5
+ match v with
6
+ | None -> None
7
+ | Some v -> Some (sub v)
4
8
class map = object
5
9
((_self : 'self_type ))
6
- method option :
7
- 'a 'a_out. ('self_type -> 'a -> 'a_out) -> 'a option -> 'a_out option =
8
- fun _f_a ->
9
- function | None -> None | Some _x -> let _x = _f_a _self _x in Some _x
10
10
method list :
11
11
'a 'a_out. ('self_type -> 'a -> 'a_out) -> 'a list -> 'a_out list =
12
12
fun _f_a ->
@@ -25,7 +25,6 @@ let _x0 = _self#ident _x0 in
25
25
Id ( _x0)
26
26
| Qualified ( _x0 ,_x1 ) ->
27
27
let _x0 = _self#module_id _x0 in
28
- let _x1 = _self#option (fun _self -> unknown) _x1 in
29
28
Qualified ( _x0,_x1)
30
29
method exception_ident : exception_ident -> exception_ident = _self#ident
31
30
method for_ident : for_ident -> for_ident = _self#ident
@@ -88,11 +87,10 @@ let _x1 = _self#expression _x1 in
88
87
Array_index ( _x0,_x1)
89
88
| Static_index ( _x0 ,_x1 ,_x2 ) ->
90
89
let _x0 = _self#expression _x0 in
91
- let _x2 = _self#option (fun _self -> unknown) _x2 in
92
90
Static_index ( _x0,_x1,_x2)
93
91
| New ( _x0 ,_x1 ) ->
94
92
let _x0 = _self#expression _x0 in
95
- let _x1 = _self# option (fun _self -> _self#list (fun _self -> _self#expression)) _x1 in
93
+ let _x1 = option (_self#list (fun _self -> _self#expression)) _x1 in
96
94
New ( _x0,_x1)
97
95
| Var ( _x0 ) ->
98
96
let _x0 = _self#vident _x0 in
@@ -141,12 +139,12 @@ let _x1 = _self#block _x1 in
141
139
let _x2 = _self#block _x2 in
142
140
If ( _x0,_x1,_x2)
143
141
| While ( _x0 ,_x1 ,_x2 ,_x3 ) ->
144
- let _x0 = _self# option (fun _self -> _self#label) _x0 in
142
+ let _x0 = option (_self#label) _x0 in
145
143
let _x1 = _self#expression _x1 in
146
144
let _x2 = _self#block _x2 in
147
145
While ( _x0,_x1,_x2,_x3)
148
146
| ForRange ( _x0 ,_x1 ,_x2 ,_x3 ,_x4 ,_x5 ) ->
149
- let _x0 = _self# option (fun _self -> _self#for_ident_expression) _x0 in
147
+ let _x0 = option (_self#for_ident_expression) _x0 in
150
148
let _x1 = _self#finish_ident_expression _x1 in
151
149
let _x2 = _self#for_ident _x2 in
152
150
let _x3 = _self#for_direction _x3 in
@@ -162,35 +160,31 @@ Return ( _x0)
162
160
| Int_switch ( _x0 ,_x1 ,_x2 ) ->
163
161
let _x0 = _self#expression _x0 in
164
162
let _x1 = _self#list (fun _self -> _self#int_clause) _x1 in
165
- let _x2 = _self# option (fun _self -> _self#block) _x2 in
163
+ let _x2 = option (_self#block) _x2 in
166
164
Int_switch ( _x0,_x1,_x2)
167
165
| String_switch ( _x0 ,_x1 ,_x2 ) ->
168
166
let _x0 = _self#expression _x0 in
169
167
let _x1 = _self#list (fun _self -> _self#string_clause) _x1 in
170
- let _x2 = _self# option (fun _self -> _self#block) _x2 in
168
+ let _x2 = option (_self#block) _x2 in
171
169
String_switch ( _x0,_x1,_x2)
172
170
| Throw ( _x0 ) ->
173
171
let _x0 = _self#expression _x0 in
174
172
Throw ( _x0)
175
173
| Try ( _x0 ,_x1 ,_x2 ) ->
176
174
let _x0 = _self#block _x0 in
177
- let _x1 = _self# option (fun _self -> fun ( _x0 ,_x1 ) -> let _x0 = _self#exception_ident _x0 in let _x1 = _self#block _x1 in _x0,_x1) _x1 in
178
- let _x2 = _self# option (fun _self -> _self#block) _x2 in
175
+ let _x1 = option (fun ( _x0 ,_x1 ) -> let _x0 = _self#exception_ident _x0 in let _x1 = _self#block _x1 in _x0,_x1) _x1 in
176
+ let _x2 = option (_self#block) _x2 in
179
177
Try ( _x0,_x1,_x2)
180
178
| Debugger as v -> v
181
- method expression : expression -> expression = fun { expression_desc = _x0 ;comment = _x1 } -> let _x0 = _self#expression_desc _x0 in
182
- let _x1 = _self#option (fun _self -> unknown) _x1 in {expression_desc = _x0;comment = _x1}
183
- method statement : statement -> statement = fun { statement_desc = _x0 ;comment = _x1 } -> let _x0 = _self#statement_desc _x0 in
184
- let _x1 = _self#option (fun _self -> unknown) _x1 in {statement_desc = _x0;comment = _x1}
179
+ method expression : expression -> expression = fun { expression_desc = _x0 ;comment = _x1 } -> let _x0 = _self#expression_desc _x0 in {expression_desc = _x0;comment = _x1}
180
+ method statement : statement -> statement = fun { statement_desc = _x0 ;comment = _x1 } -> let _x0 = _self#statement_desc _x0 in {statement_desc = _x0;comment = _x1}
185
181
method variable_declaration : variable_declaration -> variable_declaration = fun { ident = _x0 ;value = _x1 ;property = _x2 ;ident_info = _x3 } -> let _x0 = _self#ident _x0 in
186
- let _x1 = _self# option (fun _self -> _self#expression) _x1 in {ident = _x0;value = _x1;property = _x2;ident_info = _x3}
182
+ let _x1 = option (_self#expression) _x1 in {ident = _x0;value = _x1;property = _x2;ident_info = _x3}
187
183
method string_clause : string_clause -> string_clause = fun ( _x0 ,_x1 ) -> let _x1 = _self#case_clause _x1 in _x0,_x1
188
184
method int_clause : int_clause -> int_clause = fun ( _x0 ,_x1 ) -> let _x1 = _self#case_clause _x1 in _x0,_x1
189
- method case_clause : case_clause -> case_clause = fun { switch_body = _x0 ;should_break = _x1 ;comment = _x2 } -> let _x0 = _self#block _x0 in
190
- let _x2 = _self#option (fun _self -> unknown) _x2 in {switch_body = _x0;should_break = _x1;comment = _x2}
185
+ method case_clause : case_clause -> case_clause = fun { switch_body = _x0 ;should_break = _x1 ;comment = _x2 } -> let _x0 = _self#block _x0 in {switch_body = _x0;should_break = _x1;comment = _x2}
191
186
method block : block -> block = _self#list (fun _self -> _self#statement)
192
187
method program : program -> program = fun { block = _x0 ;exports = _x1 ;export_set = _x2 } -> let _x0 = _self#block _x0 in {block = _x0;exports = _x1;export_set = _x2}
193
188
method deps_program : deps_program -> deps_program = fun { program = _x0 ;modules = _x1 ;side_effect = _x2 } -> let _x0 = _self#program _x0 in
194
- let _x1 = _self#required_modules _x1 in
195
- let _x2 = _self#option (fun _self -> unknown) _x2 in {program = _x0;modules = _x1;side_effect = _x2}
189
+ let _x1 = _self#required_modules _x1 in {program = _x0;modules = _x1;side_effect = _x2}
196
190
end
0 commit comments