@@ -379,7 +379,6 @@ impl PublicResultGroup {
379379pub ( crate ) struct ResultModel {
380380 reachable_defs : DefinitionReachability ,
381381 type_layout : ResultTypeLayout ,
382- named_types : BTreeMap < TypeId , Symbol > ,
383382 type_name_bindings : Vec < TypeNameBinding > ,
384383 entry_point_items : Vec < ResultItem > ,
385384 capture_layout : CaptureLayout ,
@@ -421,10 +420,9 @@ impl ResultModel {
421420 & collected_types. builtins ,
422421 collected_types. value_types ,
423422 ) ;
424- let named_types: BTreeMap < TypeId , Symbol > = types. iter_named_types ( ) . collect ( ) ;
425- let mut type_name_bindings = named_types
426- . iter ( )
427- . map ( |( & type_id, & name) | TypeNameBinding { name, type_id } )
423+ let mut type_name_bindings = types
424+ . iter_named_types ( )
425+ . map ( |( type_id, name) | TypeNameBinding { name, type_id } )
428426 . collect :: < Vec < _ > > ( ) ;
429427 for def_id in reachable_defs. iter ( ) {
430428 let Some ( body) = types. expect_def_output ( def_id) . value ( ) else {
@@ -437,8 +435,8 @@ impl ResultModel {
437435 }
438436 type_name_bindings. sort_by_key ( |binding| ( binding. type_id , binding. name ) ) ;
439437 type_name_bindings. dedup ( ) ;
440- let entry_point_items = ItemCollector :: new ( types , definitions , & named_types )
441- . collect ( artifacts. iter_entry_point_outputs ( ) ) ;
438+ let entry_point_items =
439+ ItemCollector :: new ( types , definitions ) . collect ( artifacts. iter_entry_point_outputs ( ) ) ;
442440 let mut public_result_groups = BTreeMap :: new ( ) ;
443441 for item in entry_point_items
444442 . iter ( )
@@ -451,7 +449,7 @@ impl ResultModel {
451449 ) ;
452450 assert ! ( previous. is_none( ) , "public result item names are unique" ) ;
453451 }
454- for ( & type_id, & name) in & named_types {
452+ for ( type_id, name) in types . iter_named_types ( ) {
455453 let Some ( group) = public_result_groups. get_mut ( & name) else {
456454 continue ;
457455 } ;
@@ -466,7 +464,6 @@ impl ResultModel {
466464 Ok ( Self {
467465 reachable_defs,
468466 type_layout,
469- named_types,
470467 type_name_bindings,
471468 entry_point_items,
472469 capture_layout,
@@ -509,10 +506,6 @@ impl ResultModel {
509506 ) ;
510507 group
511508 }
512-
513- pub ( crate ) fn type_name_of ( & self , type_id : TypeId ) -> Option < Symbol > {
514- self . named_types . get ( & type_id) . copied ( )
515- }
516509}
517510
518511impl < ' a > ResultSchema < ' a > {
@@ -534,10 +527,6 @@ impl<'a> ResultSchema<'a> {
534527 & self . model . type_layout
535528 }
536529
537- pub ( crate ) fn type_name_of ( & self , type_id : TypeId ) -> Option < Symbol > {
538- self . model . type_name_of ( type_id)
539- }
540-
541530 pub ( crate ) fn iter_type_name_bindings ( & self ) -> impl Iterator < Item = TypeNameBinding > + ' _ {
542531 self . model . type_name_bindings . iter ( ) . copied ( )
543532 }
@@ -572,22 +561,16 @@ impl<'a> ResultSchema<'a> {
572561struct ItemCollector < ' a > {
573562 types : & ' a TypeAnalysis ,
574563 definitions : & ' a DefinitionGraph ,
575- named_types : & ' a BTreeMap < TypeId , Symbol > ,
576564 declared_names : HashSet < Symbol > ,
577565 walked_types : HashSet < TypeId > ,
578566 items : Vec < ResultItem > ,
579567}
580568
581569impl < ' a > ItemCollector < ' a > {
582- fn new (
583- types : & ' a TypeAnalysis ,
584- definitions : & ' a DefinitionGraph ,
585- named_types : & ' a BTreeMap < TypeId , Symbol > ,
586- ) -> Self {
570+ fn new ( types : & ' a TypeAnalysis , definitions : & ' a DefinitionGraph ) -> Self {
587571 Self {
588572 types,
589573 definitions,
590- named_types,
591574 declared_names : HashSet :: new ( ) ,
592575 walked_types : HashSet :: new ( ) ,
593576 items : Vec :: new ( ) ,
@@ -655,14 +638,14 @@ impl<'a> ItemCollector<'a> {
655638 fn collect_position ( & mut self , ty : TypeId ) {
656639 match self . types . expect_type_shape ( ty) {
657640 TypeShape :: Record ( _) | TypeShape :: Variant ( _) => {
658- let name = * self
659- . named_types
660- . get ( & ty)
641+ let name = self
642+ . types
643+ . type_name_of ( ty)
661644 . expect ( "naming pass names every non-payload composite" ) ;
662645 self . add_item ( name, ty) ;
663646 }
664647 TypeShape :: List { .. } | TypeShape :: Option ( _) => {
665- let Some ( & name) = self . named_types . get ( & ty) else {
648+ let Some ( name) = self . types . type_name_of ( ty) else {
666649 self . walk ( ty) ;
667650 return ;
668651 } ;
0 commit comments