Skip to content

Commit 9999887

Browse files
committed
Prepare for new release.
2 parents 6090a1c + da8c067 commit 9999887

File tree

2 files changed

+16
-6
lines changed

2 files changed

+16
-6
lines changed

CLASSES.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ Method binding
6969

7070
````
7171
method f: t -> unit
72-
[@@js.meth "f"]
72+
[@@js.call "f"]
7373
````
7474

7575

@@ -84,7 +84,7 @@ all the examples above). The following rules are applied in order:
8484
by dropping the `set_` prefix).
8585

8686
- If the method is a function, then the definition is assumed to be a
87-
`[@@js.meth]` method call.
87+
`[@@js.call]` method call.
8888

8989
- Otherwise, the method is assumed to be a `[@@js.get]` property getter.
9090

src/gen_js_api.ml

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1500,17 +1500,27 @@ and mapper =
15001500
in
15011501
{super with module_expr; structure_item; expr}
15021502

1503+
let is_js_attribute txt = txt = "js" || has_prefix ~prefix:"js." txt
1504+
15031505
let check_loc_mapper =
15041506
let mapper = Ast_mapper.default_mapper in
15051507
let attribute _this (({txt; loc}, _) as attr) =
1506-
if txt = "js" || has_prefix ~prefix:"js." txt then begin
1508+
if is_js_attribute txt then begin
15071509
if is_registered_loc loc then ()
15081510
else error loc Spurious_attribute
15091511
end;
15101512
attr
15111513
in
15121514
{ mapper with Ast_mapper.attribute }
15131515

1516+
let clear_attr_mapper =
1517+
let mapper = Ast_mapper.default_mapper in
1518+
let attributes _this attrs =
1519+
let f ({txt = _; loc}, _) = not (is_registered_loc loc) in
1520+
List.filter f attrs
1521+
in
1522+
{ mapper with Ast_mapper.attributes }
1523+
15141524
(** Main *)
15151525

15161526
let out = ref ""
@@ -1538,10 +1548,10 @@ let standalone () =
15381548
~tool_name:"gen_js_iface"
15391549
src
15401550
in
1541-
let res = str_of_sg ~global_attrs:[] sg in
1551+
let str = str_of_sg ~global_attrs:[] sg in
15421552
ignore (check_loc_mapper.Ast_mapper.signature check_loc_mapper sg);
1543-
Format.fprintf (Format.formatter_of_out_channel oc) "%a@."
1544-
Pprintast.structure res;
1553+
let str = clear_attr_mapper.Ast_mapper.structure clear_attr_mapper str in
1554+
Format.fprintf (Format.formatter_of_out_channel oc) "%a@." Pprintast.structure str;
15451555
if !out <> "-" then close_out oc
15461556

15471557
let () =

0 commit comments

Comments
 (0)