4 instantiations of UsedNamespaceOrType
Microsoft.CodeAnalysis (4)
PEWriter\UsedNamespaceOrType.cs (4)
39
return new
UsedNamespaceOrType
(alias: aliasOpt, targetType: type);
45
return new
UsedNamespaceOrType
(alias: aliasOpt, targetAssembly: assemblyOpt, targetNamespace: @namespace);
51
return new
UsedNamespaceOrType
(alias: alias);
58
return new
UsedNamespaceOrType
(alias: prefix, targetXmlNamespace: xmlNamespace);
68 references to UsedNamespaceOrType
Microsoft.CodeAnalysis (18)
Emit\CommonPEModuleBuilder.cs (1)
203
public abstract ImmutableArray<Cci.
UsedNamespaceOrType
> GetImports();
NativePdbWriter\PdbWriter.cs (4)
170
foreach (
var
import in scope.GetUsedNamespaces(Context))
191
foreach (
UsedNamespaceOrType
import in scope.GetUsedNamespaces(Context))
219
foreach (
UsedNamespaceOrType
import in module.GetImports())
241
private string TryEncodeImport(
UsedNamespaceOrType
import, HashSet<string> declaredExternAliasesOpt, bool isProjectLevel)
PEWriter\IImportScope.cs (1)
19
ImmutableArray<
UsedNamespaceOrType
> GetUsedNamespaces(EmitContext context);
PEWriter\MetadataWriter.PortablePdb.cs (3)
332
private void SerializeImport(BlobBuilder writer,
UsedNamespaceOrType
import)
424
foreach (
UsedNamespaceOrType
import in module.GetImports())
460
foreach (
UsedNamespaceOrType
import in scope.GetUsedNamespaces(Context))
PEWriter\ReferenceIndexer.cs (2)
127
private void VisitImports(ImmutableArray<
UsedNamespaceOrType
> imports)
137
foreach (
var
import in imports)
PEWriter\UsedNamespaceOrType.cs (7)
14
internal readonly struct UsedNamespaceOrType : IEquatable<
UsedNamespaceOrType
>
36
internal static
UsedNamespaceOrType
CreateType(ITypeReference type, string? aliasOpt = null)
42
internal static
UsedNamespaceOrType
CreateNamespace(INamespace @namespace, IAssemblyReference? assemblyOpt = null, string? aliasOpt = null)
48
internal static
UsedNamespaceOrType
CreateExternAlias(string alias)
54
internal static
UsedNamespaceOrType
CreateXmlNamespace(string prefix, string xmlNamespace)
63
return obj is
UsedNamespaceOrType
other && Equals(other);
66
public bool Equals(
UsedNamespaceOrType
other)
Microsoft.CodeAnalysis.CSharp (16)
Binder\ImportChain.cs (9)
35
ImmutableArray<Cci.
UsedNamespaceOrType
> Cci.IImportScope.GetUsedNamespaces(EmitContext context)
37
bool result = ((Emit.PEModuleBuilder)context.Module).TryGetTranslatedImports(this, out ImmutableArray<Cci.
UsedNamespaceOrType
> imports);
59
private ImmutableArray<Cci.
UsedNamespaceOrType
> TranslateImports(Emit.PEModuleBuilder moduleBuilder, DiagnosticBag diagnostics)
61
var usedNamespaces = ArrayBuilder<Cci.
UsedNamespaceOrType
>.GetInstance();
70
usedNamespaces.Add(Cci.
UsedNamespaceOrType
.CreateExternAlias(alias.Alias.Name));
84
usedNamespaces.Add(Cci.
UsedNamespaceOrType
.CreateNamespace(ns.GetCciAdapter(), assemblyRef));
90
usedNamespaces.Add(Cci.
UsedNamespaceOrType
.CreateType(typeRef));
114
usedNamespaces.Add(Cci.
UsedNamespaceOrType
.CreateNamespace(ns.GetCciAdapter(), assemblyRef, alias));
122
usedNamespaces.Add(Cci.
UsedNamespaceOrType
.CreateType(typeRef, alias));
Emitter\Model\PEModuleBuilder.cs (7)
31
private readonly ConcurrentDictionary<ImportChain, ImmutableArray<Cci.
UsedNamespaceOrType
>> _translatedImportsMap =
32
new ConcurrentDictionary<ImportChain, ImmutableArray<Cci.
UsedNamespaceOrType
>>(ReferenceEqualityComparer.Instance);
147
public sealed override ImmutableArray<Cci.
UsedNamespaceOrType
> GetImports() => ImmutableArray<Cci.
UsedNamespaceOrType
>.Empty;
2084
internal bool TryGetTranslatedImports(ImportChain chain, out ImmutableArray<Cci.
UsedNamespaceOrType
> imports)
2089
internal ImmutableArray<Cci.
UsedNamespaceOrType
> GetOrAddTranslatedImports(ImportChain chain, ImmutableArray<Cci.
UsedNamespaceOrType
> imports)
Microsoft.CodeAnalysis.UnitTests (34)
PEWriter\UsedNamespaceOrTypeTests.cs (34)
39
private static void RunAll(EqualityUnit<
UsedNamespaceOrType
> unit)
50
var
value =
UsedNamespaceOrType
.CreateType(ref1.Object, "alias");
55
UsedNamespaceOrType
.CreateType(ref1.Object, "alias"))
57
UsedNamespaceOrType
.CreateNamespace(new Mock<INamespace>(MockBehavior.Strict).Object),
58
UsedNamespaceOrType
.CreateType(ref2.Object, "alias"),
59
UsedNamespaceOrType
.CreateType(ref1.Object, "different alias"));
75
var
value =
UsedNamespaceOrType
.CreateType(type1.Object, "alias");
80
UsedNamespaceOrType
.CreateType(type1.Object, "alias"),
81
UsedNamespaceOrType
.CreateType(type2.Object, "alias"))
83
UsedNamespaceOrType
.CreateType(type1.Object, "different alias"),
84
UsedNamespaceOrType
.CreateType(type2.Object, "different alias"),
85
UsedNamespaceOrType
.CreateType(type3.Object, "alias"),
86
UsedNamespaceOrType
.CreateNamespace(new Mock<INamespace>(MockBehavior.Strict).Object));
93
var
value =
UsedNamespaceOrType
.CreateExternAlias("alias1");
98
UsedNamespaceOrType
.CreateExternAlias("alias1"))
99
.WithNotEqualValues(
UsedNamespaceOrType
.CreateExternAlias("alias2"));
110
var
value =
UsedNamespaceOrType
.CreateNamespace(ns1.Object);
115
UsedNamespaceOrType
.CreateNamespace(ns1.Object),
116
UsedNamespaceOrType
.CreateNamespace(ns2.Object))
118
UsedNamespaceOrType
.CreateExternAlias("alias"),
119
UsedNamespaceOrType
.CreateNamespace(ns1.Object, CreateEqualsInterface<IAssemblyReference>("a").Object),
120
UsedNamespaceOrType
.CreateNamespace(ns3.Object));
134
var
value =
UsedNamespaceOrType
.CreateNamespace(ns1.Object, assembly1.Object);
139
UsedNamespaceOrType
.CreateNamespace(ns1.Object, assembly1.Object),
140
UsedNamespaceOrType
.CreateNamespace(ns1.Object, assembly2.Object),
141
UsedNamespaceOrType
.CreateNamespace(ns2.Object, assembly1.Object))
143
UsedNamespaceOrType
.CreateExternAlias("alias"),
144
UsedNamespaceOrType
.CreateNamespace(ns1.Object, new Mock<IAssemblyReference>(MockBehavior.Strict).Object),
145
UsedNamespaceOrType
.CreateNamespace(ns3.Object));