@@ -509,14 +509,15 @@ export class PortableRegistry extends Struct implements ILookup {
509509 }
510510
511511 #extractComposite ( lookupIndex : number , { params, path } : SiType , { fields } : SiTypeDefComposite ) : TypeDef {
512- const specialVariant = path [ 0 ] . toString ( ) ;
512+ const pathFirst = path [ 0 ] . toString ( ) ;
513+ const pathLast = path [ path . length - 1 ] . toString ( ) ;
513514
514- if ( path . length === 1 && specialVariant === 'BTreeMap' ) {
515+ if ( path . length === 1 && pathFirst === 'BTreeMap' ) {
515516 return withTypeString ( this . registry , {
516517 info : TypeDefInfo . BTreeMap ,
517518 sub : params . map ( ( { type } ) => this . #createSiDef( type . unwrap ( ) ) )
518519 } ) ;
519- } else if ( [ 'Range' , 'RangeInclusive' ] . includes ( specialVariant ) ) {
520+ } else if ( [ 'Range' , 'RangeInclusive' ] . includes ( pathFirst ) ) {
520521 return withTypeString ( this . registry , {
521522 info : TypeDefInfo . Range ,
522523 sub : fields . map ( ( { name, type, typeName } , index ) =>
@@ -530,19 +531,17 @@ export class PortableRegistry extends Struct implements ILookup {
530531 typeName . isSome
531532 ? { typeName : sanitize ( typeName . unwrap ( ) ) }
532533 : null
533- ) )
534+ ) ) ,
535+ type : pathFirst
536+ } ) ;
537+ } else if ( [ 'WrapperKeepOpaque' , 'WrapperOpaque' ] . includes ( pathLast ) ) {
538+ return withTypeString ( this . registry , {
539+ info : pathLast === 'WrapperKeepOpaque'
540+ ? TypeDefInfo . WrapperKeepOpaque
541+ : TypeDefInfo . WrapperOpaque ,
542+ sub : this . #createSiDef( params [ 0 ] . type . unwrap ( ) ) ,
543+ type : pathLast
534544 } ) ;
535- } else if ( path . length ) {
536- const last = path [ path . length - 1 ] . toString ( ) ;
537-
538- if ( [ 'WrapperKeepOpaque' , 'WrapperOpaque' ] . includes ( last ) ) {
539- return withTypeString ( this . registry , {
540- info : last === 'WrapperKeepOpaque'
541- ? TypeDefInfo . WrapperKeepOpaque
542- : TypeDefInfo . WrapperOpaque ,
543- sub : this . #createSiDef( params [ 0 ] . type . unwrap ( ) )
544- } ) ;
545- }
546545 }
547546
548547 return PATHS_SET . some ( ( p ) => matchParts ( p , path ) )
0 commit comments