Skip to content

Commit 8f876ac

Browse files
committed
small tweaks to support jsType with default
1 parent 2f397fc commit 8f876ac

File tree

5 files changed

+49
-9
lines changed

5 files changed

+49
-9
lines changed

Diff for: jscomp/syntax/ast_derive_js_mapper.ml

+12-2
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,18 @@ let handle_config (config : Parsetree.expression option) =
4646
| Pexp_record (
4747
[
4848
{txt = Lident "jsType"},
49-
{pexp_desc = Pexp_construct ({txt = Lident ("true" | "false" as x )}, None)}],None)
50-
-> x = "true"
49+
{pexp_desc =
50+
(Pexp_construct
51+
(
52+
{txt =
53+
Lident ("true"
54+
| "false"
55+
as x)}, None)
56+
| Pexp_ident {txt = Lident ("jsType" as x)}
57+
)
58+
}
59+
],None)
60+
-> not (x = "false")
5161
| _ -> invalid_config config)
5262
| None -> false
5363
let noloc = Location.none

Diff for: jscomp/test/ast_abstract_test.ml

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ type c =
5353
| D1
5454
| D2
5555
| D3
56-
[@@bs.deriving {jsMapper = {jsType = true}}]
56+
[@@bs.deriving {jsMapper = {jsType }}]
5757

5858
let c0 = cToJs D0
5959

Diff for: lib/bsdep.ml

+12-2
Original file line numberDiff line numberDiff line change
@@ -30923,8 +30923,18 @@ let handle_config (config : Parsetree.expression option) =
3092330923
| Pexp_record (
3092430924
[
3092530925
{txt = Lident "jsType"},
30926-
{pexp_desc = Pexp_construct ({txt = Lident ("true" | "false" as x )}, None)}],None)
30927-
-> x = "true"
30926+
{pexp_desc =
30927+
(Pexp_construct
30928+
(
30929+
{txt =
30930+
Lident ("true"
30931+
| "false"
30932+
as x)}, None)
30933+
| Pexp_ident {txt = Lident ("jsType" as x)}
30934+
)
30935+
}
30936+
],None)
30937+
-> not (x = "false")
3092830938
| _ -> invalid_config config)
3092930939
| None -> false
3093030940
let noloc = Location.none

Diff for: lib/bsppx.ml

+12-2
Original file line numberDiff line numberDiff line change
@@ -12871,8 +12871,18 @@ let handle_config (config : Parsetree.expression option) =
1287112871
| Pexp_record (
1287212872
[
1287312873
{txt = Lident "jsType"},
12874-
{pexp_desc = Pexp_construct ({txt = Lident ("true" | "false" as x )}, None)}],None)
12875-
-> x = "true"
12874+
{pexp_desc =
12875+
(Pexp_construct
12876+
(
12877+
{txt =
12878+
Lident ("true"
12879+
| "false"
12880+
as x)}, None)
12881+
| Pexp_ident {txt = Lident ("jsType" as x)}
12882+
)
12883+
}
12884+
],None)
12885+
-> not (x = "false")
1287612886
| _ -> invalid_config config)
1287712887
| None -> false
1287812888
let noloc = Location.none

Diff for: lib/whole_compiler.ml

+12-2
Original file line numberDiff line numberDiff line change
@@ -105690,8 +105690,18 @@ let handle_config (config : Parsetree.expression option) =
105690105690
| Pexp_record (
105691105691
[
105692105692
{txt = Lident "jsType"},
105693-
{pexp_desc = Pexp_construct ({txt = Lident ("true" | "false" as x )}, None)}],None)
105694-
-> x = "true"
105693+
{pexp_desc =
105694+
(Pexp_construct
105695+
(
105696+
{txt =
105697+
Lident ("true"
105698+
| "false"
105699+
as x)}, None)
105700+
| Pexp_ident {txt = Lident ("jsType" as x)}
105701+
)
105702+
}
105703+
],None)
105704+
-> not (x = "false")
105695105705
| _ -> invalid_config config)
105696105706
| None -> false
105697105707
let noloc = Location.none

0 commit comments

Comments
 (0)