Skip to content

Commit e7d724e

Browse files
authored
add `no_resolution to objintf ts (#431)
1 parent d1c0b8a commit e7d724e

2 files changed

Lines changed: 10 additions & 3 deletions

File tree

src/lib_objintf_gen_ts/ts_bridge.ml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,19 +69,22 @@ type type_decl_resolution_strategy = [
6969
| `import_location of string
7070
| `inline_type_definition
7171
| `infile_type_definition
72+
| `no_resolution
7273
]
7374

7475
type ident_resolution_strategy = [
7576
| `import_location of string
7677
| `inline_type_definition of ts_type_desc
7778
| `infile_type_definition of ts_type_desc
79+
| `no_resolution
7880
]
7981

8082
let validate_resolution_strategy ~(type_decl_resolution_strategy: _ -> _ -> type_decl_resolution_strategy) td codec =
8183
let strategy = type_decl_resolution_strategy td codec in
8284
let () = match strategy with
8385
| `import_location _
84-
| `infile_type_definition -> ()
86+
| `infile_type_definition
87+
| `no_resolution -> ()
8588
| `inline_type_definition when is_recursive td -> failwith "Recursive type cannot be defined inilne."
8689
| `inline_type_definition -> ()
8790
in
@@ -187,7 +190,8 @@ let ts_type_desc_of_type_decl :
187190
fun ~type_decl_resolution_strategy td codec ->
188191
match type_decl_resolution_strategy td codec with
189192
| `import_location _
190-
| `infile_type_definition ->
193+
| `infile_type_definition
194+
| `no_resolution ->
191195
`type_reference (Ts_config.get_mangled_name_of_type ~escaping_charmap:Mangling.charmap_js_identifier td |> fst)
192196
| `inline_type_definition ->
193197
td
@@ -202,7 +206,8 @@ let ts_type_desc_of_ident :
202206
fun ~ident_resolution_strategy mangling_style ident ->
203207
match ident_resolution_strategy ident with
204208
| `import_location _
205-
| `infile_type_definition _ ->
209+
| `infile_type_definition _
210+
| `no_resolution ->
206211
`type_reference (Ts_config.mangled `type_name mangling_style ident.id_name |> Mangling.(escape ~charmap:charmap_js_identifier))
207212
| `inline_type_definition desc -> desc
208213

src/lib_objintf_gen_ts/ts_bridge.mli

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,14 @@ type type_decl_resolution_strategy = [
2626
| `import_location of string
2727
| `inline_type_definition
2828
| `infile_type_definition
29+
| `no_resolution
2930
]
3031

3132
type ident_resolution_strategy = [
3233
| `import_location of string
3334
| `inline_type_definition of ts_type_desc
3435
| `infile_type_definition of ts_type_desc
36+
| `no_resolution
3537
]
3638

3739
val ts_ast_of_objintf :

0 commit comments

Comments
 (0)