File tree 5 files changed +20
-6
lines changed
5 files changed +20
-6
lines changed Original file line number Diff line number Diff line change @@ -91,7 +91,9 @@ let caml_sys_get_argv () : string * string array =
91
91
match [% external process] with
92
92
| None -> (" " ,[|" " |])
93
93
| Some process
94
- -> Array. unsafe_get process##argv 0 , process##argv
94
+ ->
95
+ if Js. testAny process##argv then (" " ,[|" " |])
96
+ else Array. unsafe_get process##argv 0 , process##argv
95
97
96
98
(* * {!Pervasives.sys_exit} *)
97
99
let caml_sys_exit exit_code =
Original file line number Diff line number Diff line change @@ -63,6 +63,7 @@ type + 'a null_undefined = 'a nullable
63
63
64
64
external toOption : 'a nullable -> 'a option = " #null_undefined_to_opt"
65
65
external test : 'a nullable -> bool = " #is_nil_undef"
66
+ external testAny : 'a -> bool = " #is_nil_undef"
66
67
67
68
type boolean
68
69
(* * The JS boolean type, can be [Js.true_] or [Js.false_] *)
Original file line number Diff line number Diff line change @@ -76,6 +76,9 @@ type + 'a null_undefined = 'a nullable
76
76
external toOption : 'a nullable -> 'a option = " #null_undefined_to_opt"
77
77
external test : 'a nullable -> bool = " #is_nil_undef"
78
78
79
+ (* * The same as {!test} except that it is more permissive on the types of input *)
80
+ external testAny : 'a -> bool = " #is_nil_undef"
81
+
79
82
type boolean
80
83
(* * The value could be either {!Js.true_} or {!Js.false_}.
81
84
Note in BuckleScript, [boolean] has different representation from OCaml's [bool],
Original file line number Diff line number Diff line change @@ -198,7 +198,8 @@ OTHERS := test_literals a test_ari test_export2 test_internalOO test_obj_simple_
198
198
escape_esmodule\
199
199
esmodule_ref\
200
200
miss_colon_test\
201
- gpr_1245_test
201
+ gpr_1245_test\
202
+ gpr_2126_test
202
203
# bs_uncurry_test
203
204
# needs Lam to get rid of Uncurry arity first
204
205
Original file line number Diff line number Diff line change @@ -45,10 +45,17 @@ function caml_sys_getcwd() {
45
45
function caml_sys_get_argv ( ) {
46
46
var match = typeof ( process ) === "undefined" ? undefined : ( process ) ;
47
47
if ( match !== undefined ) {
48
- return /* tuple */ [
49
- match . argv [ 0 ] ,
50
- match . argv
51
- ] ;
48
+ if ( match . argv == null ) {
49
+ return /* tuple */ [
50
+ "" ,
51
+ /* array */ [ "" ]
52
+ ] ;
53
+ } else {
54
+ return /* tuple */ [
55
+ match . argv [ 0 ] ,
56
+ match . argv
57
+ ] ;
58
+ }
52
59
} else {
53
60
return /* tuple */ [
54
61
"" ,
You can’t perform that action at this time.
0 commit comments