Skip to content

Commit a54a86a

Browse files
committed
Update 4.06 branch
1 parent e605618 commit a54a86a

18 files changed

+3626
-5404
lines changed

jscomp/core/lam_compile.ml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,11 +93,20 @@ type default_case =
9393
let no_effects_const = lazy true
9494
let has_effects_const = lazy false
9595

96+
let is_nullary_variant x =
97+
match x with
98+
#if OCAML_VERSION =~ ">4.03.0" then
99+
| Types.Cstr_tuple [] -> true
100+
#else
101+
| [] -> true
102+
#end
103+
| _ -> false
104+
96105
let names_from_construct_pattern (pat: Typedtree.pattern) =
97106
let names_from_type_variant cstrs =
98107
let (consts, blocks) = List.fold_left
99108
(fun (consts, blocks) cstr ->
100-
if cstr.Types.cd_args = []
109+
if is_nullary_variant cstr.Types.cd_args
101110
then (Ident.name cstr.Types.cd_id :: consts, blocks)
102111
else (consts, Ident.name cstr.Types.cd_id :: blocks))
103112
([], []) cstrs in

jscomp/core/lam_print.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ let primitive ppf (prim : Lam_primitive.t) = match prim with
151151
| Pmakeblock(tag, _, Mutable) -> fprintf ppf "makemutable %i" tag
152152
| Pfield (n, (Fld_module s | Fld_record s))
153153
-> fprintf ppf "field %s/%i" s n
154-
| Pfield (n, Fld_na)
154+
| Pfield (n, _)
155155
-> fprintf ppf "field %i" n
156156
| Pfield_computed ->
157157
fprintf ppf "field_computed"

jscomp/syntax/ast_exp_apply.ml

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,15 @@ let app_exp_mapper
167167
|
168168
{pexp_desc =
169169
(Pexp_ident {txt = Lident name;_ }
170-
| Pexp_constant (Const_string(name,None)))
170+
171+
| Pexp_constant (
172+
#if OCAML_VERSION =~ "<4.03.0" then
173+
Const_string
174+
#else
175+
Pconst_string
176+
#end
177+
(name,None))
178+
)
171179
;
172180
pexp_loc}
173181
(* f##paint *)
@@ -197,7 +205,13 @@ let app_exp_mapper
197205
| Some { args = [obj; {
198206
pexp_desc =
199207
Pexp_ident {txt = Lident name}
200-
| Pexp_constant (Const_string (name, None)); pexp_loc
208+
| Pexp_constant (
209+
#if OCAML_VERSION =~ "<4.03.0" then
210+
Const_string
211+
#else
212+
Pconst_string
213+
#end
214+
(name, None)); pexp_loc
201215
}
202216
]
203217
}

0 commit comments

Comments
 (0)