File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -305,7 +305,7 @@ pub enum PrintMode {
305
305
/// names that types and modules have been aliased with in the current module.
306
306
#[ derive( Debug ) ]
307
307
pub struct Printer < ' a > {
308
- pub names : & ' a Names ,
308
+ names : & ' a Names ,
309
309
uid : u64 ,
310
310
311
311
/// Some type variables aren't bound to names, so when trying to print those,
@@ -360,10 +360,18 @@ impl<'a> Printer<'a> {
360
360
}
361
361
}
362
362
363
+ /// Clear the registered type variable names. This allows the same `Printer`
364
+ /// to be used in multiple different scopes, which have different sets of
365
+ /// type variables. After clearing, the correct variables from the desired
366
+ /// scope can be registered using `register_type_variable`.
363
367
pub fn clear_type_variables ( & mut self ) {
364
368
self . printed_type_variable_names . clear ( ) ;
365
369
}
366
370
371
+ /// As explained in the documentation for `new_without_type_variables`, it
372
+ /// it not always possible to determine which type variables are in scope.
373
+ /// However, when it is possible, this function can be used to manually
374
+ /// register which type variable names are in scope and cannot be used.
367
375
pub fn register_type_variable ( & mut self , name : EcoString ) {
368
376
_ = self . printed_type_variable_names . insert ( name) ;
369
377
}
You can’t perform that action at this time.
0 commit comments