Esempio n. 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);
     }
 }
Esempio n. 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));
     }
 }
Esempio n. 3
0
        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));
            }
        }