Skip to content

Commit 85f1962

Browse files
committedNov 20, 2017
clean up
1 parent 361a7a9 commit 85f1962

7 files changed

+88
-19
lines changed
 

‎jscomp/others/js_mapperRt.ml

+24-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,27 @@
1-
1+
(* Copyright (C) 2017 Authors of BuckleScript
2+
*
3+
* This program is free software: you can redistribute it and/or modify
4+
* it under the terms of the GNU Lesser General Public License as published by
5+
* the Free Software Foundation, either version 3 of the License, or
6+
* (at your option) any later version.
7+
*
8+
* In addition to the permissions granted to you by the LGPL, you may combine
9+
* or link a "work that uses the Library" with a publicly distributed version
10+
* of this file to produce a combined library or application, then distribute
11+
* that combined work under the terms of your choosing, with no requirement
12+
* to comply with the obligations normally placed on you by section 4 of the
13+
* LGPL version 3 (or the corresponding section of a later version of the LGPL
14+
* should you choose to use a later version).
15+
*
16+
* This program is distributed in the hope that it will be useful,
17+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
18+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19+
* GNU Lesser General Public License for more details.
20+
*
21+
* You should have received a copy of the GNU Lesser General Public License
22+
* along with this program; if not, write to the Free Software
23+
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *)
24+
225

326
let rec searchAux i (xs : (int * _) array) (k : int) =
427
let (a,b) = Array.unsafe_get xs i in

‎jscomp/syntax/ast_derive_js_mapper.ml

+13-4
Original file line numberDiff line numberDiff line change
@@ -68,31 +68,40 @@ let (&&~) a b =
6868
app2 (Exp.ident {loc = noloc; txt = Ldot(Lident "Pervasives","&&")})
6969
a b
7070

71+
let jsMapperRt =
72+
Longident.Ldot (Lident "Js", "MapperRt")
73+
7174
let search polyvar array =
7275
app2
7376
(Exp.ident ({loc = noloc;
74-
txt = Longident.parse "Js.MapperRt.search" })
77+
txt = Longident.Ldot (jsMapperRt,"search") })
7578
)
7679
(eraseType polyvar)
7780
array
7881

7982
let revSearch len constantArray exp =
8083
eraseType
8184
(app3
82-
(Exp.ident {loc= noloc; txt = Longident.parse "Js.MapperRt.revSearch"})
85+
(Exp.ident
86+
{loc= noloc;
87+
txt = Longident.Ldot (jsMapperRt, "revSearch")})
8388
len
8489
constantArray
8590
exp)
8691

8792
let toInt exp array =
8893
app2
89-
(Exp.ident {loc=noloc; txt = Longident.parse "Js.MapperRt.toInt"})
94+
(Exp.ident
95+
{ loc=noloc;
96+
txt = Longident.Ldot (jsMapperRt, "toInt")})
9097
(eraseType exp)
9198
array
9299
let fromInt len array exp =
93100
eraseType
94101
(app3
95-
(Exp.ident {loc = noloc; txt = Longident.parse "Js.MapperRt.fromInt"})
102+
(Exp.ident
103+
{loc = noloc;
104+
txt = Longident.Ldot (jsMapperRt,"fromInt")})
96105
len
97106
array
98107
exp)

‎jscomp/test/ast_js_mapper_poly_test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ if (!(
157157
Caml_builtin_exceptions.assert_failure,
158158
[
159159
"ast_js_mapper_poly_test.ml",
160-
71,
160+
81,
161161
3
162162
]
163163
];

‎jscomp/test/ast_js_mapper_poly_test.ml

+11-1
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,21 @@
11

2+
(* let suites : Mt.pair_suites ref = ref []
3+
let test_id = ref 0
4+
let eq loc x y =
5+
incr test_id ;
6+
suites :=
7+
(loc ^" id " ^ (string_of_int !test_id), (fun _ -> Mt.Eq(x,y))) :: !suites *)
8+
9+
210
type u =
311
[ `D
412
| `C
513
| `f [@bs.as "x"]
614
]
715
[@@bs.deriving jsMapper]
816

9-
17+
(* let eqU (x : u) (y : u) = x = y *)
18+
(* let f x = x = `D *)
1019

1120
let (-~) f v =
1221
match v with
@@ -29,6 +38,7 @@ type v =
2938
| A3
3039
[@@bs.deriving jsMapper]
3140

41+
(* let eqV (x : v) (y : v) = x = y *)
3242
let s = function
3343
| A0 -> "A0"
3444
| A1 -> "A1"

‎lib/bsdep.ml

+13-4
Original file line numberDiff line numberDiff line change
@@ -30896,31 +30896,40 @@ let (&&~) a b =
3089630896
app2 (Exp.ident {loc = noloc; txt = Ldot(Lident "Pervasives","&&")})
3089730897
a b
3089830898

30899+
let jsMapperRt =
30900+
Longident.Ldot (Lident "Js", "MapperRt")
30901+
3089930902
let search polyvar array =
3090030903
app2
3090130904
(Exp.ident ({loc = noloc;
30902-
txt = Longident.parse "Js.MapperRt.search" })
30905+
txt = Longident.Ldot (jsMapperRt,"search") })
3090330906
)
3090430907
(eraseType polyvar)
3090530908
array
3090630909

3090730910
let revSearch len constantArray exp =
3090830911
eraseType
3090930912
(app3
30910-
(Exp.ident {loc= noloc; txt = Longident.parse "Js.MapperRt.revSearch"})
30913+
(Exp.ident
30914+
{loc= noloc;
30915+
txt = Longident.Ldot (jsMapperRt, "revSearch")})
3091130916
len
3091230917
constantArray
3091330918
exp)
3091430919

3091530920
let toInt exp array =
3091630921
app2
30917-
(Exp.ident {loc=noloc; txt = Longident.parse "Js.MapperRt.toInt"})
30922+
(Exp.ident
30923+
{ loc=noloc;
30924+
txt = Longident.Ldot (jsMapperRt, "toInt")})
3091830925
(eraseType exp)
3091930926
array
3092030927
let fromInt len array exp =
3092130928
eraseType
3092230929
(app3
30923-
(Exp.ident {loc = noloc; txt = Longident.parse "Js.MapperRt.fromInt"})
30930+
(Exp.ident
30931+
{loc = noloc;
30932+
txt = Longident.Ldot (jsMapperRt,"fromInt")})
3092430933
len
3092530934
array
3092630935
exp)

‎lib/bsppx.ml

+13-4
Original file line numberDiff line numberDiff line change
@@ -12844,31 +12844,40 @@ let (&&~) a b =
1284412844
app2 (Exp.ident {loc = noloc; txt = Ldot(Lident "Pervasives","&&")})
1284512845
a b
1284612846

12847+
let jsMapperRt =
12848+
Longident.Ldot (Lident "Js", "MapperRt")
12849+
1284712850
let search polyvar array =
1284812851
app2
1284912852
(Exp.ident ({loc = noloc;
12850-
txt = Longident.parse "Js.MapperRt.search" })
12853+
txt = Longident.Ldot (jsMapperRt,"search") })
1285112854
)
1285212855
(eraseType polyvar)
1285312856
array
1285412857

1285512858
let revSearch len constantArray exp =
1285612859
eraseType
1285712860
(app3
12858-
(Exp.ident {loc= noloc; txt = Longident.parse "Js.MapperRt.revSearch"})
12861+
(Exp.ident
12862+
{loc= noloc;
12863+
txt = Longident.Ldot (jsMapperRt, "revSearch")})
1285912864
len
1286012865
constantArray
1286112866
exp)
1286212867

1286312868
let toInt exp array =
1286412869
app2
12865-
(Exp.ident {loc=noloc; txt = Longident.parse "Js.MapperRt.toInt"})
12870+
(Exp.ident
12871+
{ loc=noloc;
12872+
txt = Longident.Ldot (jsMapperRt, "toInt")})
1286612873
(eraseType exp)
1286712874
array
1286812875
let fromInt len array exp =
1286912876
eraseType
1287012877
(app3
12871-
(Exp.ident {loc = noloc; txt = Longident.parse "Js.MapperRt.fromInt"})
12878+
(Exp.ident
12879+
{loc = noloc;
12880+
txt = Longident.Ldot (jsMapperRt,"fromInt")})
1287212881
len
1287312882
array
1287412883
exp)

‎lib/whole_compiler.ml

+13-4
Original file line numberDiff line numberDiff line change
@@ -105655,31 +105655,40 @@ let (&&~) a b =
105655105655
app2 (Exp.ident {loc = noloc; txt = Ldot(Lident "Pervasives","&&")})
105656105656
a b
105657105657

105658+
let jsMapperRt =
105659+
Longident.Ldot (Lident "Js", "MapperRt")
105660+
105658105661
let search polyvar array =
105659105662
app2
105660105663
(Exp.ident ({loc = noloc;
105661-
txt = Longident.parse "Js.MapperRt.search" })
105664+
txt = Longident.Ldot (jsMapperRt,"search") })
105662105665
)
105663105666
(eraseType polyvar)
105664105667
array
105665105668

105666105669
let revSearch len constantArray exp =
105667105670
eraseType
105668105671
(app3
105669-
(Exp.ident {loc= noloc; txt = Longident.parse "Js.MapperRt.revSearch"})
105672+
(Exp.ident
105673+
{loc= noloc;
105674+
txt = Longident.Ldot (jsMapperRt, "revSearch")})
105670105675
len
105671105676
constantArray
105672105677
exp)
105673105678

105674105679
let toInt exp array =
105675105680
app2
105676-
(Exp.ident {loc=noloc; txt = Longident.parse "Js.MapperRt.toInt"})
105681+
(Exp.ident
105682+
{ loc=noloc;
105683+
txt = Longident.Ldot (jsMapperRt, "toInt")})
105677105684
(eraseType exp)
105678105685
array
105679105686
let fromInt len array exp =
105680105687
eraseType
105681105688
(app3
105682-
(Exp.ident {loc = noloc; txt = Longident.parse "Js.MapperRt.fromInt"})
105689+
(Exp.ident
105690+
{loc = noloc;
105691+
txt = Longident.Ldot (jsMapperRt,"fromInt")})
105683105692
len
105684105693
array
105685105694
exp)

0 commit comments

Comments
 (0)
Please sign in to comment.