Skip to content

Commit 0202d6e

Browse files
committed
Half way towards a surface syntax.
1 parent 5a508d3 commit 0202d6e

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

jscomp/core/record_attributes_check.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ let rec check_duplicated_labels_aux (lbls : Parsetree.label_declaration list)
8282
| [] -> None
8383
| { pld_name = { txt } as pld_name; pld_attributes } :: rest -> (
8484
(* TODO: this operates on the parse tree and does not know about expansion *)
85-
if Set_string.mem coll txt && txt <> "dotdotdot" then Some pld_name
85+
if Set_string.mem coll txt && txt <> "..." then Some pld_name
8686
else
8787
let coll_with_lbl = Set_string.add coll txt in
8888
match Ext_list.find_opt pld_attributes find_name_with_loc with

jscomp/ml/typedecl.ml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,7 @@ let transl_declaration env sdecl id =
447447
else Record_regular
448448
in
449449
let lbls, lbls' = match lbls, lbls' with
450-
| {ld_name = {txt = "dotdotdot"}; ld_type} :: _, _ :: _ ->
450+
| {ld_name = {txt = "..."}; ld_type} :: _, _ :: _ ->
451451
let rec extract t = match t.desc with
452452
| Tpoly(t, []) -> extract t
453453
| _ -> Ctype.repr t in
@@ -459,7 +459,7 @@ let transl_declaration env sdecl id =
459459
ld_loc = l.ld_loc;
460460
ld_attributes = l.ld_attributes; } in
461461
let rec process_lbls acc lbls lbls' = match lbls, lbls' with
462-
| {ld_name = {txt = "dotdotdot"}; ld_type} :: rest, _ :: rest' ->
462+
| {ld_name = {txt = "..."}; ld_type} :: rest, _ :: rest' ->
463463
(match Ctype.extract_concrete_typedecl env (extract ld_type.ctyp_type) with
464464
(_p0, _p, {type_kind=Type_record (fields, _repr)}) ->
465465
process_lbls (fst acc @ (fields |> List.map mkLbl), snd acc @ fields) rest rest'
@@ -1214,7 +1214,7 @@ let check_duplicates sdecl_list =
12141214
(fun {pld_name=cname;pld_loc=loc} ->
12151215
try
12161216
let name' = Hashtbl.find labels cname.txt in
1217-
if cname.txt <> "dotdotdot" then
1217+
if cname.txt <> "..." then
12181218
Location.prerr_warning loc
12191219
(Warnings.Duplicate_definitions
12201220
("label", cname.txt, name', sdecl.ptype_name.txt))

jscomp/test/DotDotDot.res

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
type a = {x: int}
22

3-
type b = {dotdotdot: a, y: string}
3+
type b = {\"...": a, y: string}
44

5-
type c = {dotdotdot: b, z: string}
5+
type c = {\"...": b, z: string}
66

77
let v: c = {x: 10, y: "", z: ""}
88

99
type vw = {v: float, w: float}
1010

11-
type cvw = {dotdotdot: c, dotdotdot: vw}
11+
type cvw = {\"...": c, \"...": vw}
1212

1313
let v2: cvw = {x: 10, y: "", z: "", v: 1.0, w: 2.0}
1414

@@ -20,24 +20,24 @@ type globalProps = {
2020
}
2121

2222
type anchorProps = {
23-
dotdotdot: globalProps,
23+
\"...": globalProps,
2424
download?: string,
2525
href?: string,
2626
target?: [#_self | #_blank | #_parent | #_top],
2727
}
2828

2929
// globalProps only case?
30-
type divProps = {dotdotdot: globalProps}
30+
type divProps = {\"...": globalProps}
3131

3232
type svgProps = {
33-
dotdotdot: globalProps,
33+
\"...": globalProps,
3434
x?: string,
3535
y?: string,
3636
}
3737

3838
module MultipleDotDotDots = {
3939
type t1 = {x: int}
4040
type t2 = {y: string}
41-
type t = {dotdotdot: t1, dotdotdot: t2}
41+
type t = {\"...": t1, \"...": t2}
4242
let x: t = {x: 10, y: "abc"}
4343
}

0 commit comments

Comments
 (0)