Skip to content

Commit a4afdf4

Browse files
committed
[refact] rename Caml_curry into Curry for cosmetic reasons (rescript-lang#281)
1 parent 9c6ac20 commit a4afdf4

File tree

136 files changed

+1808
-1781
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

136 files changed

+1808
-1781
lines changed

jscomp/js_config.ml

+45-49
Original file line numberDiff line numberDiff line change
@@ -121,54 +121,50 @@ let stdlib_set = String_set.of_list [
121121
"pervasives"
122122
]
123123

124-
let runtime_set = String_set.of_list [
125-
"caml_array";
126-
"caml_float";
127-
"caml_obj";
128-
"caml_bigarray";
129-
"caml_format";
130-
"caml_oo";
131-
"caml_int64";
132-
"caml_primitive";
133-
"caml_utils";
134-
"caml_builtin_exceptions";
135-
"caml_exceptions";
136-
"caml_curry";
137-
"caml_lexer";
138-
"caml_parser";
139-
"caml_string"
140-
(* "caml_sys"; *)
141-
(* "caml_unix"; *)
142-
(* "caml_io"; *)
143-
]
144-
145-
146-
let prim = "Caml_primitive"
147124

125+
let prim = "Caml_primitive"
148126
let builtin_exceptions = "Caml_builtin_exceptions"
149-
let exceptions = "Caml_exceptions"
150-
151-
let io = "Caml_io"
152-
153-
let sys = "Caml_sys"
154-
155-
let lexer = "Caml_lexer"
156-
let parser = "Caml_parser"
157-
let obj_runtime = "Caml_obj"
158-
159-
let array = "Caml_array"
160-
161-
let format = "Caml_format"
162-
163-
let string = "Caml_string"
164-
165-
let float = "Caml_float"
166-
let hash = "Caml_hash"
167-
let oo = "Caml_oo"
168-
let curry = "Caml_curry"
169-
let internalMod = "Caml_internalMod"
170-
let bigarray = "Caml_bigarray"
171-
let unix = "Caml_unix"
172-
let int64 = "Caml_int64"
173-
let md5 = "Caml_md5"
174-
let weak = "Caml_weak"
127+
let exceptions = "Caml_exceptions"
128+
let io = "Caml_io"
129+
let sys = "Caml_sys"
130+
let lexer = "Caml_lexer"
131+
let parser = "Caml_parser"
132+
let obj_runtime = "Caml_obj"
133+
let array = "Caml_array"
134+
let format = "Caml_format"
135+
let string = "Caml_string"
136+
let float = "Caml_float"
137+
let hash = "Caml_hash"
138+
let oo = "Caml_oo"
139+
let curry = "Curry"
140+
let internalMod = "Caml_internalMod"
141+
let bigarray = "Caml_bigarray"
142+
let unix = "Caml_unix"
143+
let int64 = "Caml_int64"
144+
let md5 = "Caml_md5"
145+
let weak = "Caml_weak"
146+
147+
let runtime_set =
148+
[
149+
prim;
150+
builtin_exceptions ;
151+
exceptions ;
152+
io ;
153+
sys ;
154+
lexer ;
155+
parser ;
156+
obj_runtime ;
157+
array ;
158+
format ;
159+
string ;
160+
float ;
161+
hash ;
162+
oo ;
163+
curry ;
164+
internalMod ;
165+
bigarray ;
166+
unix ;
167+
int64 ;
168+
md5 ;
169+
weak ] |>
170+
List.fold_left (fun acc x -> String_set.add (String.uncapitalize x) acc ) String_set.empty

jscomp/js_dump.ml

+5-3
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,8 @@ module L = struct
9393
let strict_directive = "'use strict';"
9494
let true_ = "true"
9595
let false_ = "false"
96-
let curry = "app" (* curry arbitrary args *)
96+
let app = Literals.app (* curry arbitrary args *)
97+
let app_array = Literals.app_array
9798
let tag = "tag"
9899
let bind = "bind"
99100
let math = "Math"
@@ -487,12 +488,13 @@ and
487488
let len = List.length el in
488489
if 1 <= len && len <= 8 then
489490
begin
490-
P.string f (Printf.sprintf "app%d" len);
491+
P.string f L.app;
492+
P.string f (Printf.sprintf "%d" len);
491493
P.paren_group f 1 (fun _ -> arguments cxt f (e::el))
492494
end
493495
else
494496
begin
495-
P.string f L.curry;
497+
P.string f L.app_array;
496498
P.paren_group f 1 (fun _ -> arguments cxt f [ e ; E.arr Mutable el])
497499
end)
498500
in

jscomp/js_exp_make.ml

+2-2
Original file line numberDiff line numberDiff line change
@@ -778,10 +778,10 @@ let public_method_call meth_name obj label cache args =
778778
*)
779779
else if len <=8 then
780780
let len_str = string_of_int len in
781-
runtime_call Js_config.curry ("app"^len_str)
781+
runtime_call Js_config.curry (Literals.app ^len_str)
782782
(fn :: args)
783783
else
784-
runtime_call Js_config.curry "app"
784+
runtime_call Js_config.curry Literals.app_array
785785
[fn ; arr NA args ]
786786
)
787787

jscomp/js_output.mli

+7-2
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,15 @@ val dummy : t
5757

5858

5959
val handle_name_tail :
60-
Lam_compile_defs.st -> Lam_compile_defs.return_type -> Lambda.lambda -> J.expression -> t
60+
Lam_compile_defs.st ->
61+
Lam_compile_defs.return_type ->
62+
Lambda.lambda -> J.expression -> t
6163

6264
val handle_block_return :
63-
Lam_compile_defs.st -> Lam_compile_defs.return_type -> Lambda.lambda -> J.block -> J.expression -> t
65+
Lam_compile_defs.st ->
66+
Lam_compile_defs.return_type ->
67+
Lambda.lambda ->
68+
J.block -> J.expression -> t
6469

6570
val concat : t list -> t
6671

jscomp/js_program_loader.ml

+3-2
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@ let string_of_module_id (x : Lam_module_ident.t) : string =
5555
"./stdlib/" ^ Filename.chop_extension target
5656
| AmdJS
5757
| NodeJS ->
58-
if Ext_string.starts_with id.name "Caml_" then
58+
let filename = String.uncapitalize id.name in
59+
if String_set.mem filename Js_config.runtime_set then
5960
let path =
6061
(* For the runtime, only [JS] files are needed, and
6162
unlike the stdlib, [bsc] have some pre-built knowledge
@@ -69,7 +70,7 @@ let string_of_module_id (x : Lam_module_ident.t) : string =
6970
"runtime"
7071
| f -> f in
7172
Ext_filename.node_relative_path !Location.input_name
72-
(Filename.concat path (String.uncapitalize id.name))
73+
(Filename.concat path filename)
7374
else
7475
begin match Config_util.find file with
7576
(* for some primitive files, no cmj support *)

jscomp/lib/Makefile

+2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ CAMLC=../bin/bsc
55
SOURCE_LIST := $(shell cat lib.mllib)
66

77
RUNTIME := $(addsuffix .cmj, $(SOURCE_LIST))
8+
9+
INCLUDES := -I ../runtime
810
# COMPFLAGS += -js-module goog:buckle.js
911

1012
$(RUNTIME): $(CAMLC)

jscomp/lib/bench.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
// Generated CODE, PLEASE EDIT WITH CARE
22
'use strict';
33

4-
var Bench = require("benchmark");
5-
var Caml_curry = require("../runtime/caml_curry");
4+
var Bench = require("benchmark");
5+
var Curry = require("../runtime/curry");
66

77
var suite = new Bench.Suite();
88

@@ -14,22 +14,22 @@ suite.add("first", function () {
1414
}
1515
});
1616

17-
Caml_curry.app3(suite.add.bind(suite), "second", function () {
17+
Curry._3(suite.add.bind(suite), "second", function () {
1818
return /* () */0;
1919
}, {
2020
"onComplete": function () {
2121
return /* () */0;
2222
}
2323
});
2424

25-
Caml_curry.app2(suite.on.bind(suite), "complete", function () {
25+
Curry._2(suite.on.bind(suite), "complete", function () {
2626
for(var i = 0 ,i_finish = suite.length - 1 | 0; i<= i_finish; ++i){
2727
console.log(suite[i]);
2828
}
2929
return /* () */0;
3030
});
3131

32-
Caml_curry.app1(suite.run.bind(suite), /* () */0);
32+
Curry._1(suite.run.bind(suite), /* () */0);
3333

3434
exports.suite = suite;
3535
/* suite Not a pure module */

jscomp/literals.ml

+7
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,10 @@ let partial_arg = "partial_arg"
3232
let tmp = "tmp"
3333

3434
let create = "create" (* {!Caml_exceptions.create}*)
35+
36+
let app = "_"
37+
let app_array = "app" (* arguments are an array*)
38+
39+
let runtime = "runtime" (* runtime directory *)
40+
41+
let stdlib = "stdlib"

jscomp/literals.mli

+6
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,9 @@ val prim : string
3333
val tmp : string
3434

3535
val create : string
36+
37+
val app : string
38+
val app_array : string
39+
40+
val runtime : string
41+
val stdlib : string

jscomp/runtime/.depend

+4-4
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@ caml_bigarray.cmo : caml_bigarray.cmi
2222
caml_bigarray.cmx : caml_bigarray.cmi
2323
caml_builtin_exceptions.cmo : caml_builtin_exceptions.cmi
2424
caml_builtin_exceptions.cmx : caml_builtin_exceptions.cmi
25-
caml_curry.cmo : js.cmo caml_oo.cmi
26-
caml_curry.cmx : js.cmx caml_oo.cmx
2725
caml_exceptions.cmo : caml_builtin_exceptions.cmi caml_exceptions.cmi
2826
caml_exceptions.cmx : caml_builtin_exceptions.cmx caml_exceptions.cmi
2927
caml_float.cmo : typed_array.cmo js.cmo caml_float.cmi
@@ -56,6 +54,8 @@ caml_sys.cmo : js.cmo caml_sys.cmi
5654
caml_sys.cmx : js.cmx caml_sys.cmi
5755
caml_utils.cmo : caml_utils.cmi
5856
caml_utils.cmx : caml_utils.cmi
57+
curry.cmo : js.cmo caml_oo.cmi
58+
curry.cmx : js.cmx caml_oo.cmx
5959
fn.cmo :
6060
fn.cmx :
6161
js.cmo :
@@ -70,8 +70,6 @@ caml_bigarray.cmo : caml_bigarray.cmi
7070
caml_bigarray.cmj : caml_bigarray.cmi
7171
caml_builtin_exceptions.cmo : caml_builtin_exceptions.cmi
7272
caml_builtin_exceptions.cmj : caml_builtin_exceptions.cmi
73-
caml_curry.cmo : js.cmo caml_oo.cmi
74-
caml_curry.cmj : js.cmj caml_oo.cmj
7573
caml_exceptions.cmo : caml_builtin_exceptions.cmi caml_exceptions.cmi
7674
caml_exceptions.cmj : caml_builtin_exceptions.cmj caml_exceptions.cmi
7775
caml_float.cmo : typed_array.cmo js.cmo caml_float.cmi
@@ -104,6 +102,8 @@ caml_sys.cmo : js.cmo caml_sys.cmi
104102
caml_sys.cmj : js.cmj caml_sys.cmi
105103
caml_utils.cmo : caml_utils.cmi
106104
caml_utils.cmj : caml_utils.cmi
105+
curry.cmo : js.cmo caml_oo.cmi
106+
curry.cmj : js.cmj caml_oo.cmj
107107
fn.cmo :
108108
fn.cmj :
109109
js.cmo :

jscomp/runtime/caml_format.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33

44
var Caml_int64 = require("./caml_int64");
55
var Caml_builtin_exceptions = require("./caml_builtin_exceptions");
6+
var Curry = require("./curry");
67
var Caml_primitive = require("./caml_primitive");
78
var Caml_utils = require("./caml_utils");
8-
var Caml_curry = require("./caml_curry");
99
var Caml_string = require("./caml_string");
1010

1111
function caml_failwith(s) {
@@ -822,7 +822,7 @@ var float_of_string = (
822822
);
823823

824824
function caml_float_of_string(s) {
825-
return Caml_curry.app2(float_of_string, s, caml_failwith);
825+
return Curry._2(float_of_string, s, caml_failwith);
826826
}
827827

828828
var caml_nativeint_format = caml_format_int;

jscomp/runtime/caml_io.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
'use strict';
33

44
var Caml_builtin_exceptions = require("./caml_builtin_exceptions");
5-
var Caml_curry = require("./caml_curry");
5+
var Curry = require("./curry");
66

77
var stdin = undefined;
88

@@ -55,7 +55,7 @@ function caml_ml_open_descriptor_out() {
5555

5656
function caml_ml_flush(oc) {
5757
if (oc[/* buffer */0] !== "") {
58-
Caml_curry.app2(oc[/* output */1], oc, oc[/* buffer */0]);
58+
Curry._2(oc[/* output */1], oc, oc[/* buffer */0]);
5959
oc[/* buffer */0] = "";
6060
return /* () */0;
6161
}

0 commit comments

Comments
 (0)