@@ -149,15 +149,156 @@ let translate_constr ~config ~params_translation ~(path : Path.t) ~type_env =
149149 {dependencies = [] ; type_ = ident (" Intl." ^ intl_module)}
150150 | ([" Stdlib" ; " Error" ; " t" ] | [" Stdlib" ; " JsError" ; " t" ]), [] ->
151151 {dependencies = [] ; type_ = ident " Error" }
152- | [" Stdlib" ; " Iterator " ; " t" ], [param_translation] ->
152+ | ( [" Stdlib" ; " Iterable " ; " t" ] | [ " iterable " ]) , [param_translation] ->
153153 {
154154 dependencies = param_translation.dependencies;
155- type_ = ident ~type_args: [param_translation.type_] " Iterator " ;
155+ type_ = ident ~type_args: [param_translation.type_] " Iterable " ;
156156 }
157- | [" Stdlib" ; " AsyncIterator" ; " t" ], [param_translation] ->
157+ | ( [" Stdlib" ; " Iterator" ; " t" ],
158+ [yield_translation; return_translation; next_translation] ) ->
159+ {
160+ dependencies =
161+ List. concat
162+ [
163+ yield_translation.dependencies;
164+ return_translation.dependencies;
165+ next_translation.dependencies;
166+ ];
167+ type_ =
168+ ident
169+ ~type_args:
170+ [
171+ yield_translation.type_;
172+ return_translation.type_;
173+ next_translation.type_;
174+ ]
175+ " Iterator" ;
176+ }
177+ | ( [" Stdlib" ; " IteratorObject" ; " t" ],
178+ [yield_translation; return_translation; next_translation] ) ->
179+ {
180+ dependencies =
181+ List. concat
182+ [
183+ yield_translation.dependencies;
184+ return_translation.dependencies;
185+ next_translation.dependencies;
186+ ];
187+ type_ =
188+ ident
189+ ~type_args:
190+ [
191+ yield_translation.type_;
192+ return_translation.type_;
193+ next_translation.type_;
194+ ]
195+ " IteratorObject" ;
196+ }
197+ | ( [" Stdlib" ; " IterableIterator" ; " t" ],
198+ [yield_translation; return_translation; next_translation] ) ->
199+ {
200+ dependencies =
201+ List. concat
202+ [
203+ yield_translation.dependencies;
204+ return_translation.dependencies;
205+ next_translation.dependencies;
206+ ];
207+ type_ =
208+ ident
209+ ~type_args:
210+ [
211+ yield_translation.type_;
212+ return_translation.type_;
213+ next_translation.type_;
214+ ]
215+ " IterableIterator" ;
216+ }
217+ | ( [" Stdlib" ; " Generator" ; " t" ],
218+ [yield_translation; return_translation; next_translation] ) ->
219+ {
220+ dependencies =
221+ List. concat
222+ [
223+ yield_translation.dependencies;
224+ return_translation.dependencies;
225+ next_translation.dependencies;
226+ ];
227+ type_ =
228+ ident
229+ ~type_args:
230+ [
231+ yield_translation.type_;
232+ return_translation.type_;
233+ next_translation.type_;
234+ ]
235+ " Generator" ;
236+ }
237+ | ([" Stdlib" ; " AsyncIterable" ; " t" ] | [" asyncIterable" ]), [param_translation]
238+ ->
158239 {
159240 dependencies = param_translation.dependencies;
160- type_ = ident ~type_args: [param_translation.type_] " AsyncIterator" ;
241+ type_ = ident ~type_args: [param_translation.type_] " AsyncIterable" ;
242+ }
243+ | ( [" Stdlib" ; " AsyncIterator" ; " t" ],
244+ [yield_translation; return_translation; next_translation] ) ->
245+ {
246+ dependencies =
247+ List. concat
248+ [
249+ yield_translation.dependencies;
250+ return_translation.dependencies;
251+ next_translation.dependencies;
252+ ];
253+ type_ =
254+ ident
255+ ~type_args:
256+ [
257+ yield_translation.type_;
258+ return_translation.type_;
259+ next_translation.type_;
260+ ]
261+ " AsyncIterator" ;
262+ }
263+ | ( [" Stdlib" ; " AsyncIterableIterator" ; " t" ],
264+ [yield_translation; return_translation; next_translation] ) ->
265+ {
266+ dependencies =
267+ List. concat
268+ [
269+ yield_translation.dependencies;
270+ return_translation.dependencies;
271+ next_translation.dependencies;
272+ ];
273+ type_ =
274+ ident
275+ ~type_args:
276+ [
277+ yield_translation.type_;
278+ return_translation.type_;
279+ next_translation.type_;
280+ ]
281+ " AsyncIterableIterator" ;
282+ }
283+ | ( [" Stdlib" ; " AsyncGenerator" ; " t" ],
284+ [yield_translation; return_translation; next_translation] ) ->
285+ {
286+ dependencies =
287+ List. concat
288+ [
289+ yield_translation.dependencies;
290+ return_translation.dependencies;
291+ next_translation.dependencies;
292+ ];
293+ type_ =
294+ ident
295+ ~type_args:
296+ [
297+ yield_translation.type_;
298+ return_translation.type_;
299+ next_translation.type_;
300+ ]
301+ " AsyncGenerator" ;
161302 }
162303 | [" Stdlib" ; " Ordering" ; " t" ], [] -> {dependencies = [] ; type_ = number_t}
163304 | [" unit" ], [] -> {dependencies = [] ; type_ = unit_t}
0 commit comments