Exemple #1
0
 public NS(NS parentNamespace, string fullName, string name)
 {
     this.assembly        = parentNamespace.assembly;
     this.parentNamespace = parentNamespace;
     this.fullName        = fullName;
     this.name            = name;
     if (parentNamespace.types != null)
     {
         this.types = new Dictionary <TopLevelTypeName, ITypeDefinition>(parentNamespace.types.Comparer);
     }
 }
Exemple #2
0
 public NS(VSharpAssembly assembly)
 {
     this.assembly = assembly;
     this.fullName = string.Empty;
     this.name     = string.Empty;
     // Our main dictionary for the VSharpAssembly is using an ordinal comparer.
     // If the compilation's comparer isn't ordinal, we need to create a new dictionary with the compilation's comparer.
     if (assembly.compilation.NameComparer != StringComparer.Ordinal)
     {
         this.types = new Dictionary <TopLevelTypeName, ITypeDefinition>(new TopLevelTypeNameComparer(assembly.compilation.NameComparer));
     }
 }
        IAssembly IAssemblyReference.Resolve(ITypeResolveContext context)
        {
            if (context == null)
            {
                throw new ArgumentNullException("context");
            }
            var       cache = context.Compilation.CacheManager;
            IAssembly asm   = (IAssembly)cache.GetShared(this);

            if (asm != null)
            {
                return(asm);
            }
            else
            {
                asm = new VSharpAssembly(context.Compilation, this);
                return((IAssembly)cache.GetOrAddShared(this, asm));
            }
        }