File tree Expand file tree Collapse file tree 9 files changed +164
-52
lines changed Expand file tree Collapse file tree 9 files changed +164
-52
lines changed Original file line number Diff line number Diff line change @@ -70962,6 +70962,23 @@ let rec eq_expression
70962
70962
p0 = p1 && b0 = b1 && eq_expression e0 e1
70963
70963
| _ -> false
70964
70964
end
70965
+ | Dump (l0,es0) ->
70966
+ begin match y0 with
70967
+ | Dump(l1,es1) ->
70968
+ l0 = l1 && eq_expression_list es0 es1
70969
+ | _ -> false
70970
+ end
70971
+ | Seq (a0,b0) ->
70972
+ begin match y0 with
70973
+ | Seq(a1,b1) ->
70974
+ eq_expression a0 a1 && eq_expression b0 b1
70975
+ | _ -> false
70976
+ end
70977
+ | Bool a0 ->
70978
+ begin match y0 with
70979
+ | Bool b0 -> a0 = b0
70980
+ | _ -> false
70981
+ end
70965
70982
| Length _
70966
70983
| Char_of_int _
70967
70984
| Char_to_int _
@@ -70972,15 +70989,15 @@ let rec eq_expression
70972
70989
| String_append _
70973
70990
| Int_of_boolean _
70974
70991
| Anything_to_number _
70975
- | Bool _
70992
+
70976
70993
| Typeof _
70977
70994
| Caml_not _
70978
70995
| Js_not _
70979
70996
| String_of_small_int_array _
70980
70997
| Json_stringify _
70981
70998
| Anything_to_string _
70982
- | Dump _
70983
- | Seq _
70999
+
71000
+
70984
71001
| Cond _
70985
71002
| FlatCall _
70986
71003
| Bind _
@@ -71010,13 +71027,49 @@ and eq_expression_list xs ys =
71010
71027
| x::xs, y::ys -> eq_expression x y && aux xs ys
71011
71028
in
71012
71029
aux xs ys
71013
-
71014
- and eq_statement (x : J.statement) (y : J.statement) =
71015
- match x.statement_desc, y.statement_desc with
71016
- | Exp a, Exp b
71017
- | Return { return_value = a ; _} , Return { return_value = b; _} ->
71018
- eq_expression a b
71019
- | _, _ ->
71030
+ and eq_statement_list xs ys =
71031
+ let rec aux xs ys =
71032
+ match xs,ys with
71033
+ | [], [] -> true
71034
+ | [], _ -> false
71035
+ | _ , [] -> false
71036
+ | x::xs, y::ys -> eq_statement x y && aux xs ys
71037
+ in
71038
+ aux xs ys
71039
+ and eq_statement
71040
+ ({statement_desc = x0} : J.statement)
71041
+ ({statement_desc = y0} : J.statement) =
71042
+ match x0 with
71043
+ | Exp a ->
71044
+ begin match y0 with
71045
+ | Exp b -> eq_expression a b
71046
+ | _ -> false
71047
+ end
71048
+ | Return { return_value = a ; _} ->
71049
+ begin match y0 with
71050
+ | Return { return_value = b; _} ->
71051
+ eq_expression a b
71052
+ | _ -> false
71053
+ end
71054
+ | Debugger -> y0 = Debugger
71055
+ | Break -> y0 = Break
71056
+ | Block xs0 ->
71057
+ begin match y0 with
71058
+ | Block ys0 ->
71059
+ eq_statement_list xs0 ys0
71060
+ | _ -> false
71061
+ end
71062
+ | Variable _
71063
+ | If _
71064
+ | While _
71065
+ | ForRange _
71066
+ | Continue _
71067
+
71068
+ | Int_switch _
71069
+ | String_switch _
71070
+ | Throw _
71071
+ | Try _
71072
+ ->
71020
71073
false
71021
71074
71022
71075
let rev_flatten_seq (x : J.expression) =
Original file line number Diff line number Diff line change @@ -246,6 +246,23 @@ let rec eq_expression
246
246
p0 = p1 && b0 = b1 && eq_expression e0 e1
247
247
| _ -> false
248
248
end
249
+ | Dump (l0 ,es0 ) ->
250
+ begin match y0 with
251
+ | Dump (l1 ,es1 ) ->
252
+ l0 = l1 && eq_expression_list es0 es1
253
+ | _ -> false
254
+ end
255
+ | Seq (a0 ,b0 ) ->
256
+ begin match y0 with
257
+ | Seq (a1 ,b1 ) ->
258
+ eq_expression a0 a1 && eq_expression b0 b1
259
+ | _ -> false
260
+ end
261
+ | Bool a0 ->
262
+ begin match y0 with
263
+ | Bool b0 -> a0 = b0
264
+ | _ -> false
265
+ end
249
266
| Length _
250
267
| Char_of_int _
251
268
| Char_to_int _
@@ -256,15 +273,15 @@ let rec eq_expression
256
273
| String_append _
257
274
| Int_of_boolean _
258
275
| Anything_to_number _
259
- | Bool _
276
+
260
277
| Typeof _
261
278
| Caml_not _
262
279
| Js_not _
263
280
| String_of_small_int_array _
264
281
| Json_stringify _
265
282
| Anything_to_string _
266
- | Dump _
267
- | Seq _
283
+
284
+
268
285
| Cond _
269
286
| FlatCall _
270
287
| Bind _
@@ -294,13 +311,49 @@ and eq_expression_list xs ys =
294
311
| x ::xs , y ::ys -> eq_expression x y && aux xs ys
295
312
in
296
313
aux xs ys
297
-
298
- and eq_statement (x : J.statement ) (y : J.statement ) =
299
- match x.statement_desc, y.statement_desc with
300
- | Exp a, Exp b
301
- | Return { return_value = a ; _} , Return { return_value = b ; _} ->
302
- eq_expression a b
303
- | _ , _ ->
314
+ and eq_statement_list xs ys =
315
+ let rec aux xs ys =
316
+ match xs,ys with
317
+ | [] , [] -> true
318
+ | [] , _ -> false
319
+ | _ , [] -> false
320
+ | x ::xs , y ::ys -> eq_statement x y && aux xs ys
321
+ in
322
+ aux xs ys
323
+ and eq_statement
324
+ ({statement_desc = x0 } : J.statement )
325
+ ({statement_desc = y0 } : J.statement ) =
326
+ match x0 with
327
+ | Exp a ->
328
+ begin match y0 with
329
+ | Exp b -> eq_expression a b
330
+ | _ -> false
331
+ end
332
+ | Return { return_value = a ; _} ->
333
+ begin match y0 with
334
+ | Return { return_value = b ; _} ->
335
+ eq_expression a b
336
+ | _ -> false
337
+ end
338
+ | Debugger -> y0 = Debugger
339
+ | Break -> y0 = Break
340
+ | Block xs0 ->
341
+ begin match y0 with
342
+ | Block ys0 ->
343
+ eq_statement_list xs0 ys0
344
+ | _ -> false
345
+ end
346
+ | Variable _
347
+ | If _
348
+ | While _
349
+ | ForRange _
350
+ | Continue _
351
+
352
+ | Int_switch _
353
+ | String_switch _
354
+ | Throw _
355
+ | Try _
356
+ ->
304
357
false
305
358
306
359
let rev_flatten_seq (x : J.expression ) =
Original file line number Diff line number Diff line change @@ -244,7 +244,7 @@ gpr_1760_test.cmj : mt.cmj ../stdlib/int64.cmj ../stdlib/int32.cmj
244
244
gpr_1762_test.cmj : mt.cmj
245
245
gpr_1817_test.cmj : mt.cmj ../runtime/js.cmj
246
246
gpr_1822_test.cmj : mt.cmj
247
- gpr_1891_test.cmj :
247
+ gpr_1891_test.cmj : ../runtime/js.cmj
248
248
gpr_405_test.cmj : ../stdlib/hashtbl.cmj gpr_405_test.cmi
249
249
gpr_441.cmj :
250
250
gpr_459_test.cmj : mt.cmj
Original file line number Diff line number Diff line change 1
1
'use strict' ;
2
2
3
+ var Curry = require ( "../../lib/js/curry.js" ) ;
3
4
4
5
function foo ( x ) {
5
- if ( typeof x === "number" ) {
6
- console . log ( "2" ) ;
7
- return /* () */ 0 ;
8
- } else if ( x [ 0 ] !== 3505894 ) {
9
- console . log ( "2" ) ;
10
- return /* () */ 0 ;
11
- } else if ( x [ 1 ] !== 3 ) {
6
+ if ( typeof x === "number" || x [ 0 ] !== 3505894 || x [ 1 ] !== 3 ) {
12
7
console . log ( "2" ) ;
13
8
return /* () */ 0 ;
14
9
} else {
@@ -33,7 +28,27 @@ function foo3(x) {
33
28
}
34
29
}
35
30
31
+ function foo4 ( x , h ) {
32
+ if ( typeof x === "number" || x [ 0 ] !== 3505894 || x [ 1 ] !== 3 ) {
33
+ return /* () */ 0 ;
34
+ } else {
35
+ return Curry . _1 ( h , /* () */ 0 ) ;
36
+ }
37
+ }
38
+
39
+ function foo5 ( x ) {
40
+ if ( typeof x === "number" || x [ 0 ] !== 3505894 || x [ 1 ] !== 3 ) {
41
+ console . log ( "x" ) ;
42
+ return /* () */ 0 ;
43
+ } else {
44
+ console . log ( "hi" ) ;
45
+ return /* () */ 0 ;
46
+ }
47
+ }
48
+
36
49
exports . foo = foo ;
37
50
exports . foo2 = foo2 ;
38
51
exports . foo3 = foo3 ;
52
+ exports . foo4 = foo4 ;
53
+ exports . foo5 = foo5 ;
39
54
/* No side effect */
Original file line number Diff line number Diff line change @@ -20,4 +20,12 @@ let foo3 x =
20
20
21
21
22
22
23
-
23
+ let foo4 x h =
24
+ match x with
25
+ | `Foo 3 -> h ()
26
+ | _ -> ()
27
+
28
+ let foo5 x =
29
+ match x with
30
+ | `Foo 3 -> Js. log " hi"
31
+ | _ -> Js. log " x"
Original file line number Diff line number Diff line change @@ -12024,10 +12024,7 @@ function components_of_module_maker(param) {
12024
12024
pos[0]
12025
12025
], c[/* comp_values */0]);
12026
12026
var match = decl[/* val_kind */1];
12027
- if (typeof match === "number") {
12028
- pos[0] = pos[0] + 1 | 0;
12029
- return /* () */0;
12030
- } else if (match.tag) {
12027
+ if (typeof match === "number" || match.tag) {
12031
12028
pos[0] = pos[0] + 1 | 0;
12032
12029
return /* () */0;
12033
12030
} else {
Original file line number Diff line number Diff line change @@ -48,11 +48,7 @@ function f3(x) {
48
48
var v = 0 ;
49
49
var y ;
50
50
v = 1 ;
51
- if ( x . tag ) {
52
- y = 4 ;
53
- } else {
54
- y = 3 ;
55
- }
51
+ y = x . tag ? 4 : 3 ;
56
52
return y + 32 | 0 ;
57
53
}
58
54
Original file line number Diff line number Diff line change @@ -8,12 +8,8 @@ if (match !== undefined) {
8
8
var match$1 = typeof ( module ) === "undefined" ? undefined : ( module ) ;
9
9
var match$2 = match . main ;
10
10
if ( match$1 !== undefined ) {
11
- if ( match$2 !== undefined ) {
12
- if ( match$1 === match$2 ) {
13
- console . log ( "is main" ) ;
14
- } else {
15
- console . log ( "not main" ) ;
16
- }
11
+ if ( match$2 !== undefined && match$1 === match$2 ) {
12
+ console . log ( "is main" ) ;
17
13
} else {
18
14
console . log ( "not main" ) ;
19
15
}
Original file line number Diff line number Diff line change @@ -484,14 +484,8 @@ function make_lexer(keywords) {
484
484
var match = Stream . peek ( strm__ ) ;
485
485
if ( match ) {
486
486
var c = match [ 0 ] ;
487
- if ( c !== 43 ) {
488
- if ( c !== 45 ) {
489
- return end_exponent_part ( strm__ ) ;
490
- } else {
491
- Stream . junk ( strm__ ) ;
492
- store ( c ) ;
493
- return end_exponent_part ( strm__ ) ;
494
- }
487
+ if ( c !== 43 && c !== 45 ) {
488
+ return end_exponent_part ( strm__ ) ;
495
489
} else {
496
490
Stream . junk ( strm__ ) ;
497
491
store ( c ) ;
You can’t perform that action at this time.
0 commit comments