Skip to content

Commit 6c0f6bf

Browse files
cristianocclaude
andcommitted
Name the reader of an external argument's encoding
iter_process_bs_string_int_unwrap_uncurry advertised uncurry, which it does not handle, and omitted ignore, which it does. It answers which of @string, @int, @ignore and @unwrap an external's argument carries, so it is now arg_encoding. Signed-off-by: Cristiano Calcagno <ccrisccris@gmail.com> Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01W8g8qwBARAcvW9MyuKQq8H
1 parent 900e309 commit 6c0f6bf

3 files changed

Lines changed: 8 additions & 8 deletions

File tree

compiler/frontend/ast_attributes.ml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,10 @@ let process_derive_type (attrs : t) : derive_attr * t =
105105
| Some _ -> Bs_syntaxerr.err loc Duplicated_bs_deriving)
106106
| _ -> (st, attr :: acc))
107107

108-
(* duplicated attributes not allowed *)
109-
let iter_process_bs_string_int_unwrap_uncurry (attrs : t) =
108+
(* How an external's argument is encoded, from the one of [@string], [@int],
109+
[@ignore] and [@unwrap] it carries. They are alternatives, so more than one
110+
is a conflict. *)
111+
let arg_encoding (attrs : t) =
110112
let attr_name = function
111113
| `String -> "string"
112114
| `Int -> "int"

compiler/frontend/ast_attributes.mli

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,9 @@ val has_await_payload : t -> bool
3535

3636
type derive_attr = {bs_deriving: Ast_payload.action list option} [@@unboxed]
3737

38-
val iter_process_bs_string_int_unwrap_uncurry :
39-
t -> [`Nothing | `String | `Int | `Ignore | `Unwrap]
38+
val arg_encoding : t -> [`Nothing | `String | `Int | `Ignore | `Unwrap]
39+
(** How an external's argument is encoded, from the one of [@string], [@int],
40+
[@ignore] and [@unwrap] it carries. *)
4041

4142
val as_string : t -> string option
4243

compiler/frontend/ast_external_process.ml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,7 @@ let variant_unwrap (row_fields : Parsetree.row_field list) : bool =
3939
let spec_of_ptyp (nolabel : bool) (ptyp : Parsetree.core_type) :
4040
External_arg_spec.attr =
4141
let ptyp_desc = ptyp.ptyp_desc in
42-
match
43-
Ast_attributes.iter_process_bs_string_int_unwrap_uncurry
44-
ptyp.ptyp_attributes
45-
with
42+
match Ast_attributes.arg_encoding ptyp.ptyp_attributes with
4643
| `String -> (
4744
match ptyp_desc with
4845
| Ptyp_variant (row_fields, Closed, None) ->

0 commit comments

Comments
 (0)