Skip to content

Commit fa4107c

Browse files
committed
Tests: accept
1 parent 0d84c65 commit fa4107c

35 files changed

+4280
-4502
lines changed

compiler/tests-compiler/call_gen.ml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ module M1 = struct
6363
function f(g){return caml_call2(f_prime(g), 3, 4);}
6464
//end
6565
function f_prime(g){
66-
try{var _i_ = caml_call2(g, 1, 2); return _i_;}
66+
try{var a = caml_call2(g, 1, 2); return a;}
6767
catch(e$0){
6868
var e = caml_wrap_exception(e$0);
6969
throw caml_maybe_attach_backtrace(e, 0);
@@ -88,9 +88,9 @@ module M1 = struct
8888
return caml_call1(Stdlib[44], ((a + b | 0) + c | 0) + d | 0);
8989
}
9090
//end
91-
function l(_g_, _h_){return k(_b_, _a_, _g_, _h_);}
91+
function l(c, d){return k(b, a, c, d);}
9292
//end
93-
function m(_e_, _f_){return k(_d_, _c_, _e_, _f_);}
93+
function m(a, b){return k(d, c, a, b);}
9494
//end
9595
function caml_call1(f, a0){
9696
return (f.l >= 0 ? f.l : f.l = f.length) === 1

compiler/tests-compiler/direct_calls.ml

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -84,13 +84,13 @@ let%expect_test "direct calls without --effects=cps" =
8484
//end
8585
function test3(x){
8686
function F(symbol){function f(x){return x + 1 | 0;} return [0, f];}
87-
var M1 = F([0]), M2 = F([0]), _b_ = M2[1].call(null, 2);
88-
return [0, M1[1].call(null, 1), _b_];
87+
var M1 = F([0]), M2 = F([0]), a = M2[1].call(null, 2);
88+
return [0, M1[1].call(null, 1), a];
8989
}
9090
//end
9191
function test4(x){
9292
function F(symbol){
93-
function f(x){return caml_call2(Stdlib_Printf[2], _a_, x);}
93+
function f(x){return caml_call2(Stdlib_Printf[2], a, x);}
9494
return [0, f];
9595
}
9696
var M1 = F([0]), M2 = F([0]);
@@ -159,44 +159,42 @@ let%expect_test "direct calls with --effects=cps" =
159159
return raise(e$0);
160160
});
161161
return caml_exact_trampoline_cps_call
162-
(g, x, function(_t_){caml_pop_trap(); return cont();});
162+
(g, x, function(a){caml_pop_trap(); return cont();});
163163
}
164164
return caml_exact_trampoline_cps_call$0
165165
(f,
166166
function(x, cont){return cont();},
167167
7,
168-
function(_r_){
168+
function(a){
169169
return caml_exact_trampoline_cps_call$0
170170
(f,
171171
function(x, cont){
172172
return caml_trampoline_cps_call3
173173
(Stdlib[28], x, cst_a$0, cont);
174174
},
175175
cst_a,
176-
function(_s_){return cont(0);});
176+
function(a){return cont(0);});
177177
});
178178
}
179179
//end
180180
function test3(x, cont){
181181
function F(symbol){function f(x){return x + 1 | 0;} return [0, f];}
182-
var M1 = F(), M2 = F(), _q_ = M2[1].call(null, 2);
183-
return cont([0, M1[1].call(null, 1), _q_]);
182+
var M1 = F(), M2 = F(), a = M2[1].call(null, 2);
183+
return cont([0, M1[1].call(null, 1), a]);
184184
}
185185
//end
186186
function test4(x, cont){
187187
function F(symbol){
188188
function f(x, cont){
189-
return caml_trampoline_cps_call3(Stdlib_Printf[2], _o_, x, cont);
189+
return caml_trampoline_cps_call3(Stdlib_Printf[2], a, x, cont);
190190
}
191191
return [0, f];
192192
}
193193
var M1 = F(), M2 = F();
194194
return caml_exact_trampoline_cps_call
195195
(M1[1],
196196
1,
197-
function(_p_){
198-
return caml_exact_trampoline_cps_call(M2[1], 2, cont);
199-
});
197+
function(a){return caml_exact_trampoline_cps_call(M2[1], 2, cont);});
200198
}
201199
//end
202200
|}]

compiler/tests-compiler/double-translation/direct_calls.ml

Lines changed: 21 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ let%expect_test "direct calls with --effects=double-translation" =
129129
var
130130
dummy = 0,
131131
global_data = runtime.caml_get_global_data(),
132-
_z_ = [0, [4, 0, 0, 0, 0], caml_string_of_jsbytes("%d")],
132+
a = [0, [4, 0, 0, 0, 0], caml_string_of_jsbytes("%d")],
133133
cst_a$0 = caml_string_of_jsbytes("a"),
134134
cst_a = caml_string_of_jsbytes("a"),
135135
Stdlib = global_data.Stdlib,
@@ -161,46 +161,41 @@ let%expect_test "direct calls with --effects=double-translation" =
161161
return raise(e);
162162
});
163163
return caml_exact_trampoline_cps_call
164-
(g, x, function(_K_){caml_pop_trap(); return cont();});
164+
(g, x, function(a){caml_pop_trap(); return cont();});
165165
}
166166
var f = caml_cps_closure(f$0, f$1);
167167
return f;
168168
}
169-
function _h_(){return function(x){};}
170-
function _j_(){
169+
function b(){return function(x){};}
170+
function c(){
171171
return caml_cps_closure
172172
(function(x){return caml_call2(Stdlib[28], x, cst_a$0);},
173173
function(x, cont){
174174
return caml_trampoline_cps_call3(Stdlib[28], x, cst_a$0, cont);
175175
});
176176
}
177-
function test2$0(param){
178-
var f = f$0();
179-
f(_h_(), 7);
180-
f(_j_(), cst_a);
181-
return 0;
182-
}
177+
function test2$0(param){var f = f$0(); f(b(), 7); f(c(), cst_a); return 0;}
183178
function test2$1(param, cont){
184179
var f = f$0();
185180
return caml_exact_trampoline_cps_call$0
186181
(f,
187-
_h_(),
182+
b(),
188183
7,
189-
function(_I_){
184+
function(a){
190185
return caml_exact_trampoline_cps_call$0
191-
(f, _j_(), cst_a, function(_J_){return cont(0);});
186+
(f, c(), cst_a, function(a){return cont(0);});
192187
});
193188
}
194189
var test2 = caml_cps_closure(test2$0, test2$1);
195190
function test3(x){
196191
function F(symbol){function f(x){return x + 1 | 0;} return [0, f];}
197-
var M1 = F(), M2 = F(), _H_ = caml_call1(M2[1], 2);
198-
return [0, caml_call1(M1[1], 1), _H_];
192+
var M1 = F(), M2 = F(), a = caml_call1(M2[1], 2);
193+
return [0, caml_call1(M1[1], 1), a];
199194
}
200195
function f(){
201-
function f$0(x){return caml_call2(Stdlib_Printf[2], _z_, x);}
196+
function f$0(x){return caml_call2(Stdlib_Printf[2], a, x);}
202197
function f$1(x, cont){
203-
return caml_trampoline_cps_call3(Stdlib_Printf[2], _z_, x, cont);
198+
return caml_trampoline_cps_call3(Stdlib_Printf[2], a, x, cont);
204199
}
205200
var f = caml_cps_closure(f$0, f$1);
206201
return f;
@@ -216,7 +211,7 @@ let%expect_test "direct calls with --effects=double-translation" =
216211
return caml_exact_trampoline_cps_call
217212
(M1[1],
218213
1,
219-
function(_G_){
214+
function(a){
220215
return caml_exact_trampoline_cps_call(M2[1], 2, cont);
221216
});
222217
}
@@ -233,18 +228,18 @@ let%expect_test "direct calls with --effects=double-translation" =
233228
tuple = recfuncs(x),
234229
f = tuple[2],
235230
h = tuple[1],
236-
_E_ = h(100),
237-
_F_ = f(12) + _E_ | 0;
238-
return caml_call1(Stdlib[44], _F_);
231+
a = h(100),
232+
b = f(12) + a | 0;
233+
return caml_call1(Stdlib[44], b);
239234
}
240235
function g$1(x, cont){
241236
var
242237
tuple = recfuncs(x),
243238
f = tuple[2],
244239
h = tuple[1],
245-
_C_ = h(100),
246-
_D_ = f(12) + _C_ | 0;
247-
return caml_trampoline_cps_call2(Stdlib[44], _D_, cont);
240+
a = h(100),
241+
b = f(12) + a | 0;
242+
return caml_trampoline_cps_call2(Stdlib[44], b, cont);
248243
}
249244
var g = caml_cps_closure(g$0, g$1);
250245
return g;
@@ -255,9 +250,9 @@ let%expect_test "direct calls with --effects=double-translation" =
255250
return caml_exact_trampoline_cps_call
256251
(g$0,
257252
42,
258-
function(_A_){
253+
function(a){
259254
return caml_exact_trampoline_cps_call
260-
(g$0, - 5, function(_B_){return cont(0);});
255+
(g$0, - 5, function(a){return cont(0);});
261256
});
262257
}
263258
var

0 commit comments

Comments
 (0)