33using System . IO ;
44using System . Linq ;
55using System . Reflection ;
6- using Semmle . Util ;
76
87namespace Semmle . Extraction . CIL . Entities
98{
@@ -21,6 +20,7 @@ internal sealed partial class NoMetadataHandleType : Type
2120 private readonly Type [ ] ? thisTypeArguments ;
2221 private readonly Type unboundGenericType ;
2322 private readonly Type ? containingType ;
23+ private readonly Namespace ? containingNamespace ;
2424
2525 private readonly NamedTypeIdWriter idWriter ;
2626
@@ -53,13 +53,20 @@ public NoMetadataHandleType(Context cx, string originalName) : base(cx)
5353 ? null
5454 : new NoMetadataHandleType ( Cx , containerName ) ;
5555
56+ containingNamespace = isContainerNamespace
57+ ? containerName == Cx . GlobalNamespace . Name
58+ ? Cx . GlobalNamespace
59+ : containerName == Cx . SystemNamespace . Name
60+ ? Cx . SystemNamespace
61+ : new Namespace ( Cx , containerName )
62+ : null ;
63+
5664 Populate ( ) ;
5765 }
5866
5967 private void Populate ( )
6068 {
61- if ( isContainerNamespace &&
62- ! ContainingNamespace ! . IsGlobalNamespace )
69+ if ( isContainerNamespace )
6370 {
6471 Cx . Populate ( ContainingNamespace ) ;
6572 }
@@ -100,11 +107,7 @@ public override IEnumerable<IExtractionProduct> Contents
100107
101108 public override string Name => GenericsHelper . GetNonGenericName ( name ) ;
102109
103- public override Namespace ? ContainingNamespace => isContainerNamespace
104- ? containerName == Cx . GlobalNamespace . Name
105- ? Cx . GlobalNamespace
106- : new Namespace ( Cx , containerName )
107- : null ;
110+ public override Namespace ? ContainingNamespace => containingNamespace ;
108111
109112 public override Type ? ContainingType => containingType ;
110113
0 commit comments