2 implementations of INamespaceSymbol
Microsoft.CodeAnalysis.CSharp (1)
Symbols\PublicModel\NamespaceSymbol.cs (1)
13internal sealed class NamespaceSymbol : NamespaceOrTypeSymbol, INamespaceSymbol
Microsoft.CodeAnalysis.VisualBasic (1)
Symbols\NamespaceSymbol.vb (1)
20Implements INamespaceSymbol, INamespaceSymbolInternal
1108 references to INamespaceSymbol
ConfigurationSchemaGenerator (1)
RuntimeSource\Configuration.Binder\Parser\BinderInvocation.cs (1)
61ContainingNamespace: INamespaceSymbol containingNamespace,
Microsoft.AspNetCore.Analyzers (2)
ConfigureMethodVisitor.cs (2)
32public override void VisitNamespace(INamespaceSymbol symbol) 39foreach (var @namespace in symbol.GetNamespaceMembers())
Microsoft.AspNetCore.App.Analyzers (1)
RouteHandlers\DetectMisplacedLambdaAttribute.cs (1)
55static bool IsInValidNamespace(INamespaceSymbol? @namespace)
Microsoft.AspNetCore.Components.Analyzers (1)
ComponentInternalUsageDiagnosticAnalzyer.cs (1)
41var @namespace = symbol?.ContainingNamespace;
Microsoft.AspNetCore.Components.SdkAnalyzers (1)
ComponentInternalUsageDiagnosticAnalzyer.cs (1)
41var @namespace = symbol?.ContainingNamespace;
Microsoft.CodeAnalysis (40)
Compilation\Compilation.cs (12)
365public INamespaceSymbol CreateErrorNamespaceSymbol(INamespaceSymbol container, string name) 380protected abstract INamespaceSymbol CommonCreateErrorNamespaceSymbol(INamespaceSymbol container, string name); 941public INamespaceSymbol GlobalNamespace { get { return CommonGlobalNamespace; } } 942protected abstract INamespaceSymbol CommonGlobalNamespace { get; } 947public INamespaceSymbol? GetCompilationNamespace(INamespaceSymbol namespaceSymbol) 952protected abstract INamespaceSymbol? CommonGetCompilationNamespace(INamespaceSymbol namespaceSymbol); 1045INamespaceSymbol container = this.SourceModule.GlobalNamespace; 1049INamespaceSymbol? next = container.GetNestedNamespace(parts[i]);
Compilation\SymbolInfo.cs (2)
70Debug.Assert(symbol is null || symbol.Kind != SymbolKind.Namespace || ((INamespaceSymbol)symbol).NamespaceKind != NamespaceKindNamespaceGroup); 73Debug.Assert(item.Kind != SymbolKind.Namespace || ((INamespaceSymbol)item).NamespaceKind != NamespaceKindNamespaceGroup);
DiagnosticAnalyzer\AnalysisScope.cs (1)
223!((symbol.Kind == SymbolKind.Namespace && ((INamespaceSymbol)symbol).IsGlobalNamespace));
DiagnosticAnalyzer\AnalyzerManager.AnalyzerExecutionContext.cs (1)
192processMembers(((INamespaceSymbol)symbol).GetMembers());
DiagnosticAnalyzer\SuppressMessageAttributeState.cs (2)
177return hasNamespaceSuppression((INamespaceSymbol)symbol, inImmediatelyContainingSymbol); 194bool hasNamespaceSuppression(INamespaceSymbol namespaceSymbol, bool inImmediatelyContainingSymbol)
DocumentationCommentId.cs (5)
76if (symbol is INamespaceSymbol) 323/// This will always succeed for a <see cref="INamespaceSymbol"/> or <see cref="INamedTypeSymbol"/>. It may not 375public override void VisitNamespace(INamespaceSymbol symbol) 505public override bool VisitNamespace(INamespaceSymbol symbol) 572public override bool VisitNamespace(INamespaceSymbol symbol)
src\Compilers\Core\AnalyzerDriver\DeclarationComputer.cs (2)
54if (declaredSymbol is INamespaceSymbol namespaceSymbol && namespaceSymbol.ConstituentNamespaces.Length > 1) 57var assemblyScopedNamespaceSymbol = namespaceSymbol.ConstituentNamespaces.FirstOrDefault(ns => ns.ContainingAssembly == assemblyToScope);
SymbolDisplay\AbstractSymbolDisplayVisitor.cs (1)
201((INamespaceSymbol)containingSymbol.ContainingSymbol).IsGlobalNamespace)
Symbols\IAssemblySymbol.cs (1)
35INamespaceSymbol GlobalNamespace { get; }
Symbols\IModuleSymbol.cs (3)
23INamespaceSymbol GlobalNamespace { get; } 28INamespaceSymbol? GetModuleNamespace(INamespaceSymbol namespaceSymbol);
Symbols\INamespaceSymbol.cs (2)
33IEnumerable<INamespaceSymbol> GetNamespaceMembers(); 60ImmutableArray<INamespaceSymbol> ConstituentNamespaces { get; }
Symbols\ISymbol.cs (2)
91/// Gets the <see cref="INamespaceSymbol"/> for the nearest enclosing namespace. Returns null if the 94INamespaceSymbol ContainingNamespace { get; }
Symbols\ISymbolExtensions.cs (3)
93internal static INamespaceSymbol? GetNestedNamespace(this INamespaceSymbol container, string name) 99return (INamespaceSymbol)sym;
Symbols\SymbolVisitor.cs (1)
78public virtual void VisitNamespace(INamespaceSymbol symbol)
Symbols\SymbolVisitor`1.cs (1)
81public virtual TResult? VisitNamespace(INamespaceSymbol symbol)
Symbols\SymbolVisitor`2.cs (1)
86public virtual TResult VisitNamespace(INamespaceSymbol symbol, TArgument argument)
Microsoft.CodeAnalysis.CodeStyle (25)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\INamespaceOrTypeSymbolExtensions.cs (2)
76if (namespaceOrTypeSymbol == null || (namespaceOrTypeSymbol.IsNamespace && ((INamespaceSymbol)namespaceOrTypeSymbol).IsGlobalNamespace)) 99if (current is INamespaceSymbol currentNs)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SemanticModelExtensions.cs (2)
90public static INamespaceSymbol? GetEnclosingNamespace(this SemanticModel semanticModel, int position, CancellationToken cancellationToken) 91=> semanticModel.GetEnclosingSymbol<INamespaceSymbol>(position, cancellationToken);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.cs (2)
47/// <item>Two <see cref="INamespaceSymbol"/>s are the "same" if they have 50/// If the <see cref="INamespaceSymbol"/> is the global namespace for a
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.ErrorTypeSymbolKey.cs (3)
26case INamespaceSymbol parentNamespace: 53private static ImmutableArray<string> GetContainingNamespaceNamesInReverse(INamespaceSymbol namespaceSymbol) 123var currentNamespace = reader.Compilation.GlobalNamespace;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.NamedTypeSymbolKey.cs (1)
124if (containingSymbolResolution.SymbolCount == 0 && errorType.ContainingSymbol is INamespaceSymbol containingNamespace)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.NamespaceSymbolKey.cs (6)
13private sealed class NamespaceSymbolKey : AbstractSymbolKey<INamespaceSymbol> 25public sealed override void Create(INamespaceSymbol symbol, SymbolKeyWriter visitor) 59SymbolKeyReader reader, INamespaceSymbol? contextualSymbol, out string? failureReason) 89using var result = PooledArrayBuilder<INamespaceSymbol>.GetInstance(); 102case INamespaceSymbol namespaceSymbol: 105if (member is INamespaceSymbol childNamespace)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.SymbolKeyWriter.cs (1)
443public override void VisitNamespace(INamespaceSymbol namespaceSymbol)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\SymbolEquivalenceComparer.EquivalenceVisitor.cs (6)
127SymbolKind.Namespace => NamespacesAreEquivalent((INamespaceSymbol)x, (INamespaceSymbol)y, equivalentTypesWithDifferingAssemblies), 368x.ContainingSymbol is INamespaceSymbol xNamespace && 369y.ContainingSymbol is INamespaceSymbol yNamespace) 547private bool NamespacesAreEquivalent(INamespaceSymbol x, INamespaceSymbol y, Dictionary<INamedTypeSymbol, INamedTypeSymbol>? equivalentTypesWithDifferingAssemblies)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\SymbolEquivalenceComparer.GetHashCodeVisitor.cs (2)
68SymbolKind.Namespace => CombineHashCodes((INamespaceSymbol)x, currentHash), 209private int CombineHashCodes(INamespaceSymbol x, int currentHash)
Microsoft.CodeAnalysis.CodeStyle.Fixes (49)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\AbstractCodeGenerationService.cs (11)
63public TDeclarationNode AddNamespace<TDeclarationNode>(TDeclarationNode destination, INamespaceSymbol @namespace, CodeGenerationContextInfo info, CancellationToken cancellationToken) where TDeclarationNode : SyntaxNode 92public SyntaxNode CreateNamespaceDeclaration(INamespaceSymbol @namespace, CodeGenerationDestination destination, CodeGenerationContextInfo info, CancellationToken cancellationToken) 129protected abstract TDeclarationNode AddNamespace<TDeclarationNode>(TDeclarationNode destination, INamespaceSymbol @namespace, TCodeGenerationContextInfo info, IList<bool>? availableIndices, CancellationToken cancellationToken) where TDeclarationNode : SyntaxNode; 152public abstract SyntaxNode CreateNamespaceDeclaration(INamespaceSymbol @namespace, CodeGenerationDestination destination, TCodeGenerationContextInfo info, CancellationToken cancellationToken); 351INamespaceSymbol @namespace => CreateNamespaceDeclaration(@namespace, codeGenerationDestination, info, cancellationToken), 369INamespaceSymbol @namespace => AddNamespace(currentDestination, @namespace, info, availableIndices, cancellationToken), 429public Task<Document> AddNamedTypeAsync(CodeGenerationSolutionContext context, INamespaceSymbol destination, INamedTypeSymbol namedType, CancellationToken cancellationToken) 438public Task<Document> AddNamespaceAsync(CodeGenerationSolutionContext context, INamespaceSymbol destination, INamespaceSymbol @namespace, CancellationToken cancellationToken) 465public Task<Document> AddNamespaceOrTypeAsync(CodeGenerationSolutionContext context, INamespaceSymbol destination, INamespaceOrTypeSymbol namespaceOrType, CancellationToken cancellationToken) 472if (namespaceOrType is INamespaceSymbol namespaceSymbol)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\AbstractFlagsEnumGenerator.cs (1)
52((INamespaceSymbol)containingSymbol.ContainingSymbol).IsGlobalNamespace)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\CodeGenerationContext.cs (3)
67public IEnumerable<INamespaceSymbol> AdditionalImports { get; } 138IEnumerable<INamespaceSymbol>? additionalImports = null, 184Optional<IEnumerable<INamespaceSymbol>> additionalImports = default,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\CodeGenerationHelpers.cs (3)
47INamespaceSymbol @namespace, 50out INamespaceSymbol innermostNamespace) 63if (members is [INamespaceSymbol childNamespace] &&
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\CodeGenerationSymbolFactory.cs (1)
508public static INamespaceSymbol CreateNamespaceSymbol(string name, IList<ISymbol>? imports = null, IList<INamespaceOrTypeSymbol>? members = null)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\CodeGenerator.cs (4)
65public static Task<Document> AddNamedTypeDeclarationAsync(CodeGenerationSolutionContext context, INamespaceSymbol destination, INamedTypeSymbol namedType, CancellationToken cancellationToken) 72public static Task<Document> AddNamespaceDeclarationAsync(CodeGenerationSolutionContext context, INamespaceSymbol destination, INamespaceSymbol @namespace, CancellationToken cancellationToken) 79public static Task<Document> AddNamespaceOrTypeDeclarationAsync(CodeGenerationSolutionContext context, INamespaceSymbol destination, INamespaceOrTypeSymbol namespaceOrType, CancellationToken cancellationToken)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\ICodeGenerationService.cs (6)
49SyntaxNode CreateNamespaceDeclaration(INamespaceSymbol @namespace, CodeGenerationDestination destination, CodeGenerationContextInfo info, CancellationToken cancellationToken); 79TDeclarationNode AddNamespace<TDeclarationNode>(TDeclarationNode destination, INamespaceSymbol @namespace, CodeGenerationContextInfo info, CancellationToken cancellationToken) where TDeclarationNode : SyntaxNode; 159Task<Document> AddNamedTypeAsync(CodeGenerationSolutionContext context, INamespaceSymbol destination, INamedTypeSymbol namedType, CancellationToken cancellationToken); 164Task<Document> AddNamespaceAsync(CodeGenerationSolutionContext context, INamespaceSymbol destination, INamespaceSymbol @namespace, CancellationToken cancellationToken); 169Task<Document> AddNamespaceOrTypeAsync(CodeGenerationSolutionContext context, INamespaceSymbol destination, INamespaceOrTypeSymbol namespaceOrType, CancellationToken cancellationToken);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationNamespaceInfo.cs (4)
15private static readonly ConditionalWeakTable<INamespaceSymbol, CodeGenerationNamespaceInfo> s_namespaceToInfoMap = new(); 23INamespaceSymbol @namespace, 30private static CodeGenerationNamespaceInfo GetInfo(INamespaceSymbol @namespace) 36public static IList<ISymbol> GetImports(INamespaceSymbol @namespace)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationNamespaceSymbol.cs (5)
14internal sealed class CodeGenerationNamespaceSymbol(string name, IList<INamespaceOrTypeSymbol> members) : CodeGenerationNamespaceOrTypeSymbol(null, null, default, Accessibility.NotApplicable, default, name), INamespaceSymbol 39IEnumerable<INamespaceOrTypeSymbol> INamespaceSymbol.GetMembers(string name) 42public IEnumerable<INamespaceSymbol> GetNamespaceMembers() 43=> GetMembers().OfType<INamespaceSymbol>(); 59public ImmutableArray<INamespaceSymbol> ConstituentNamespaces
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationSymbol.cs (1)
90public INamespaceSymbol ContainingNamespace => null;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Editing\ImportAdderService.cs (10)
69protected abstract INamespaceSymbol? GetExplicitNamespaceSymbol(SyntaxNode node, SemanticModel model); 71private async Task<ISet<INamespaceSymbol>> GetSafeToAddImportsAsync( 72ImmutableArray<INamespaceSymbol> namespaceSymbols, 77using var _ = PooledHashSet<INamespaceSymbol>.GetInstance(out var conflicts); 92ImmutableArray<INamespaceSymbol> namespaceSymbols, 93HashSet<INamespaceSymbol> conflicts, 96private static SyntaxNode GenerateNamespaceImportDeclaration(INamespaceSymbol namespaceSymbol, SyntaxGenerator generator) 122var addedSymbols = new HashSet<INamespaceSymbol>(); 174using var _ = PooledDictionary<INamespaceSymbol, SyntaxNode>.GetInstance(out var importToSyntax); 254private static bool IsInsideNamespace(SyntaxNode node, INamespaceSymbol symbol, SemanticModel model, CancellationToken cancellationToken)
Microsoft.CodeAnalysis.CSharp (50)
Compilation\CSharpCompilation.cs (7)
330protected override INamespaceSymbol CommonCreateErrorNamespaceSymbol(INamespaceSymbol container, string name) 1442internal new NamespaceSymbol? GetCompilationNamespace(INamespaceSymbol namespaceSymbol) 1451var containingNamespace = namespaceSymbol.ContainingNamespace; 3915protected override INamespaceSymbol CommonGlobalNamespace 3994protected override INamespaceSymbol? CommonGetCompilationNamespace(INamespaceSymbol namespaceSymbol)
Compilation\CSharpSemanticModel.cs (2)
2959public abstract INamespaceSymbol GetDeclaredSymbol(NamespaceDeclarationSyntax declarationSyntax, CancellationToken cancellationToken = default(CancellationToken)); 2968public abstract INamespaceSymbol GetDeclaredSymbol(FileScopedNamespaceDeclarationSyntax declarationSyntax, CancellationToken cancellationToken = default(CancellationToken));
Compilation\MemberSemanticModel.cs (2)
591public override INamespaceSymbol GetDeclaredSymbol(NamespaceDeclarationSyntax declarationSyntax, CancellationToken cancellationToken = default(CancellationToken)) 597public override INamespaceSymbol GetDeclaredSymbol(FileScopedNamespaceDeclarationSyntax declarationSyntax, CancellationToken cancellationToken = default(CancellationToken))
Compilation\SpeculativeSemanticModelWithMemberModel.cs (2)
255public override INamespaceSymbol GetDeclaredSymbol(NamespaceDeclarationSyntax declarationSyntax, CancellationToken cancellationToken = default(CancellationToken)) 260public override INamespaceSymbol GetDeclaredSymbol(FileScopedNamespaceDeclarationSyntax declarationSyntax, CancellationToken cancellationToken = default(CancellationToken))
Compilation\SyntaxTreeSemanticModel.cs (3)
1306public override INamespaceSymbol GetDeclaredSymbol(NamespaceDeclarationSyntax declarationSyntax, CancellationToken cancellationToken = default(CancellationToken)) 1314public override INamespaceSymbol GetDeclaredSymbol(FileScopedNamespaceDeclarationSyntax declarationSyntax, CancellationToken cancellationToken = default) 2413Debug.Assert(((INamespaceSymbol)declaredSymbol).IsGlobalNamespace);
CSharpExtensions.cs (2)
1361public static INamespaceSymbol? GetDeclaredSymbol(this SemanticModel? semanticModel, NamespaceDeclarationSyntax declarationSyntax, CancellationToken cancellationToken = default(CancellationToken)) 1372public static INamespaceSymbol? GetDeclaredSymbol(this SemanticModel? semanticModel, FileScopedNamespaceDeclarationSyntax declarationSyntax, CancellationToken cancellationToken = default(CancellationToken))
src\Compilers\CSharp\CSharpAnalyzerDriver\CSharpDeclarationComputer.cs (3)
90INamespaceSymbol nsSymbol = declInfo.DeclaredSymbol as INamespaceSymbol; 94var declaredSymbol = getSymbol ? nsSymbol?.ContainingNamespace : null;
SymbolDisplay\SymbolDisplayVisitor.cs (5)
165public override void VisitNamespace(INamespaceSymbol symbol) 186var containingNamespace = symbol.ContainingNamespace; 204private void AddGlobalNamespace(INamespaceSymbol globalNamespace) 426var namespaceSymbol = containingSymbol as INamespaceSymbol;
SymbolDisplay\SymbolDisplayVisitor.Types.cs (2)
278var namespaceSymbol = (INamespaceSymbol)containingSymbol;
SymbolDisplay\SymbolDisplayVisitor_Minimal.cs (1)
58private void MinimallyQualify(INamespaceSymbol symbol)
Symbols\ModuleSymbol.cs (1)
335public NamespaceSymbol GetModuleNamespace(INamespaceSymbol namespaceSymbol)
Symbols\PublicModel\AssemblySymbol.cs (1)
21INamespaceSymbol IAssemblySymbol.GlobalNamespace
Symbols\PublicModel\ModuleSymbol.cs (3)
24INamespaceSymbol IModuleSymbol.GlobalNamespace 32INamespaceSymbol IModuleSymbol.GetModuleNamespace(INamespaceSymbol namespaceSymbol)
Symbols\PublicModel\NamespaceSymbol.cs (9)
27bool INamespaceSymbol.IsGlobalNamespace => _underlying.IsGlobalNamespace; 29NamespaceKind INamespaceSymbol.NamespaceKind => _underlying.NamespaceKind; 31Compilation INamespaceSymbol.ContainingCompilation => _underlying.ContainingCompilation; 33ImmutableArray<INamespaceSymbol> INamespaceSymbol.ConstituentNamespaces 41IEnumerable<INamespaceOrTypeSymbol> INamespaceSymbol.GetMembers() 49IEnumerable<INamespaceOrTypeSymbol> INamespaceSymbol.GetMembers(string name) 57IEnumerable<INamespaceSymbol> INamespaceSymbol.GetNamespaceMembers()
Symbols\PublicModel\PreprocessingSymbol.cs (1)
112INamespaceSymbol? ISymbol.ContainingNamespace => null;
Symbols\PublicModel\Symbol.cs (1)
209INamespaceSymbol ISymbol.ContainingNamespace => UnderlyingSymbol.ContainingNamespace.GetPublicSymbol();
Symbols\SymbolExtensions.cs (5)
414internal static NamespaceSymbol? EnsureCSharpSymbolOrNull(this INamespaceSymbol? symbol, string paramName) 587internal static INamespaceSymbol? GetPublicSymbol(this NamespaceSymbol? symbol) 589return symbol.GetPublicSymbol<INamespaceSymbol>(); 759internal static ImmutableArray<INamespaceSymbol> GetPublicSymbols(this ImmutableArray<NamespaceSymbol> symbols) 761return GetPublicSymbols<INamespaceSymbol>(StaticCast<Symbol>.From(symbols));
Microsoft.CodeAnalysis.CSharp.CodeStyle (3)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SemanticModelExtensions.cs (3)
161public static ISet<INamespaceSymbol> GetUsingNamespacesInScope(this SemanticModel semanticModel, SyntaxNode location) 164var result = new HashSet<INamespaceSymbol>(); 175result.Add((INamespaceSymbol)symbolInfo.Symbol);
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (27)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\CSharpCodeGenerationService.cs (2)
267protected override TDeclarationNode AddNamespace<TDeclarationNode>(TDeclarationNode destination, INamespaceSymbol @namespace, CSharpCodeGenerationContextInfo info, IList<bool>? availableIndices, CancellationToken cancellationToken) 713INamespaceSymbol @namespace, CodeGenerationDestination destination, CSharpCodeGenerationContextInfo info, CancellationToken cancellationToken)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\NamespaceGenerator.cs (7)
27INamespaceSymbol @namespace, 47INamespaceSymbol @namespace, 68INamespaceSymbol @namespace, 98string name, INamespaceSymbol innermostNamespace, 119INamespaceSymbol @namespace, 120INamespaceSymbol innermostNamespace, 139private static SyntaxList<UsingDirectiveSyntax> GenerateUsingDirectives(INamespaceSymbol innermostNamespace)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Editing\CSharpImportAdder.cs (15)
28protected override INamespaceSymbol? GetExplicitNamespaceSymbol(SyntaxNode node, SemanticModel model) 44ImmutableArray<INamespaceSymbol> namespaceSymbols, 45HashSet<INamespaceSymbol> conflicts, 52private static INamespaceSymbol? GetExplicitNamespaceSymbol(ExpressionSyntax fullName, ExpressionSyntax namespacePart, SemanticModel model) 56if (symbol != null && symbol.Kind != SymbolKind.Namespace && model.GetSymbolInfo(namespacePart).Symbol is INamespaceSymbol) 59var ns = symbol.ContainingNamespace; 85private readonly MultiDictionary<(string name, int arity), INamespaceSymbol> _importedTypes = []; 97private readonly MultiDictionary<string, INamespaceSymbol> _importedExtensionMethods = []; 101ImmutableArray<INamespaceSymbol> namespaceSymbols) 108private void AddImportedMembers(ImmutableArray<INamespaceSymbol> namespaceSymbols) 110foreach (var ns in namespaceSymbols) 128public async Task AddPotentiallyConflictingImportsAsync(SyntaxNode container, HashSet<INamespaceSymbol> conflicts, CancellationToken cancellationToken) 134await ProducerConsumer<INamespaceSymbol>.RunParallelAsync( 213private void ProduceConflicts(SimpleNameSyntax node, Action<INamespaceSymbol> addConflict, CancellationToken cancellationToken) 223private void ProduceConflicts(MemberAccessExpressionSyntax node, bool containsAnonymousMethods, Action<INamespaceSymbol> addConflict, CancellationToken cancellationToken)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ITypeSymbolExtensions.ExpressionSyntaxGeneratorVisitor.cs (1)
85public override ExpressionSyntax VisitNamespace(INamespaceSymbol symbol)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ITypeSymbolExtensions.TypeSyntaxGeneratorVisitor.cs (1)
318public override TypeSyntax VisitNamespace(INamespaceSymbol symbol)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\SemanticModelExtensions.cs (1)
21public static INamespaceSymbol GetDeclaredSymbol(this SemanticModel semanticModel, BaseNamespaceDeclarationSyntax declarationSyntax, CancellationToken cancellationToken = default)
Microsoft.CodeAnalysis.CSharp.EditorFeatures.UnitTests (14)
SymbolKey\SymbolKeyCompilationsTests.cs (14)
130var ns = comp.SourceModule.GlobalNamespace.GetMembers("NS").Single() as INamespaceSymbol; 157var ns = comp.SourceModule.GlobalNamespace.GetMembers("NS").Single() as INamespaceSymbol; 185var ns = comp.SourceModule.GlobalNamespace.GetMembers("NS").Single() as INamespaceSymbol; 463var namespace1 = comp1.SourceModule.GlobalNamespace.GetMembers("NS").Single() as INamespaceSymbol; 466var namespace2 = comp2.SourceModule.GlobalNamespace.GetMembers("NS").Single() as INamespaceSymbol; 571var namespace1 = comp1.SourceModule.GlobalNamespace.GetMembers("NS").Single() as INamespaceSymbol; 574var namespace2 = comp2.SourceModule.GlobalNamespace.GetMembers("NS").Single() as INamespaceSymbol;
Microsoft.CodeAnalysis.CSharp.Emit.UnitTests (4)
CodeGen\CodeGenInterfaceImplementation.cs (1)
2736var global = comp.GlobalNamespace;
CodeGen\CodeGenOverridingAndHiding.cs (1)
3941var globalNamespace = compilation.GlobalNamespace;
CodeGen\CodeGenTupleTest.cs (1)
6224var ns = comp.CreateErrorNamespaceSymbol(comp.GlobalNamespace, "a");
CodeGen\DestructorTests.cs (1)
671var globalNamespace = compilation.GlobalNamespace;
Microsoft.CodeAnalysis.CSharp.Emit3.UnitTests (7)
Attributes\AttributeTests.cs (5)
3260var globalNs = compilation.GlobalNamespace; 3308var globalNs = compilation.GlobalNamespace; 3360var globalNs = compilation.GlobalNamespace; 3412var globalNs = compilation.GlobalNamespace; 5420var global = comp.SourceModule.GlobalNamespace;
Attributes\AttributeTests_Nullable.cs (2)
4078var globalNamespace = comp.GlobalNamespace; 4164var globalNamespace = comp.GlobalNamespace;
Microsoft.CodeAnalysis.CSharp.Features (13)
AddImport\CSharpAddImportFeatureService.cs (1)
227protected override ISet<INamespaceSymbol> GetImportNamespacesInScope(
Completion\CompletionProviders\DeclarationName\DeclarationNameRecommender.cs (6)
179var system = compilation.GlobalNamespace.GetMembers(nameof(System)).OfType<INamespaceSymbol>().FirstOrDefault(); 180var systemCollections = system?.GetMembers(nameof(System.Collections)).OfType<INamespaceSymbol>().FirstOrDefault(); 189foreach (var childNamespace in systemCollections.GetNamespaceMembers()) 198static bool Check(INamespaceSymbol? namespaceSymbol, string name)
DecompiledSource\CSharpDecompiledSourceService.cs (1)
113symbol is not null and not INamespaceSymbol { IsGlobalNamespace: true };
GenerateType\CSharpGenerateTypeService.cs (2)
567public override async Task<(INamespaceSymbol, INamespaceOrTypeSymbol, Location)> GetOrGenerateEnclosingNamespaceSymbolAsync( 580if (enclosingNamespaceSymbol.Symbol is INamespaceSymbol namespaceSymbol)
src\Compilers\CSharp\CSharpAnalyzerDriver\CSharpDeclarationComputer.cs (3)
90INamespaceSymbol nsSymbol = declInfo.DeclaredSymbol as INamespaceSymbol; 94var declaredSymbol = getSymbol ? nsSymbol?.ContainingNamespace : null;
Microsoft.CodeAnalysis.CSharp.Scripting.UnitTests (1)
InteractiveSessionTests.cs (1)
1192Assert.True(import.NamespaceOrType is INamespaceSymbol { Name: "System", ContainingNamespace.IsGlobalNamespace: true });
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (40)
Semantics\AccessCheckTests.cs (3)
737INamespaceSymbol globalNS = c.GlobalNamespace; 859INamespaceSymbol otherGlobalNS = otherC.GlobalNamespace; 898INamespaceSymbol globalNS = c1.GlobalNamespace;
Semantics\ConstantTests.cs (6)
2999var global = compilation.GlobalNamespace; 3031var global = compilation.GlobalNamespace; 3086var global = compilation.GlobalNamespace; 3118var global = compilation.GlobalNamespace; 3176var global = compilation.GlobalNamespace; 3211var global = compilation.GlobalNamespace;
Semantics\DynamicTests.cs (1)
4154var global = comp.GlobalNamespace;
Semantics\ExpressionBodiedMemberTests.cs (4)
80var global = comp.GlobalNamespace; 231var global = comp.GlobalNamespace; 287var global = comp.GlobalNamespace; 320var global = comp.GlobalNamespace;
Semantics\LocalFunctionTests.cs (2)
1790.GetMember<INamespaceSymbol>("System") 1865.GetMember<INamespaceSymbol>("System")
Semantics\LookupTests.cs (7)
1394var systemNS = (INamespaceSymbol)actual_lookupSymbols.Where((sym) => sym.Name.Equals("System") && sym.Kind == SymbolKind.Namespace).Single(); 1395INamespaceSymbol systemXmlNS = systemNS.GetNestedNamespace("Xml"); 1524var namespaceX = (INamespaceSymbol)actual_lookupSymbols.Where((sym) => sym.Name.Equals("X") && sym.Kind == SymbolKind.Namespace).Single(); 1527INamespaceSymbol namespaceY = namespaceX.GetNestedNamespace("Y"); 1710var global = comp.GlobalNamespace;
Semantics\ScriptSemanticsTests.cs (3)
372var global = compilation.GlobalNamespace; 403var global = compilation.GlobalNamespace; 449var global = compilation.GlobalNamespace;
Semantics\TopLevelStatementsTests.cs (4)
711Assert.True(((INamespaceSymbol)local.ContainingSymbol.ContainingSymbol.ContainingSymbol).IsGlobalNamespace); 4227Assert.True(((INamespaceSymbol)local.ContainingSymbol.ContainingSymbol.ContainingSymbol).IsGlobalNamespace); 4905Assert.True(((INamespaceSymbol)label.ContainingSymbol.ContainingSymbol.ContainingSymbol).IsGlobalNamespace); 4990Assert.True(((INamespaceSymbol)label.ContainingSymbol.ContainingSymbol.ContainingSymbol).IsGlobalNamespace);
Semantics\UnsafeTests.cs (10)
5520var globalNamespace = compilation.GlobalNamespace; 5557var globalNamespace = compilation.GlobalNamespace; 5680var globalNamespace = compilation.GlobalNamespace; 5724var globalNamespace = compilation.GlobalNamespace; 5763var globalNamespace = compilation.GlobalNamespace; 5807var globalNamespace = compilation.GlobalNamespace; 5830var globalNamespace = compilation.GlobalNamespace; 5843var globalNamespace = compilation.GlobalNamespace; 5865var globalNamespace = compilation.GlobalNamespace; 5885var globalNamespace = compilation.GlobalNamespace;
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (409)
Compilation\CompilationAPITests.cs (1)
1327comp.GetCompilationNamespace(namespaceSymbol: (INamespaceSymbol)null);
Compilation\GetImportScopesTests.cs (36)
55Assert.True(scopes.Single().Imports.Single().NamespaceOrType is INamespaceSymbol { ContainingNamespace.IsGlobalNamespace: true, Name: nameof(System) }); 71Assert.True(scopes.Single().Imports.Single().NamespaceOrType is INamespaceSymbol { ContainingNamespace.IsGlobalNamespace: true, Name: nameof(System) }); 102Assert.True(scopes.Single().Imports.Single().NamespaceOrType is INamespaceSymbol { ContainingNamespace.IsGlobalNamespace: true, Name: nameof(System) }); 130Assert.True(scopes.Single().Imports.Single().NamespaceOrType is INamespaceSymbol { ContainingNamespace.IsGlobalNamespace: true, Name: nameof(System) }); 147Assert.True(scopes.Single().Imports.Any(i => i.NamespaceOrType is INamespaceSymbol { ContainingNamespace.IsGlobalNamespace: true, Name: nameof(System) })); 148Assert.True(scopes.Single().Imports.Any(i => i.NamespaceOrType is INamespaceSymbol { ContainingNamespace.IsGlobalNamespace: true, Name: nameof(Microsoft) })); 175Assert.True(scopes.Single().Imports.Single().NamespaceOrType is INamespaceSymbol { ContainingNamespace.IsGlobalNamespace: true, Name: nameof(System) }); 198Assert.True(scopes[0].Imports.Single().NamespaceOrType is INamespaceSymbol { ContainingNamespace.IsGlobalNamespace: true, Name: nameof(Microsoft) }); 200Assert.True(scopes[1].Imports.Single().NamespaceOrType is INamespaceSymbol { ContainingNamespace.IsGlobalNamespace: true, Name: nameof(System) }); 226Assert.True(scopes[0].Imports.Single().NamespaceOrType is INamespaceSymbol { ContainingNamespace.IsGlobalNamespace: true, Name: nameof(Microsoft) }); 228Assert.True(scopes[1].Imports.Single().NamespaceOrType is INamespaceSymbol { ContainingNamespace.IsGlobalNamespace: true, Name: nameof(System) }); 244Assert.True(scopes.Single().Aliases.Single() is { Name: "S", Target: INamespaceSymbol { ContainingNamespace.IsGlobalNamespace: true, Name: nameof(System) } }); 291Assert.True(scopes.Single().Aliases.Single() is { Name: "S", Target: INamespaceSymbol { ContainingNamespace.IsGlobalNamespace: true, Name: nameof(System) } }); 336Assert.True(scopes.Single().Aliases.Any(a => a is { Name: "S", Target: INamespaceSymbol { ContainingNamespace.IsGlobalNamespace: true, Name: nameof(System) } })); 337Assert.True(scopes.Single().Aliases.Any(a => a is { Name: "M", Target: INamespaceSymbol { ContainingNamespace.IsGlobalNamespace: true, Name: nameof(Microsoft) } })); 364Assert.True(scopes.Single().Aliases.Single() is { Name: "S", Target: INamespaceSymbol { ContainingNamespace.IsGlobalNamespace: true, Name: nameof(System) } }); 387Assert.True(scopes[0].Aliases.Single() is { Name: "M", Target: INamespaceSymbol { ContainingNamespace.IsGlobalNamespace: true, Name: nameof(Microsoft) } }); 389Assert.True(scopes[1].Aliases.Single() is { Name: "S", Target: INamespaceSymbol { ContainingNamespace.IsGlobalNamespace: true, Name: nameof(System) } }); 437Assert.True(scopes.Single().ExternAliases.Single() is { Name: "CORE", Target: INamespaceSymbol { IsGlobalNamespace: true } }); 459Assert.True(scopes.Single().ExternAliases.Single() is { Name: "CORE", Target: INamespaceSymbol { IsGlobalNamespace: true } }); 480Assert.True(scopes.Single().ExternAliases.Single() is { Name: "CORE", Target: INamespaceSymbol { IsGlobalNamespace: true } }); 499Assert.True(scopes.Single().ExternAliases.Single() is { Name: "CORE", Target: INamespaceSymbol { IsGlobalNamespace: true } }); 516Assert.True(scopes.Single().ExternAliases.Single() is { Name: "CORE", Target: INamespaceSymbol { IsGlobalNamespace: true } }); 536Assert.True(scopes.Single().ExternAliases.Any(a => a is { Name: "CORE1", Target: INamespaceSymbol { IsGlobalNamespace: true } })); 537Assert.True(scopes.Single().ExternAliases.Any(a => a is { Name: "CORE2", Target: INamespaceSymbol { IsGlobalNamespace: true } })); 567Assert.True(scopes.Single().ExternAliases.Single() is { Name: "CORE1", Target: INamespaceSymbol { IsGlobalNamespace: true } }); 593Assert.True(scopes[0].ExternAliases.Single() is { Name: "CORE2", Target: INamespaceSymbol { IsGlobalNamespace: true } }); 595Assert.True(scopes[1].ExternAliases.Single() is { Name: "CORE1", Target: INamespaceSymbol { IsGlobalNamespace: true } }); 622Assert.True(scopes.Single().Aliases.Single() is { Name: "M", Target: INamespaceSymbol { Name: nameof(Microsoft) } }); 625Assert.True(scopes.Single().Imports.Single().NamespaceOrType is INamespaceSymbol { ContainingNamespace.IsGlobalNamespace: true, Name: nameof(System) }); 648Assert.True(scopes.Single().Imports.Single().NamespaceOrType is INamespaceSymbol { ContainingNamespace.IsGlobalNamespace: true, Name: nameof(System) }); 652Assert.True(scopes.Single().Aliases.Single() is { Name: "M", Target: INamespaceSymbol { Name: nameof(Microsoft) } }); 682Assert.True(scopes.Single().Imports.Any(i => i.NamespaceOrType is INamespaceSymbol { ContainingNamespace.IsGlobalNamespace: true, Name: nameof(System) })); 684Assert.True(scopes.Single().Imports.Any(i => i.NamespaceOrType is INamespaceSymbol { ContainingNamespace.IsGlobalNamespace: false, Name: nameof(System.IO) })); 688Assert.True(scopes.Single().Aliases.Any(i => i is { Name: "M", Target: INamespaceSymbol { ContainingNamespace.IsGlobalNamespace: true, Name: nameof(Microsoft) } })); 690Assert.True(scopes.Single().Aliases.Any(i => i is { Name: "T", Target: INamespaceSymbol { ContainingNamespace.IsGlobalNamespace: false, Name: nameof(System.Threading) } }));
Compilation\GetSemanticInfoTests.cs (8)
1390return (INamedTypeSymbol)comp.GlobalNamespace.GetMember<INamespaceSymbol>("System").GetMembers("Action").Where(s => !((INamedTypeSymbol)s).IsGenericType).Single(); 4428var global = compilation.GlobalNamespace; 4482var global = compilation.GlobalNamespace; 4528var global = compilation.GlobalNamespace; 4582var global = compilation.GlobalNamespace; 4676var global = comp.GlobalNamespace; 4721var global = comp.GlobalNamespace; 5722var global = comp.GlobalNamespace;
Compilation\SemanticModelAPITests.cs (11)
408var symbol = model.GetDeclaredSymbol(nsSyntax); 429var symbol = model.GetDeclaredSymbol(nsSyntax); 461var global = comp.GlobalNamespace; 757var global = comp.GlobalNamespace; 825var bInner = (comp.GlobalNamespace.GetMembers("N").Single() as INamespaceSymbol).GetTypeMembers("B", 0).Single(); 1235Assert.Equal(symbol.Target, comp.GlobalNamespace.GetMember<INamespaceSymbol>("System")); 1270var aliasTarget = (INamespaceSymbol)aliasSymbol.Target; 3852var target = (INamespaceSymbol)((IAliasSymbol)symbol).Target; 4376var globalNs = compilation.GlobalNamespace;
Compilation\SemanticModelGetDeclaredSymbolAPITests.cs (39)
106var symbol = model.GetDeclaredSymbol(decl); 940var nsSymbol = model.GetDeclaredSymbol(nsDecl); 960var nsSymbol01 = model.GetDeclaredSymbol(nsDecl); 2760var global = compilation.GlobalNamespace; 2786var globalNS = compilation.SourceModule.GlobalNamespace; 2787var n1 = globalNS.GetMembers("NS").First() as INamespaceSymbol; 2907var globalNS = compilation.SourceModule.GlobalNamespace; 2908var n1 = globalNS.GetMembers().First() as INamespaceSymbol; 2909var n2 = n1.GetMembers().First() as INamespaceSymbol; 2910var n3 = n2.GetMembers().First() as INamespaceSymbol; 2913var dn1 = model.GetDeclaredSymbol(nsSyntax); 2916var dn23 = model.GetDeclaredSymbol(nsSyntax23); 2937var compSym = compilation.GlobalNamespace.GetMembers("System").First() as INamespaceSymbol; 2940var declsym = model.GetDeclaredSymbol(nsSyntax); 2969var globalNS = compilation.SourceModule.GlobalNamespace; 3018var globalNS = compilation.SourceModule.GlobalNamespace; 3019var ns1 = globalNS.GetMembers("NS").Single() as INamespaceSymbol; 3045var globalNS = compilation.SourceModule.GlobalNamespace; 3075var globalNS = compilation.SourceModule.GlobalNamespace; 3076var ns1 = globalNS.GetMembers("NS").Single() as INamespaceSymbol; 3111var nsg = comp.GlobalNamespace; 3112var ns1 = nsg.GetMembers("NS1").Single() as INamespaceSymbol; 3113var ns2 = ns1.GetMembers("NS2").Single() as INamespaceSymbol; 3117var dsym1 = model.GetDeclaredSymbol(nsSyntax1); 3118var dsym2 = model.GetDeclaredSymbol(nsSyntax2); 3141var globalNS = compilation.SourceModule.GlobalNamespace; 3740var declSymbol = model.GetDeclaredSymbol(decl); 3752var declSymbol2 = model.GetDeclaredSymbol(decl2); 4531var @namespace = compilation.GlobalNamespace.GetMember<INamespaceSymbol>("Goo"); 4568var @namespace = compilation.GlobalNamespace.GetMember<INamespaceSymbol>("Goo");
Compilation\SemanticModelGetSemanticInfoTests.cs (5)
1355type = compilation.GlobalNamespace.GetMember<INamespaceSymbol>("N2").GetMember<INamedTypeSymbol>("C"); 1393type = compilation.GlobalNamespace.GetMember<INamespaceSymbol>("N").GetMember<INamedTypeSymbol>("C"); 4386Assert.True(((INamespaceSymbol)semanticInfo.Type.ContainingSymbol).IsGlobalNamespace); 11645Assert.True(((INamespaceSymbol)semanticInfo.Symbol).IsGlobalNamespace); 11679Assert.True(((INamespaceSymbol)semanticInfo.Symbol).IsGlobalNamespace);
Compilation\SymbolVisitorTests.cs (3)
136public override void VisitNamespace(INamespaceSymbol symbol) 317public override string VisitNamespace(INamespaceSymbol symbol) 408public override int VisitNamespace(INamespaceSymbol symbol, StringBuilder argument)
DocumentationComments\CrefTests.cs (3)
3372var global = compilation.GlobalNamespace; 4980var global = compilation.GlobalNamespace; 5847GetMember<INamespaceSymbol>("System").GetMembers("Action").OfType<INamedTypeSymbol>().
DocumentationComments\DocumentationCommentIDTests.cs (1)
239var symbol = comp.GlobalNamespace;
SymbolDisplay\SymbolDisplayTests.cs (5)
3591var global = comp.GlobalNamespace; 3620var global = comp.GlobalNamespace; 5381var global = comp.GlobalNamespace; 5686var global = comp.GlobalNamespace; 5890var global = comp.GlobalNamespace;
Symbols\AccessorOverriddenOrHiddenMembersTests.cs (13)
42var global = compilation.GlobalNamespace; 101var global = compilation.GlobalNamespace; 152var global = compilation.GlobalNamespace; 207var global = compilation.GlobalNamespace; 317var global = compilation.GlobalNamespace; 347var global = compilation.GlobalNamespace; 380var global = compilation.GlobalNamespace; 419var global = compilation.GlobalNamespace; 472var global = compilation.GlobalNamespace; 566var global = compilation.GlobalNamespace; 634var global = compilation.GlobalNamespace; 694var global = compilation.GlobalNamespace; 752var global = compilation.GlobalNamespace;
Symbols\AssemblyAndNamespaceTests.cs (7)
125var global = comp.GlobalNamespace; 168var global = comp.GlobalNamespace; 213var global = comp.GlobalNamespace; // throw 261var global = comp.GlobalNamespace; // throw 302var global = comp.GlobalNamespace; // throw 334var globalNS = compilation.SourceModule.GlobalNamespace; 355var global = compilation.GlobalNamespace;
Symbols\ConversionTests.cs (1)
228var global = compilation.GlobalNamespace;
Symbols\CovariantReturnTests.cs (1)
3776var globalNamespace = comp.GlobalNamespace;
Symbols\ExtensionMethodTests.cs (2)
2948var globalNamespace = compilation.GlobalNamespace; 3006var globalNamespace = compilation.GlobalNamespace;
Symbols\GenericConstraintTests.cs (5)
3354var globalNamespace = compilation.GlobalNamespace; 5245var @namespace = compilation.GlobalNamespace; 5288var @namespace = compilation.GlobalNamespace; 5469var @namespace = compilation.GlobalNamespace; 5588var @namespace = compilation.GlobalNamespace;
Symbols\InterfaceImplementationTests.cs (30)
49var global = comp.GlobalNamespace; 120var global = comp.GlobalNamespace; 176var global = comp.GlobalNamespace; 243var global = comp.GlobalNamespace; 315var global = comp.GlobalNamespace; 372var global = comp.GlobalNamespace; 429var global = comp.GlobalNamespace; 505var global = comp.GlobalNamespace; 573var global = comp.GlobalNamespace; 623var global = comp.GlobalNamespace; 674var global = comp.GlobalNamespace; 735var global = comp.GlobalNamespace; 825var global = comp.GlobalNamespace; 907var global = comp.GlobalNamespace; 978var global = comp2.GlobalNamespace; 1055var global = comp.GlobalNamespace; 1148var global = comp.GlobalNamespace; 1218var global = comp.GlobalNamespace; 1289var global = comp.GlobalNamespace; 1345var global = comp.GlobalNamespace; 1420var global = comp.GlobalNamespace; 1540var global = comp.GlobalNamespace; 1629var global = comp.GlobalNamespace; 1689var global = comp.GlobalNamespace; 1761var globalNamespace = compilation.GlobalNamespace; 1856var global = comp.GlobalNamespace; 1958var global = comp.GlobalNamespace; 2021var global = comp.GlobalNamespace; 2211var global = comp.GlobalNamespace; 2284var global = comp.GlobalNamespace;
Symbols\InterfaceOverriddenOrHiddenMembersTests.cs (1)
797var global = comp.GlobalNamespace;
Symbols\MethodEqualityTests.cs (4)
34var global = comp.GlobalNamespace; 81var global = comp.GlobalNamespace; 141var global = comp.GlobalNamespace; 200var global = comp.GlobalNamespace;
Symbols\OverriddenOrHiddenMembersTests.cs (24)
76var global = comp.GlobalNamespace; 163var global = comp.GlobalNamespace; 243var global = comp.GlobalNamespace; 334var global = comp.GlobalNamespace; 415var global = comp.GlobalNamespace; 466var global = comp.GlobalNamespace; 526var global = comp.GlobalNamespace; 602var global = comp.GlobalNamespace; 664var global = comp.GlobalNamespace; 744var global = comp.GlobalNamespace; 898var global = comp.GlobalNamespace; 1000var global = comp.GlobalNamespace; 1069var global = comp.GlobalNamespace; 1915var global = comp.GlobalNamespace; 1943var global = comp.GlobalNamespace; 1971var global = comp.GlobalNamespace; 2002var global = comp.GlobalNamespace; 2031var global = comp.GlobalNamespace; 2098var global = comp.GlobalNamespace; 2433var global = comp.GlobalNamespace; 2492var global = comp.GlobalNamespace; 2557var global = comp.GlobalNamespace; 2616var global = comp.GlobalNamespace; 3583var global = comp.GlobalNamespace;
Symbols\Retargeting\RetargetExplicitInterfaceImplementation.cs (4)
56var globalNamespace1 = comp1.GlobalNamespace; 122var globalNamespace2 = comp2.GlobalNamespace; 352var globalNamespace1 = comp1.GlobalNamespace; 386var globalNamespace2 = comp2.GlobalNamespace;
Symbols\Retargeting\RetargetingTests.cs (5)
41var sourceNamespace = sourceModule.GlobalNamespace; 112var sourceNamespace = sourceModule.GlobalNamespace; 145var sourceNamespace = sourceModule.GlobalNamespace; 179var sourceNamespace = sourceModule.GlobalNamespace; 215var sourceNamespace = sourceModule.GlobalNamespace;
Symbols\Source\AccessTests.cs (4)
29var global = comp.GlobalNamespace; 46var global = comp.GlobalNamespace; 72var global = comp.GlobalNamespace; 95var global = comp.GlobalNamespace;
Symbols\Source\BaseClassTests.cs (40)
35var global = comp.GlobalNamespace; 55var global = comp.GlobalNamespace; 78var global = comp.GlobalNamespace; 102var global = comp.GlobalNamespace; 131var global = comp.GlobalNamespace; 157var global = comp.GlobalNamespace; 180var global = comp.GlobalNamespace; 233var global = comp.GlobalNamespace; 262var global = comp.GlobalNamespace; 299var global = comp.GlobalNamespace; 462var global = comp.GlobalNamespace; 480var global = comp.GlobalNamespace; 498var global = comp.GlobalNamespace; 518var global = comp.GlobalNamespace; 532var global = comp.GlobalNamespace; 547var global = comp.GlobalNamespace; 565var global = comp.GlobalNamespace; 585var global = comp.GlobalNamespace; 604var global = comp.GlobalNamespace; 624var global = comp.GlobalNamespace; 649var global = comp.GlobalNamespace; 668var global = comp.GlobalNamespace; 685var global = comp.GlobalNamespace; 994var global = comp.GlobalNamespace; 1015var global1 = comp.GlobalNamespace; 1033var global = comp2.GlobalNamespace; 1071var global1 = comp.GlobalNamespace; 1093var global = comp2.GlobalNamespace; 1129var global1 = comp.GlobalNamespace; 1162var global = comp2.GlobalNamespace; 1187var global1 = comp.GlobalNamespace; 1219var global = comp2.GlobalNamespace; 1253var global = comp.GlobalNamespace; 1278var global = comp.GlobalNamespace; 1300var global = comp.GlobalNamespace; 1319var global = comp.GlobalNamespace; 1335var global = comp.GlobalNamespace; 1379var global = comp.GlobalNamespace; 1411var global = comp.GlobalNamespace; 1561var global = comp.GlobalNamespace;
Symbols\Source\CompletionTests.cs (2)
33var global = comp.GlobalNamespace; 73var global = comp.GlobalNamespace;
Symbols\Source\CustomModifierCopyTests.cs (28)
50var global = comp.GlobalNamespace; 93var global = comp.GlobalNamespace; 144var global = comp.GlobalNamespace; 193var global = comp.GlobalNamespace; 255var global = comp.GlobalNamespace; 320var global = comp.GlobalNamespace; 356var global = comp.GlobalNamespace; 410var global = comp.GlobalNamespace; 519var global = comp.GlobalNamespace; 588var global = comp.GlobalNamespace; 637var global = comp.GlobalNamespace; 691var global = comp.GlobalNamespace; 724var global = comp.GlobalNamespace; 765var global = comp.GlobalNamespace; 808var global = comp.GlobalNamespace; 917var global = comp.GlobalNamespace; 961var global = comp.GlobalNamespace; 1398var global = comp.GlobalNamespace; 1438var global = comp.GlobalNamespace; 1483var global = comp.GlobalNamespace; 1527var global = comp.GlobalNamespace; 1582var global = comp.GlobalNamespace; 1636var global = comp.GlobalNamespace; 1686var global = comp.GlobalNamespace; 1771var global = comp.GlobalNamespace; 1888var global = comp.GlobalNamespace; 1985var global = comp.GlobalNamespace; 2087var global = comp.GlobalNamespace;
Symbols\Source\DeclaringSyntaxNodeTests.cs (24)
93if (symbol.Kind == SymbolKind.Namespace && ((INamespaceSymbol)symbol).IsGlobalNamespace) 189var global = comp.GlobalNamespace; 190var n1 = global.GetMembers("N1").Single() as INamespaceSymbol; 233var global = comp.GlobalNamespace; 234var n1 = global.GetMembers("N1").Single() as INamespaceSymbol; 260var global = comp.GlobalNamespace; 303var global = comp.GlobalNamespace; 408var global = comp.GlobalNamespace; 409var system = global.GetMembers("System").Single() as INamespaceSymbol; 410var n1 = global.GetMembers("N1").Single() as INamespaceSymbol; 411var n2 = n1.GetMembers("N2").Single() as INamespaceSymbol; 412var n3 = n2.GetMembers("N3").Single() as INamespaceSymbol; 448var global = comp.GlobalNamespace; 449var n1 = global.GetMembers("N1").Single() as INamespaceSymbol; 515var global = comp.GlobalNamespace; 516var n1 = global.GetMembers("N1").Single() as INamespaceSymbol;
Symbols\Source\DelegateTests.cs (6)
71var global = comp.GlobalNamespace; 91var global = comp.GlobalNamespace; 106var global = comp.GlobalNamespace; 155var global = comp.GlobalNamespace; 779var global = comp.GlobalNamespace; 796var global = comp.GlobalNamespace;
Symbols\Source\EnumTests.cs (1)
1005var global = comp.SourceModule.GlobalNamespace;
Symbols\Source\EventTests.cs (5)
78var global = comp.GlobalNamespace; 117var global = comp.GlobalNamespace; 155var global = comp.GlobalNamespace; 190var global = comp.GlobalNamespace; 2258var global = comp.GlobalNamespace;
Symbols\Source\ExpressionBodiedMethodTests.cs (2)
201var global = comp.GlobalNamespace; 279var global = comp.GlobalNamespace;
Symbols\Source\ExpressionBodiedPropertyTests.cs (6)
256var global = comp.GlobalNamespace; 384var global = comp.GlobalNamespace; 503var global = comp.GlobalNamespace; 526var global = comp.GlobalNamespace; 553var global = comp.GlobalNamespace; 581var global = comp.GlobalNamespace;
Symbols\Source\ExternAliasTests.cs (6)
411return (INamespaceSymbol)aliasSymbol.Target; 414var firstTarget = targets.First(); 437return (INamespaceSymbol)aliasSymbol.Target; 440var firstTarget = targets.First(); 484var aliasedGlobalNamespace = ((IAssemblySymbol)comp.GetAssemblyOrModuleSymbol(libRef)).GlobalNamespace; 485var namespaceN = aliasedGlobalNamespace.GetMember<INamespaceSymbol>("N");
Symbols\Source\FieldTests.cs (7)
61var global = comp.GlobalNamespace; 89var global = comp.GlobalNamespace; 118var global = comp.GlobalNamespace; 142var global = comp.GlobalNamespace; 176var global = comp.GlobalNamespace; 496var global = comp.GlobalNamespace; 516var global = comp.GlobalNamespace;
Symbols\Source\LocationTests.cs (1)
27var global = comp.GlobalNamespace;
Symbols\Source\MethodTests.cs (21)
34var global = comp.GlobalNamespace; 69var global = comp.GlobalNamespace; 114var global = comp.GlobalNamespace; 139var global = comp.GlobalNamespace; 166var global = comp.GlobalNamespace; 188var global = comp.GlobalNamespace; 210var global = comp.GlobalNamespace; 229var global = comp.GlobalNamespace; 257var global = comp.GlobalNamespace; 282var global = comp.GlobalNamespace; 303var global = comp.GlobalNamespace; 325var global = comp.GlobalNamespace; 341var global = comp.GlobalNamespace; 358var global = comp.GlobalNamespace; 402var global = comp.GlobalNamespace; 1664var globalNamespace = comp.GlobalNamespace; 1707var globalNamespace = comp.GlobalNamespace; 1753var globalNamespace = comp.GlobalNamespace; 1803var globalNamespace = comp.GlobalNamespace; 1957var globalNamespace = comp.GlobalNamespace; 2001var globalNamespace = comp.GlobalNamespace;
Symbols\Source\ModifierTests.cs (1)
48var global = comp.GlobalNamespace;
Symbols\Source\PropertyTests.cs (9)
181var global = comp.GlobalNamespace; 242var global = comp.GlobalNamespace; 358var global = comp.GlobalNamespace; 391var global = comp.GlobalNamespace; 1747var globalNamespace = comp.GlobalNamespace; 1781var globalNamespace = comp.GlobalNamespace; 1818var globalNamespace = comp.GlobalNamespace; 1923var global = comp.GlobalNamespace; 1954var globalNamespace = comp.SourceModule.GlobalNamespace;
Symbols\Source\SourcePlusMetadataTests.cs (5)
27var global = comp.GlobalNamespace; 44var global = comp.GlobalNamespace; 60var global = comp.GlobalNamespace; 81var global = comp.GlobalNamespace; 250var global = comp.GlobalNamespace;
Symbols\Source\TypeMapTests.cs (2)
54var global = comp.GlobalNamespace; 113var global = comp.GlobalNamespace;
Symbols\Source\UsingAliasTests.cs (4)
392var global = (INamespaceSymbol)alias.ContainingSymbol; 413var global = (INamespaceSymbol)alias.ContainingSymbol;
Symbols\TypeTests.cs (19)
86var global = comp.GlobalNamespace; 125var global = comp.GlobalNamespace; 204var global = comp.GlobalNamespace; 272var global = comp.GlobalNamespace; 347var global = comp.GlobalNamespace; 540var globalNS = compilation.SourceModule.GlobalNamespace; 588var globalNS = compilation.SourceModule.GlobalNamespace; 620var global = CreateCompilation(text).GlobalNamespace; 904var globalNS = comp.SourceModule.GlobalNamespace; 1036var global = comp.GlobalNamespace; 1061var global = comp.GlobalNamespace; 1079var global = comp.GlobalNamespace; 1101var global = comp.GlobalNamespace; 1119var global = comp.GlobalNamespace; 1180var global = comp.GlobalNamespace; 1199var global = comp.GlobalNamespace; 1238var global = comp.SourceModule.GlobalNamespace; 1305var global = comp.SourceModule.GlobalNamespace; 1420var globalNS = compilation.GlobalNamespace;
Symbols\TypeUnificationTests.cs (7)
47var global = comp.GlobalNamespace; 131var global = comp.GlobalNamespace; 204var global = comp.GlobalNamespace; 246var global = comp.GlobalNamespace; 297var global = comp.GlobalNamespace; 334var global = comp.GlobalNamespace; 367var global = comp.GlobalNamespace;
Microsoft.CodeAnalysis.CSharp.Test.Utilities (4)
Extensions.cs (4)
800public static INamespaceSymbol CreateErrorNamespaceSymbol(this CSharpCompilation comp, NamespaceSymbol container, string name) 859public static INamespaceSymbol GetNestedNamespace(this INamespaceSymbol ns, string name) 865return (INamespaceSymbol)sym;
Microsoft.CodeAnalysis.CSharp.Workspaces (33)
Classification\SyntaxClassification\NameSyntaxClassifier.cs (1)
133if (symbol is INamespaceSymbol namespaceSymbol &&
Rename\CSharpRenameRewriterLanguageService.cs (1)
380if (!isRenameLocation && symbol is INamespaceSymbol && token.GetPreviousToken().IsKind(SyntaxKind.NamespaceKeyword))
Simplification\CSharpSimplificationService.Expander.cs (1)
462if (aliasTarget.IsNamespace() && ((INamespaceSymbol)aliasTarget).IsGlobalNamespace)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SemanticModelExtensions.cs (3)
161public static ISet<INamespaceSymbol> GetUsingNamespacesInScope(this SemanticModel semanticModel, SyntaxNode location) 164var result = new HashSet<INamespaceSymbol>(); 175result.Add((INamespaceSymbol)symbolInfo.Symbol);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\CSharpCodeGenerationService.cs (2)
267protected override TDeclarationNode AddNamespace<TDeclarationNode>(TDeclarationNode destination, INamespaceSymbol @namespace, CSharpCodeGenerationContextInfo info, IList<bool>? availableIndices, CancellationToken cancellationToken) 713INamespaceSymbol @namespace, CodeGenerationDestination destination, CSharpCodeGenerationContextInfo info, CancellationToken cancellationToken)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\NamespaceGenerator.cs (7)
27INamespaceSymbol @namespace, 47INamespaceSymbol @namespace, 68INamespaceSymbol @namespace, 98string name, INamespaceSymbol innermostNamespace, 119INamespaceSymbol @namespace, 120INamespaceSymbol innermostNamespace, 139private static SyntaxList<UsingDirectiveSyntax> GenerateUsingDirectives(INamespaceSymbol innermostNamespace)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Editing\CSharpImportAdder.cs (15)
28protected override INamespaceSymbol? GetExplicitNamespaceSymbol(SyntaxNode node, SemanticModel model) 44ImmutableArray<INamespaceSymbol> namespaceSymbols, 45HashSet<INamespaceSymbol> conflicts, 52private static INamespaceSymbol? GetExplicitNamespaceSymbol(ExpressionSyntax fullName, ExpressionSyntax namespacePart, SemanticModel model) 56if (symbol != null && symbol.Kind != SymbolKind.Namespace && model.GetSymbolInfo(namespacePart).Symbol is INamespaceSymbol) 59var ns = symbol.ContainingNamespace; 85private readonly MultiDictionary<(string name, int arity), INamespaceSymbol> _importedTypes = []; 97private readonly MultiDictionary<string, INamespaceSymbol> _importedExtensionMethods = []; 101ImmutableArray<INamespaceSymbol> namespaceSymbols) 108private void AddImportedMembers(ImmutableArray<INamespaceSymbol> namespaceSymbols) 110foreach (var ns in namespaceSymbols) 128public async Task AddPotentiallyConflictingImportsAsync(SyntaxNode container, HashSet<INamespaceSymbol> conflicts, CancellationToken cancellationToken) 134await ProducerConsumer<INamespaceSymbol>.RunParallelAsync( 213private void ProduceConflicts(SimpleNameSyntax node, Action<INamespaceSymbol> addConflict, CancellationToken cancellationToken) 223private void ProduceConflicts(MemberAccessExpressionSyntax node, bool containsAnonymousMethods, Action<INamespaceSymbol> addConflict, CancellationToken cancellationToken)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ITypeSymbolExtensions.ExpressionSyntaxGeneratorVisitor.cs (1)
85public override ExpressionSyntax VisitNamespace(INamespaceSymbol symbol)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ITypeSymbolExtensions.TypeSyntaxGeneratorVisitor.cs (1)
318public override TypeSyntax VisitNamespace(INamespaceSymbol symbol)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\SemanticModelExtensions.cs (1)
21public static INamespaceSymbol GetDeclaredSymbol(this SemanticModel semanticModel, BaseNamespaceDeclarationSyntax declarationSyntax, CancellationToken cancellationToken = default)
Microsoft.CodeAnalysis.EditorFeatures.UnitTests (16)
CodeGeneration\CodeGenerationTests.cs (4)
46var @namespace = CodeGenerationSymbolFactory.CreateNamespaceSymbol(name, imports, members); 51(INamespaceSymbol)testContext.GetDestination(), 524(INamespaceSymbol)testContext.GetDestination(), 651testContext.Result = await testContext.Service.AddNamespaceOrTypeAsync(solutionContext, (INamespaceSymbol)destination, symbol, CancellationToken.None);
MetadataAsSource\MetadataAsSourceTests.cs (1)
1878var namespaceSymbol = CodeGenerationSymbolFactory.CreateNamespaceSymbol("Outerspace");
SymbolFinder\DependentTypeFinderTests.cs (1)
789var namespaceSymbol = baseInterfaceSymbol.ContainingNamespace;
Utilities\SymbolEquivalenceComparerTests.cs (10)
856var outer1 = (INamespaceSymbol)(await workspace1.CurrentSolution.Projects.Single().GetCompilationAsync()).GlobalNamespace.GetMembers("Outer").Single(); 857var outer2 = (INamespaceSymbol)(await workspace2.CurrentSolution.Projects.Single().GetCompilationAsync()).GlobalNamespace.GetMembers("Outer").Single(); 859var inner1 = (INamespaceSymbol)outer1.GetMembers("Inner").Single(); 860var inner2 = (INamespaceSymbol)outer2.GetMembers("Inner").Single(); 1718var namespace1 = (await workspace1.CurrentSolution.Projects.Single().GetCompilationAsync()).GlobalNamespace.GetNamespaceMembers().Single(n => n.Name == "N").GetNamespaceMembers().Single(n => n.Name == "M"); 1719var namespace2 = (await workspace2.CurrentSolution.Projects.Single().GetCompilationAsync()).GlobalNamespace.GetNamespaceMembers().Single(n => n.Name == "N").GetNamespaceMembers().Single(n => n.Name == "M");
Microsoft.CodeAnalysis.ExpressionEvaluator.ExpressionCompiler (1)
AbstractTypeParameterChecker.cs (1)
141public sealed override void VisitNamespace(INamespaceSymbol symbol)
Microsoft.CodeAnalysis.Features (58)
AddImport\AbstractAddImportFeatureService.cs (2)
50protected abstract ISet<INamespaceSymbol> GetImportNamespacesInScope(SemanticModel semanticModel, SyntaxNode node, CancellationToken cancellationToken); 501return symbol.IsNamespace ? !((INamespaceSymbol)symbol).IsGlobalNamespace : true;
AddImport\SymbolReferenceFinder.cs (17)
35private readonly ISet<INamespaceSymbol> _namespacesInScope; 69private ISet<INamespaceSymbol> GetNamespacesInScope(CancellationToken cancellationToken) 86private INamespaceSymbol MapToCompilationNamespaceIfPossible(INamespaceSymbol containingNamespace) 161/// to the <see cref="INamespaceSymbol"/>s or <see cref="INamedTypeSymbol"/>s those types are 210var typesContainedDirectlyInNamespaces = accessibleTypeSymbols.WhereAsArray(s => s.Symbol.ContainingSymbol is INamespaceSymbol); 249/// to the <see cref="INamespaceSymbol"/>s those namespaces are contained in. 263var namespaceSymbols = OfType<INamespaceSymbol>(symbols); 264var containingNamespaceSymbols = OfType<INamespaceSymbol>(symbols).SelectAsArray(s => s.WithSymbol(s.Symbol.ContainingNamespace)); 337/// <see cref="SymbolReference"/>s to the <see cref="INamespaceSymbol"/>s that contain 396/// <see cref="SymbolReference"/>s to the <see cref="INamespaceSymbol"/>s that contain 427/// <see cref="SymbolReference"/>s to the <see cref="INamespaceSymbol"/>s that contain 451/// <see cref="SymbolReference"/>s to the <see cref="INamespaceSymbol"/>s that contain 476/// <see cref="SymbolReference"/>s to the <see cref="INamespaceSymbol"/>s that contain 501/// <see cref="SymbolReference"/>s to the <see cref="INamespaceSymbol"/>s that contain 526/// <see cref="SymbolReference"/>s to the <see cref="INamespaceSymbol"/>s that contain 590SearchScope scope, ImmutableArray<SymbolResult<INamespaceSymbol>> namespaces)
Common\TaggedText.cs (1)
112if (alias.Target is INamespaceSymbol)
Completion\Providers\ImportCompletionProvider\AbstractImportCompletionProvider.cs (1)
110if (import.NamespaceOrType is INamespaceSymbol @namespace)
Completion\Providers\ImportCompletionProvider\AbstractTypeImportCompletionService.cs (3)
234INamespaceSymbol rootNamespaceSymbol, 242INamespaceSymbol symbol, 250foreach (var memberNamespace in symbol.GetNamespaceMembers())
Completion\Providers\ImportCompletionProvider\ExtensionMethodImportCompletionHelper.cs (3)
146using var _1 = PooledDictionary<INamespaceSymbol, string>.GetInstance(out var namespaceNameCache); 231private static string GetFullyQualifiedNamespaceName(INamespaceSymbol symbol, Dictionary<INamespaceSymbol, string> stringCache)
ConvertTupleToStruct\AbstractConvertTupleToStructCodeRefactoringProvider.cs (2)
277? (INamespaceSymbol)semanticModel.GetRequiredDeclaredSymbol(namespaceDecl, cancellationToken) 329INamespaceSymbol containingNamespace, NamingRule parameterNamingRule,
Debugging\AbstractBreakpointResolver.cs (2)
162case INamespaceSymbol namespaceSymbol: 295INamespaceSymbol namespaceSymbol => namespaceSymbol.GetMembers().SelectMany(GetTypeMembersRecursive),
FindUsages\DefinitionItemFactory.cs (3)
179if (definition is INamespaceSymbol namespaceSymbol) 193foreach (var constituentNamespace in namespaceSymbol.ConstituentNamespaces) 227if (definition is IAssemblySymbol or IModuleSymbol or INamespaceSymbol { IsGlobalNamespace: true } or IPreprocessingSymbol)
FullyQualify\AbstractFullyQualifyService.cs (6)
176.OfType<INamespaceSymbol>() 268=> symbol.ContainingSymbol is INamespaceSymbol or INamedTypeSymbol { IsGenericType: false }; 270private bool BindsWithoutErrors(INamespaceSymbol ns, string? rightName, bool isAttributeName) 290private static bool HasAccessibleTypes(INamespaceSymbol @namespace, SemanticModel model, CancellationToken cancellationToken) 299if (containingSymbol is INamespaceSymbol namespaceSymbol) 313.Where(n => n.Symbol is INamedTypeSymbol or INamespaceSymbol { IsGlobalNamespace: false })
FullyQualify\AbstractFullyQualifyService.SymbolResult.cs (2)
48Debug.Assert(Symbol is INamespaceSymbol || !((INamedTypeSymbol)Symbol).IsGenericType); 49Debug.Assert(other.Symbol is INamespaceSymbol || !((INamedTypeSymbol)other.Symbol).IsGenericType);
GenerateType\AbstractGenerateTypeService.cs (1)
69public abstract Task<(INamespaceSymbol, INamespaceOrTypeSymbol, Location)> GetOrGenerateEnclosingNamespaceSymbolAsync(INamedTypeSymbol namedTypeSymbol, string[] containers, Document selectedDocument, SyntaxNode selectedDocumentRoot, CancellationToken cancellationToken);
GenerateType\AbstractGenerateTypeService.Editor.cs (1)
417(INamespaceSymbol, INamespaceOrTypeSymbol, Location) enclosingNamespaceGeneratedTypeToAddAndLocation;
GenerateType\AbstractGenerateTypeService.State.cs (1)
390if (symbol is INamespaceSymbol)
GenerateType\IGenerateTypeService.cs (1)
17Task<(INamespaceSymbol, INamespaceOrTypeSymbol, Location)> GetOrGenerateEnclosingNamespaceSymbolAsync(INamedTypeSymbol namedTypeSymbol, string[] containers, Document selectedDocument, SyntaxNode selectedDocumentRoot, CancellationToken cancellationToken);
GoToDefinition\GoToDefinitionFeatureHelpers.cs (1)
27if (alias.Target is INamespaceSymbol ns && ns.IsGlobalNamespace)
LanguageServices\AnonymousTypeDisplayService\AbstractStructuralTypeDisplayService.StructuralTypeCollectorVisitor.cs (1)
109public override void VisitNamespace(INamespaceSymbol symbol)
LanguageServices\SymbolDisplayService\AbstractSymbolDisplayService.AbstractSymbolDescriptionBuilder.cs (2)
343else if (symbol is INamespaceSymbol namespaceSymbol) 524private void AddDescriptionForNamespace(INamespaceSymbol symbol)
MetadataAsSource\AbstractMetadataAsSourceService.AbstractWrappedSymbol.cs (1)
35public INamespaceSymbol ContainingNamespace => _symbol.ContainingNamespace;
MetadataAsSource\AbstractMetadataAsSourceService.cs (1)
97var topLevelNamespaceSymbol = symbol.ContainingNamespace;
MoveToNamespace\AbstractMoveToNamespaceService.cs (1)
303protected static string GetQualifiedName(INamespaceSymbol namespaceSymbol)
RQName\RQNodeBuilder.cs (3)
22INamespaceSymbol namespaceSymbol => BuildNamespace(namespaceSymbol), 31private static RQNamespace BuildNamespace(INamespaceSymbol @namespace) 34private static IList<string> GetNameParts(INamespaceSymbol @namespace)
src\Compilers\Core\AnalyzerDriver\DeclarationComputer.cs (2)
54if (declaredSymbol is INamespaceSymbol namespaceSymbol && namespaceSymbol.ConstituentNamespaces.Length > 1) 57var assemblyScopedNamespaceSymbol = namespaceSymbol.ConstituentNamespaces.FirstOrDefault(ns => ns.ContainingAssembly == assemblyToScope);
Microsoft.CodeAnalysis.Features.UnitTests (2)
FindUsages\DefinitionItemFactoryTests.cs (2)
439var symbol = compilation.Assembly.GlobalNamespace; 479var symbol = compilation.GlobalNamespace;
Microsoft.CodeAnalysis.Test.Utilities (3)
Diagnostics\CommonDiagnosticAnalyzers.cs (3)
795var ns = (INamespaceSymbol)context.Symbol; 2097case INamespaceSymbol namespaceSym:
Microsoft.CodeAnalysis.VisualBasic (39)
Binding\MemberSemanticModel.vb (1)
489Public Overloads Overrides Function GetDeclaredSymbol(declarationSyntax As NamespaceStatementSyntax, Optional cancellationToken As CancellationToken = Nothing) As INamespaceSymbol
Compilation\SemanticModel.vb (2)
2586Public MustOverride Overloads Function GetDeclaredSymbol(declarationSyntax As NamespaceStatementSyntax, Optional cancellationToken As CancellationToken = Nothing) As INamespaceSymbol 2593Public Overloads Function GetDeclaredSymbol(declarationSyntax As NamespaceBlockSyntax, Optional cancellationToken As CancellationToken = Nothing) As INamespaceSymbol
Compilation\SpeculativeSemanticModelWithMemberModel.vb (1)
161Public Overloads Overrides Function GetDeclaredSymbol(declarationSyntax As NamespaceStatementSyntax, Optional cancellationToken As CancellationToken = Nothing) As INamespaceSymbol
Compilation\SyntaxTreeSemanticModel.vb (2)
937Public Overloads Overrides Function GetDeclaredSymbol(declarationSyntax As NamespaceStatementSyntax, Optional cancellationToken As CancellationToken = Nothing) As INamespaceSymbol 986Dim namespaceToLookInForImplicitType As INamespaceSymbol = Nothing
Compilation\VisualBasicCompilation.vb (6)
1468Friend Shadows Function GetCompilationNamespace(namespaceSymbol As INamespaceSymbol) As NamespaceSymbol 2738Protected Overrides ReadOnly Property CommonGlobalNamespace As INamespaceSymbol 2821Protected Overrides Function CommonGetCompilationNamespace(namespaceSymbol As INamespaceSymbol) As INamespaceSymbol 2841Protected Overrides Function CommonCreateErrorNamespaceSymbol(container As INamespaceSymbol, name As String) As INamespaceSymbol
SymbolDisplay\SymbolDisplayVisitor.Types.vb (1)
143Dim ns = DirectCast(containingSymbol, INamespaceSymbol)
SymbolDisplay\SymbolDisplayVisitor.vb (4)
202Public Overloads Overrides Sub VisitNamespace(symbol As INamespaceSymbol) 211Private Overloads Sub VisitNamespace(symbol As INamespaceSymbol, emittedName As String) 259Private Sub AddGlobalNamespace(symbol As INamespaceSymbol) 381(Not (DirectCast(containingSymbol, INamespaceSymbol)).IsGlobalNamespace OrElse
SymbolDisplay\SymbolDisplayVisitor_Minimal.vb (1)
18Private Sub MinimallyQualify(symbol As INamespaceSymbol, emittedName As String, parentsEmittedName As String)
Symbols\AssemblySymbol.vb (1)
733Private ReadOnly Property IAssemblySymbol_GlobalNamespace As INamespaceSymbol Implements IAssemblySymbol.GlobalNamespace
Symbols\ModuleSymbol.vb (4)
259Public Function GetModuleNamespace(namespaceSymbol As INamespaceSymbol) As NamespaceSymbol 297Private ReadOnly Property IModuleSymbol_GlobalNamespace As INamespaceSymbol Implements IModuleSymbol.GlobalNamespace 303Private Function IModuleSymbol_GetModuleNamespace(namespaceSymbol As INamespaceSymbol) As INamespaceSymbol Implements IModuleSymbol.GetModuleNamespace
Symbols\NamespaceSymbol.vb (10)
60Public Overridable ReadOnly Property IsGlobalNamespace As Boolean Implements INamespaceSymbol.IsGlobalNamespace, INamespaceSymbolInternal.IsGlobalNamespace 539Private Function INamespaceSymbol_GetMembers() As IEnumerable(Of INamespaceOrTypeSymbol) Implements INamespaceSymbol.GetMembers 543Private Function INamespaceSymbol_GetMembers(name As String) As IEnumerable(Of INamespaceOrTypeSymbol) Implements INamespaceSymbol.GetMembers 547Private Function INamespaceSymbol_GetNamespaceMembers() As IEnumerable(Of INamespaceSymbol) Implements INamespaceSymbol.GetNamespaceMembers 571Private ReadOnly Property INamespaceSymbol_ConstituentNamespaces As ImmutableArray(Of INamespaceSymbol) Implements INamespaceSymbol.ConstituentNamespaces 573Return StaticCast(Of INamespaceSymbol).From(Me.ConstituentNamespaces) 577Private ReadOnly Property INamespaceSymbol_NamespaceKind As NamespaceKind Implements INamespaceSymbol.NamespaceKind 583Private ReadOnly Property INamespaceSymbol_ContainingCompilation As Compilation Implements INamespaceSymbol.ContainingCompilation
Symbols\Symbol.vb (1)
1199Private ReadOnly Property ISymbol_ContainingNamespace As INamespaceSymbol Implements ISymbol.ContainingNamespace
VisualBasicExtensions.vb (5)
632Public Function GetModuleMembers([namespace] As INamespaceSymbol) As ImmutableArray(Of INamedTypeSymbol) 648Public Function GetModuleMembers([namespace] As INamespaceSymbol, name As String) As ImmutableArray(Of INamedTypeSymbol) 725Public Function RootNamespace(compilation As Compilation) As INamespaceSymbol 1019Public Function GetDeclaredSymbol(semanticModel As SemanticModel, declarationSyntax As NamespaceStatementSyntax, Optional cancellationToken As CancellationToken = Nothing) As INamespaceSymbol 1032Public Function GetDeclaredSymbol(semanticModel As SemanticModel, declarationSyntax As NamespaceBlockSyntax, Optional cancellationToken As CancellationToken = Nothing) As INamespaceSymbol
Microsoft.CodeAnalysis.VisualBasic.CodeStyle (2)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Extensions\SemanticModelExtensions.vb (2)
82Public Function GetImportNamespacesInScope(semanticModel As SemanticModel, location As SyntaxNode) As ISet(Of INamespaceSymbol) 88Let ns = TryCast(info.Symbol, INamespaceSymbol)
Microsoft.CodeAnalysis.VisualBasic.CodeStyle.Fixes (31)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\CodeGeneration\NamespaceGenerator.vb (8)
16[namespace] As INamespaceSymbol, 31[namespace] As INamespaceSymbol, 44Public Function GenerateNamespaceDeclaration(service As ICodeGenerationService, [namespace] As INamespaceSymbol, options As CodeGenerationContextInfo, cancellationToken As CancellationToken) As SyntaxNode 46Dim innermostNamespace As INamespaceSymbol = Nothing 68Private Function GetDeclarationSyntaxWithoutMembers([namespace] As INamespaceSymbol, innermostNamespace As INamespaceSymbol, name As String, options As CodeGenerationContextInfo) As SyntaxNode 88Private Function GenerateNamespaceDeclarationWorker(name As String, [namespace] As INamespaceSymbol) As SyntaxNode 97Private Function GenerateImportsStatements([namespace] As INamespaceSymbol) As SyntaxList(Of ImportsStatementSyntax)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\CodeGeneration\VisualBasicCodeGenerationService.vb (2)
195[namespace] As INamespaceSymbol, 580Public Overrides Function CreateNamespaceDeclaration([namespace] As INamespaceSymbol,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\Editing\VisualBasicImportAdder.vb (18)
25Protected Overrides Function GetExplicitNamespaceSymbol(node As SyntaxNode, model As SemanticModel) As INamespaceSymbol 39Protected Overrides Function AddPotentiallyConflictingImportsAsync(model As SemanticModel, container As SyntaxNode, namespaceSymbols As ImmutableArray(Of INamespaceSymbol), conflicts As HashSet(Of INamespaceSymbol), cancellationToken As CancellationToken) As Task 44Private Overloads Shared Function GetExplicitNamespaceSymbol(fullName As ExpressionSyntax, namespacePart As ExpressionSyntax, model As SemanticModel) As INamespaceSymbol 47Dim nsSymbol = TryCast(model.GetSymbolInfo(namespacePart).Symbol, INamespaceSymbol) 70Private ReadOnly _importedTypesAndNamespaces As MultiDictionary(Of (name As String, arity As Integer), INamespaceSymbol) 77Private ReadOnly _importedMembers As MultiDictionary(Of String, INamespaceSymbol) 83Private ReadOnly _importedExtensionMethods As MultiDictionary(Of String, INamespaceSymbol) 87namespaceSymbols As ImmutableArray(Of INamespaceSymbol)) 91_importedTypesAndNamespaces = New MultiDictionary(Of (name As String, arity As Integer), INamespaceSymbol)(Me) 92_importedMembers = New MultiDictionary(Of String, INamespaceSymbol)(VisualBasicSyntaxFacts.Instance.StringComparer) 93_importedExtensionMethods = New MultiDictionary(Of String, INamespaceSymbol)(VisualBasicSyntaxFacts.Instance.StringComparer) 98Private Sub AddImportedMembers(namespaceSymbols As ImmutableArray(Of INamespaceSymbol)) 128Public Async Function AddPotentiallyConflictingImportsAsync(container As SyntaxNode, conflicts As HashSet(Of INamespaceSymbol), cancellationToken As CancellationToken) As Task 135Function(node As SyntaxNode, onItemsFound As Action(Of INamespaceSymbol), conflictFinder As ConflictFinder, cancellationToken1 As CancellationToken) As Task 146Dim items = Await ProducerConsumer(Of INamespaceSymbol).RunParallelAsync( 205Private Sub ProduceConflicts(node As SimpleNameSyntax, addConflict As Action(Of INamespaceSymbol), cancellationToken As CancellationToken) 215Private Sub ProduceConflicts(node As MemberAccessExpressionSyntax, containsAnonymousMethods As Boolean, addConflict As Action(Of INamespaceSymbol), cancellationToken As CancellationToken)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\Extensions\ExpressionSyntaxGeneratorVisitor.vb (1)
60Public Overrides Function VisitNamespace(symbol As INamespaceSymbol) As ExpressionSyntax
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\Extensions\TypeSyntaxGeneratorVisitor.vb (1)
179Public Overrides Function VisitNamespace(symbol As INamespaceSymbol) As TypeSyntax
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\LanguageServices\VisualBasicAddImportsService.vb (1)
55If TypeOf import Is INamespaceSymbol Then
Microsoft.CodeAnalysis.VisualBasic.Features (7)
AddImport\VisualBasicAddImportFeatureService.vb (1)
217Protected Overrides Function GetImportNamespacesInScope(semanticModel As SemanticModel, node As SyntaxNode, cancellationToken As CancellationToken) As ISet(Of INamespaceSymbol)
Completion\CompletionProviders\ImplementsClauseCompletionProvider.vb (4)
157Dim namespaces = interfacesAndContainers.OfType(Of INamespaceSymbol)() 181(TypeOf (s) Is INamespaceSymbol AndAlso namespaces.Contains(TryCast(s, INamespaceSymbol), INamespaceSymbolExtensions.EqualityComparer)) OrElse 256Dim [namespace] = TryCast(containingSymbol, INamespaceSymbol)
GenerateType\VisualBasicGenerateTypeService.vb (2)
426Public Overrides Async Function GetOrGenerateEnclosingNamespaceSymbolAsync(namedTypeSymbol As INamedTypeSymbol, containers() As String, selectedDocument As Document, selectedDocumentRoot As SyntaxNode, cancellationToken As CancellationToken) As Task(Of (INamespaceSymbol, INamespaceOrTypeSymbol, Location)) 437Return (DirectCast(enclosingNamespaceSymbol.Symbol, INamespaceSymbol),
Microsoft.CodeAnalysis.VisualBasic.Semantic.UnitTests (4)
Compilation\GetImportScopesTests.vb (3)
44Return TryCast(symbol, INamespaceSymbol)?.Name = name 48Return symbol.Name = aliasName AndAlso symbol.Target.Name = targetName AndAlso TypeOf symbol.Target Is INamespaceSymbol AndAlso DirectCast(symbol.Target, INamespaceSymbol).ContainingNamespace.IsGlobalNamespace = inGlobalNamespace
Compilation\SemanticModelGetDeclaredSymbolAPITests.vb (1)
753stringInDecl As String) As INamespaceSymbol
Microsoft.CodeAnalysis.VisualBasic.Workspaces (40)
CodeCleanup\Providers\FixIncorrectTokensCodeCleanupProvider.vb (1)
117If symbol IsNot Nothing AndAlso symbol.IsNamespace AndAlso String.Equals(DirectCast(symbol, INamespaceSymbol).MetadataName, "System", StringComparison.Ordinal) Then
Recommendations\VisualBasicRecommendationServiceRunner.vb (4)
181symbols = leftHandSymbolInfo.CandidateSymbols.OfType(Of INamespaceSymbol)() _ 313.OfType(Of INamespaceSymbol) _ 453Dim namespaceSymbol = TryCast(symbol, INamespaceSymbol) 509Dim namespaceSymbol = TryCast(symbol, INamespaceSymbol)
Rename\VisualBasicRenameRewriterLanguageService.vb (1)
349If Not isRenameLocation AndAlso TypeOf (symbol) Is INamespaceSymbol AndAlso token.GetPreviousToken().Kind = SyntaxKind.NamespaceKeyword Then
Simplification\VisualBasicSimplificationService.Expander.vb (1)
502If aliasTarget.IsNamespace() AndAlso DirectCast(aliasTarget, INamespaceSymbol).IsGlobalNamespace Then
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Extensions\SemanticModelExtensions.vb (2)
82Public Function GetImportNamespacesInScope(semanticModel As SemanticModel, location As SyntaxNode) As ISet(Of INamespaceSymbol) 88Let ns = TryCast(info.Symbol, INamespaceSymbol)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\CodeGeneration\NamespaceGenerator.vb (8)
16[namespace] As INamespaceSymbol, 31[namespace] As INamespaceSymbol, 44Public Function GenerateNamespaceDeclaration(service As ICodeGenerationService, [namespace] As INamespaceSymbol, options As CodeGenerationContextInfo, cancellationToken As CancellationToken) As SyntaxNode 46Dim innermostNamespace As INamespaceSymbol = Nothing 68Private Function GetDeclarationSyntaxWithoutMembers([namespace] As INamespaceSymbol, innermostNamespace As INamespaceSymbol, name As String, options As CodeGenerationContextInfo) As SyntaxNode 88Private Function GenerateNamespaceDeclarationWorker(name As String, [namespace] As INamespaceSymbol) As SyntaxNode 97Private Function GenerateImportsStatements([namespace] As INamespaceSymbol) As SyntaxList(Of ImportsStatementSyntax)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\CodeGeneration\VisualBasicCodeGenerationService.vb (2)
195[namespace] As INamespaceSymbol, 580Public Overrides Function CreateNamespaceDeclaration([namespace] As INamespaceSymbol,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\Editing\VisualBasicImportAdder.vb (18)
25Protected Overrides Function GetExplicitNamespaceSymbol(node As SyntaxNode, model As SemanticModel) As INamespaceSymbol 39Protected Overrides Function AddPotentiallyConflictingImportsAsync(model As SemanticModel, container As SyntaxNode, namespaceSymbols As ImmutableArray(Of INamespaceSymbol), conflicts As HashSet(Of INamespaceSymbol), cancellationToken As CancellationToken) As Task 44Private Overloads Shared Function GetExplicitNamespaceSymbol(fullName As ExpressionSyntax, namespacePart As ExpressionSyntax, model As SemanticModel) As INamespaceSymbol 47Dim nsSymbol = TryCast(model.GetSymbolInfo(namespacePart).Symbol, INamespaceSymbol) 70Private ReadOnly _importedTypesAndNamespaces As MultiDictionary(Of (name As String, arity As Integer), INamespaceSymbol) 77Private ReadOnly _importedMembers As MultiDictionary(Of String, INamespaceSymbol) 83Private ReadOnly _importedExtensionMethods As MultiDictionary(Of String, INamespaceSymbol) 87namespaceSymbols As ImmutableArray(Of INamespaceSymbol)) 91_importedTypesAndNamespaces = New MultiDictionary(Of (name As String, arity As Integer), INamespaceSymbol)(Me) 92_importedMembers = New MultiDictionary(Of String, INamespaceSymbol)(VisualBasicSyntaxFacts.Instance.StringComparer) 93_importedExtensionMethods = New MultiDictionary(Of String, INamespaceSymbol)(VisualBasicSyntaxFacts.Instance.StringComparer) 98Private Sub AddImportedMembers(namespaceSymbols As ImmutableArray(Of INamespaceSymbol)) 128Public Async Function AddPotentiallyConflictingImportsAsync(container As SyntaxNode, conflicts As HashSet(Of INamespaceSymbol), cancellationToken As CancellationToken) As Task 135Function(node As SyntaxNode, onItemsFound As Action(Of INamespaceSymbol), conflictFinder As ConflictFinder, cancellationToken1 As CancellationToken) As Task 146Dim items = Await ProducerConsumer(Of INamespaceSymbol).RunParallelAsync( 205Private Sub ProduceConflicts(node As SimpleNameSyntax, addConflict As Action(Of INamespaceSymbol), cancellationToken As CancellationToken) 215Private Sub ProduceConflicts(node As MemberAccessExpressionSyntax, containsAnonymousMethods As Boolean, addConflict As Action(Of INamespaceSymbol), cancellationToken As CancellationToken)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\Extensions\ExpressionSyntaxGeneratorVisitor.vb (1)
60Public Overrides Function VisitNamespace(symbol As INamespaceSymbol) As ExpressionSyntax
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\Extensions\TypeSyntaxGeneratorVisitor.vb (1)
179Public Overrides Function VisitNamespace(symbol As INamespaceSymbol) As TypeSyntax
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\LanguageServices\VisualBasicAddImportsService.vb (1)
55If TypeOf import Is INamespaceSymbol Then
Microsoft.CodeAnalysis.Workspaces (133)
FindSymbols\Declarations\DeclarationFinder_AllDeclarations.cs (1)
151result.AddIfNotNull(mappedSymbol is INamespaceSymbol ns
FindSymbols\FindReferences\Finders\AbstractReferenceFinder_GlobalSuppressions.cs (1)
34SymbolKind.Namespace => !((INamespaceSymbol)symbol).IsGlobalNamespace,
FindSymbols\FindReferences\Finders\NamespaceSymbolReferenceFinder.cs (8)
16internal sealed class NamespaceSymbolReferenceFinder : AbstractReferenceFinder<INamespaceSymbol> 18protected override bool CanFind(INamespaceSymbol symbol) 21protected override Task<ImmutableArray<string>> DetermineGlobalAliasesAsync(INamespaceSymbol symbol, Project project, CancellationToken cancellationToken) 27INamespaceSymbol symbol, 54INamespaceSymbol symbol, 93INamespaceSymbol symbol, FindReferencesDocumentState state, ArrayBuilder<FinderLocation> initialReferences, string namespaceName, string alias, CancellationToken cancellationToken) 110INamespaceSymbol symbol, 124INamespaceSymbol symbol,
FindSymbols\FindReferences\FindReferencesSearchEngine.SymbolSet.cs (1)
117if (aliasSymbol.Target is INamedTypeSymbol or INamespaceSymbol)
FindSymbols\SymbolFinder_Helpers.cs (4)
52var namespace1 = (INamespaceSymbol)searchSymbol; 53var namespace2 = (INamespaceSymbol)symbolToMatch;
FindSymbols\SymbolTree\SymbolTreeInfo_Source.cs (1)
204if (symbol is INamespaceSymbol namespaceSymbol)
Recommendations\AbstractRecommendationService.cs (1)
135if (symbol is INamespaceSymbol namespaceSymbol)
Recommendations\AbstractRecommendationServiceRunner.cs (4)
279var containingNamespaceSymbol = semanticModel.Compilation.GetCompilationNamespace( 291var systemNamespace = container is not (null or INamespaceSymbol { IsGlobalNamespace: true }) 294.OfType<INamespaceSymbol>().FirstOrDefault();
Rename\ConflictEngine\ConflictResolver.cs (1)
267var otherThingsNamedTheSame = ((INamespaceSymbol)renamedSymbol.ContainingSymbol).GetMembers(renamedSymbol.Name)
Shared\Extensions\INamespaceSymbolExtensions.Comparer.cs (4)
13private sealed class Comparer : IEqualityComparer<INamespaceSymbol?> 15public bool Equals(INamespaceSymbol? x, INamespaceSymbol? y) 18public int GetHashCode(INamespaceSymbol? obj)
Shared\Extensions\INamespaceSymbolExtensions.cs (28)
17private static readonly ConditionalWeakTable<INamespaceSymbol, List<string>> s_namespaceToNameMap = new(); 19public static readonly Comparison<INamespaceSymbol> CompareNamespaces = CompareTo; 20public static readonly IEqualityComparer<INamespaceSymbol> EqualityComparer = new Comparer(); 22private static List<string> GetNameParts(INamespaceSymbol? namespaceSymbol) 29private static void GetNameParts(INamespaceSymbol? namespaceSymbol, List<string> result) 40public static int CompareTo(this INamespaceSymbol n1, INamespaceSymbol n2) 58this INamespaceSymbol namespaceSymbol, 67if (current is INamespaceSymbol childNamespace) 81public static IEnumerable<INamespaceSymbol> GetAllNamespaces( 82this INamespaceSymbol namespaceSymbol, 85using var _ = ArrayBuilder<INamespaceSymbol>.GetInstance(out var stack); 88while (stack.TryPop(out var childNamespace)) 97this IEnumerable<INamespaceSymbol> namespaceSymbols, 106public static IEnumerable<INamespaceSymbol> FindNamespaces( 107this INamespaceSymbol namespaceSymbol, 113using var _ = ArrayBuilder<INamespaceSymbol>.GetInstance(out var stack); 116while (stack.TryPop(out var current)) 119var matchingChildren = current.GetMembers(namespaceName).OfType<INamespaceSymbol>(); 120foreach (var child in matchingChildren) 128this INamespaceSymbol namespaceSymbol, 135public static INamespaceSymbol? GetQualifiedNamespace( 136this INamespaceSymbol globalNamespace, 139var namespaceSymbol = globalNamespace; 144? members.First() as INamespaceSymbol 157this INamespaceSymbol namespaceSymbol, 166foreach (var constituent in namespaceSymbol.ConstituentNamespaces) 196namespaceQueue.Enqueue((INamespaceSymbol)namespaceOrType);
Shared\Extensions\ISolutionExtensions.cs (2)
18public static async Task<ImmutableArray<INamespaceSymbol>> GetGlobalNamespacesAsync( 22var results = ArrayBuilder<INamespaceSymbol>.GetInstance();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\INamespaceOrTypeSymbolExtensions.cs (2)
76if (namespaceOrTypeSymbol == null || (namespaceOrTypeSymbol.IsNamespace && ((INamespaceSymbol)namespaceOrTypeSymbol).IsGlobalNamespace)) 99if (current is INamespaceSymbol currentNs)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SemanticModelExtensions.cs (2)
90public static INamespaceSymbol? GetEnclosingNamespace(this SemanticModel semanticModel, int position, CancellationToken cancellationToken) 91=> semanticModel.GetEnclosingSymbol<INamespaceSymbol>(position, cancellationToken);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.cs (2)
47/// <item>Two <see cref="INamespaceSymbol"/>s are the "same" if they have 50/// If the <see cref="INamespaceSymbol"/> is the global namespace for a
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.ErrorTypeSymbolKey.cs (3)
26case INamespaceSymbol parentNamespace: 53private static ImmutableArray<string> GetContainingNamespaceNamesInReverse(INamespaceSymbol namespaceSymbol) 123var currentNamespace = reader.Compilation.GlobalNamespace;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.NamedTypeSymbolKey.cs (1)
124if (containingSymbolResolution.SymbolCount == 0 && errorType.ContainingSymbol is INamespaceSymbol containingNamespace)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.NamespaceSymbolKey.cs (6)
13private sealed class NamespaceSymbolKey : AbstractSymbolKey<INamespaceSymbol> 25public sealed override void Create(INamespaceSymbol symbol, SymbolKeyWriter visitor) 59SymbolKeyReader reader, INamespaceSymbol? contextualSymbol, out string? failureReason) 89using var result = PooledArrayBuilder<INamespaceSymbol>.GetInstance(); 102case INamespaceSymbol namespaceSymbol: 105if (member is INamespaceSymbol childNamespace)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.SymbolKeyWriter.cs (1)
443public override void VisitNamespace(INamespaceSymbol namespaceSymbol)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\SymbolEquivalenceComparer.EquivalenceVisitor.cs (6)
127SymbolKind.Namespace => NamespacesAreEquivalent((INamespaceSymbol)x, (INamespaceSymbol)y, equivalentTypesWithDifferingAssemblies), 368x.ContainingSymbol is INamespaceSymbol xNamespace && 369y.ContainingSymbol is INamespaceSymbol yNamespace) 547private bool NamespacesAreEquivalent(INamespaceSymbol x, INamespaceSymbol y, Dictionary<INamedTypeSymbol, INamedTypeSymbol>? equivalentTypesWithDifferingAssemblies)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\SymbolEquivalenceComparer.GetHashCodeVisitor.cs (2)
68SymbolKind.Namespace => CombineHashCodes((INamespaceSymbol)x, currentHash), 209private int CombineHashCodes(INamespaceSymbol x, int currentHash)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\AbstractCodeGenerationService.cs (11)
63public TDeclarationNode AddNamespace<TDeclarationNode>(TDeclarationNode destination, INamespaceSymbol @namespace, CodeGenerationContextInfo info, CancellationToken cancellationToken) where TDeclarationNode : SyntaxNode 92public SyntaxNode CreateNamespaceDeclaration(INamespaceSymbol @namespace, CodeGenerationDestination destination, CodeGenerationContextInfo info, CancellationToken cancellationToken) 129protected abstract TDeclarationNode AddNamespace<TDeclarationNode>(TDeclarationNode destination, INamespaceSymbol @namespace, TCodeGenerationContextInfo info, IList<bool>? availableIndices, CancellationToken cancellationToken) where TDeclarationNode : SyntaxNode; 152public abstract SyntaxNode CreateNamespaceDeclaration(INamespaceSymbol @namespace, CodeGenerationDestination destination, TCodeGenerationContextInfo info, CancellationToken cancellationToken); 351INamespaceSymbol @namespace => CreateNamespaceDeclaration(@namespace, codeGenerationDestination, info, cancellationToken), 369INamespaceSymbol @namespace => AddNamespace(currentDestination, @namespace, info, availableIndices, cancellationToken), 429public Task<Document> AddNamedTypeAsync(CodeGenerationSolutionContext context, INamespaceSymbol destination, INamedTypeSymbol namedType, CancellationToken cancellationToken) 438public Task<Document> AddNamespaceAsync(CodeGenerationSolutionContext context, INamespaceSymbol destination, INamespaceSymbol @namespace, CancellationToken cancellationToken) 465public Task<Document> AddNamespaceOrTypeAsync(CodeGenerationSolutionContext context, INamespaceSymbol destination, INamespaceOrTypeSymbol namespaceOrType, CancellationToken cancellationToken) 472if (namespaceOrType is INamespaceSymbol namespaceSymbol)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\AbstractFlagsEnumGenerator.cs (1)
52((INamespaceSymbol)containingSymbol.ContainingSymbol).IsGlobalNamespace)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\CodeGenerationContext.cs (3)
67public IEnumerable<INamespaceSymbol> AdditionalImports { get; } 138IEnumerable<INamespaceSymbol>? additionalImports = null, 184Optional<IEnumerable<INamespaceSymbol>> additionalImports = default,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\CodeGenerationHelpers.cs (3)
47INamespaceSymbol @namespace, 50out INamespaceSymbol innermostNamespace) 63if (members is [INamespaceSymbol childNamespace] &&
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\CodeGenerationSymbolFactory.cs (1)
508public static INamespaceSymbol CreateNamespaceSymbol(string name, IList<ISymbol>? imports = null, IList<INamespaceOrTypeSymbol>? members = null)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\CodeGenerator.cs (4)
65public static Task<Document> AddNamedTypeDeclarationAsync(CodeGenerationSolutionContext context, INamespaceSymbol destination, INamedTypeSymbol namedType, CancellationToken cancellationToken) 72public static Task<Document> AddNamespaceDeclarationAsync(CodeGenerationSolutionContext context, INamespaceSymbol destination, INamespaceSymbol @namespace, CancellationToken cancellationToken) 79public static Task<Document> AddNamespaceOrTypeDeclarationAsync(CodeGenerationSolutionContext context, INamespaceSymbol destination, INamespaceOrTypeSymbol namespaceOrType, CancellationToken cancellationToken)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\ICodeGenerationService.cs (6)
49SyntaxNode CreateNamespaceDeclaration(INamespaceSymbol @namespace, CodeGenerationDestination destination, CodeGenerationContextInfo info, CancellationToken cancellationToken); 79TDeclarationNode AddNamespace<TDeclarationNode>(TDeclarationNode destination, INamespaceSymbol @namespace, CodeGenerationContextInfo info, CancellationToken cancellationToken) where TDeclarationNode : SyntaxNode; 159Task<Document> AddNamedTypeAsync(CodeGenerationSolutionContext context, INamespaceSymbol destination, INamedTypeSymbol namedType, CancellationToken cancellationToken); 164Task<Document> AddNamespaceAsync(CodeGenerationSolutionContext context, INamespaceSymbol destination, INamespaceSymbol @namespace, CancellationToken cancellationToken); 169Task<Document> AddNamespaceOrTypeAsync(CodeGenerationSolutionContext context, INamespaceSymbol destination, INamespaceOrTypeSymbol namespaceOrType, CancellationToken cancellationToken);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationNamespaceInfo.cs (4)
15private static readonly ConditionalWeakTable<INamespaceSymbol, CodeGenerationNamespaceInfo> s_namespaceToInfoMap = new(); 23INamespaceSymbol @namespace, 30private static CodeGenerationNamespaceInfo GetInfo(INamespaceSymbol @namespace) 36public static IList<ISymbol> GetImports(INamespaceSymbol @namespace)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationNamespaceSymbol.cs (5)
14internal sealed class CodeGenerationNamespaceSymbol(string name, IList<INamespaceOrTypeSymbol> members) : CodeGenerationNamespaceOrTypeSymbol(null, null, default, Accessibility.NotApplicable, default, name), INamespaceSymbol 39IEnumerable<INamespaceOrTypeSymbol> INamespaceSymbol.GetMembers(string name) 42public IEnumerable<INamespaceSymbol> GetNamespaceMembers() 43=> GetMembers().OfType<INamespaceSymbol>(); 59public ImmutableArray<INamespaceSymbol> ConstituentNamespaces
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationSymbol.cs (1)
90public INamespaceSymbol ContainingNamespace => null;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Editing\ImportAdderService.cs (12)
69protected abstract INamespaceSymbol? GetExplicitNamespaceSymbol(SyntaxNode node, SemanticModel model); 71private async Task<ISet<INamespaceSymbol>> GetSafeToAddImportsAsync( 72ImmutableArray<INamespaceSymbol> namespaceSymbols, 77using var _ = PooledHashSet<INamespaceSymbol>.GetInstance(out var conflicts); 92ImmutableArray<INamespaceSymbol> namespaceSymbols, 93HashSet<INamespaceSymbol> conflicts, 96private static SyntaxNode GenerateNamespaceImportDeclaration(INamespaceSymbol namespaceSymbol, SyntaxGenerator generator) 122var addedSymbols = new HashSet<INamespaceSymbol>(); 174using var _ = PooledDictionary<INamespaceSymbol, SyntaxNode>.GetInstance(out var importToSyntax); 205var namespaceSymbol = namedType.ContainingNamespace; 254private static bool IsInsideNamespace(SyntaxNode node, INamespaceSymbol symbol, SemanticModel model, CancellationToken cancellationToken) 256var containedNamespace = model.GetEnclosingNamespace(node.SpanStart, cancellationToken);
Workspace\Solution\SolutionCompilationState.SymbolToProjectId.cs (1)
133if (symbol.IsKind(SymbolKind.Namespace, out INamespaceSymbol? ns))
Microsoft.VisualStudio.LanguageServices (30)
Implementation\ContainedLanguageRefactorNotifyService.cs (1)
73if (symbol is INamespaceSymbol)
Library\ObjectBrowser\AbstractDescriptionBuilder.cs (6)
70protected void AddNamespaceLink(INamespaceSymbol namespaceSymbol) 153var namespaceSymbol = namespaceListItem.ResolveTypedSymbol(compilation); 237protected abstract void BuildNamespaceDeclaration(INamespaceSymbol namespaceSymbol, _VSOBJDESCOPTIONS options); 247if (containingSymbol is INamespaceSymbol && 248((INamespaceSymbol)containingSymbol).IsGlobalNamespace) 277else if (containingSymbol is INamespaceSymbol namespaceSymbol)
Library\ObjectBrowser\AbstractListItemFactory.cs (7)
123protected NamespaceListItem CreateNamespaceListItem(INamespaceSymbol namespaceSymbol, ProjectId projectId) 408using var _ = ArrayBuilder<INamespaceSymbol>.GetInstance(out var stack); 665private static ImmutableArray<INamedTypeSymbol> GetAccessibleTypes(INamespaceSymbol namespaceSymbol, Compilation compilation) 690INamespaceSymbol namespaceSymbol, 728INamespaceSymbol namespaceSymbol; 750using var _ = ArrayBuilder<INamespaceSymbol>.GetInstance(out var stack); 782using var _ = ArrayBuilder<INamespaceSymbol>.GetInstance(out var namespaceStack);
Library\ObjectBrowser\AbstractObjectBrowserLibraryManager.cs (1)
441return this.LibraryService.NavInfoFactory.CreateForNamespace((INamespaceSymbol)symbol, project, compilation, useExpandedHierarchy);
Library\ObjectBrowser\Extensions.cs (1)
36public static string GetNamespaceNavInfoNameOrEmpty(this INamespaceSymbol namespaceSymbol)
Library\ObjectBrowser\Lists\NamespaceListItem.cs (2)
11internal class NamespaceListItem : SymbolListItem<INamespaceSymbol> 13public NamespaceListItem(ProjectId projectId, INamespaceSymbol namespaceSymbol, string displayText, string fullNameText, string searchText)
Library\VsNavInfo\NavInfoFactory.cs (3)
43case INamespaceSymbol namespaceSymbol: 63public IVsNavInfo CreateForNamespace(INamespaceSymbol namespaceSymbol, Project project, Compilation compilation, bool useExpandedHierarchy = false) 220private static string GetNamespaceName(INamespaceSymbol namespaceSymbol)
MoveStaticMembers\VisualStudioMoveStaticMembersOptionsService.cs (1)
166INamespaceSymbol currentNamespace,
Progression\GraphBuilder.cs (2)
267node = await GetOrCreateNodeForNamespaceAsync(graph, (INamespaceSymbol)symbol, solution, cancellationToken).ConfigureAwait(false); 555private static async Task<GraphNode> GetOrCreateNodeForNamespaceAsync(Graph graph, INamespaceSymbol symbol, Solution solution, CancellationToken cancellationToken)
Progression\GraphNodeCreation.cs (1)
39return await GraphNodeIdCreation.GetIdForNamespaceAsync((INamespaceSymbol)symbol, solution, cancellationToken).ConfigureAwait(false);
Progression\GraphNodeIdCreation.cs (1)
36internal static async Task<GraphNodeId> GetIdForNamespaceAsync(INamespaceSymbol symbol, Solution solution, CancellationToken cancellationToken)
ProjectSystem\AbstractEntryPointFinder.cs (1)
19public override void VisitNamespace(INamespaceSymbol symbol)
ProjectSystem\AbstractEntryPointFinderService.cs (1)
14public IEnumerable<INamedTypeSymbol> FindEntryPoints(INamespaceSymbol symbol, bool findFormsOnly)
ProjectSystem\IEntryPointFinderService.cs (1)
21IEnumerable<INamedTypeSymbol> FindEntryPoints(INamespaceSymbol symbol, bool findFormsOnly);
Venus\ContainedLanguageCodeSupport.cs (1)
429var ns = document.Project.GetCompilationAsync(cancellationToken).WaitAndGetResult_Venus(cancellationToken).GlobalNamespace;
Microsoft.VisualStudio.LanguageServices.CSharp (3)
CodeModel\CSharpCodeModelService_Prototype.cs (1)
564if (!includeNamespaces || ((INamespaceSymbol)symbol).IsGlobalNamespace)
LanguageService\CSharpHelpContextService.cs (1)
564if (symbol is ITypeSymbol or INamespaceSymbol)
ObjectBrowser\DescriptionBuilder.cs (1)
27protected override void BuildNamespaceDeclaration(INamespaceSymbol namespaceSymbol, _VSOBJDESCOPTIONS options)
Microsoft.VisualStudio.LanguageServices.VisualBasic (2)
Help\VisualBasicHelpContextService.vb (1)
112If TypeOf symbol Is ITypeSymbol OrElse TypeOf symbol Is INamespaceSymbol Then
ObjectBrowser\DescriptionBuilder.vb (1)
24Protected Overrides Sub BuildNamespaceDeclaration(namespaceSymbol As INamespaceSymbol, options As _VSOBJDESCOPTIONS)
SemanticSearch.BuildTask (1)
GenerateFilteredReferenceAssembliesTask.cs (1)
232case INamespaceSymbol ns:
System.Private.CoreLib.Generators (11)
IntrinsicsInSystemPrivateCoreLibAnalyzer.cs (11)
50private static INamespaceSymbol GetNamespace(IAssemblySymbol assembly, params string[] namespaceNames) 52INamespaceSymbol outerNamespace = assembly.GlobalNamespace; 55INamespaceSymbol? foundNamespace = null; 66foreach (var innerNamespace in outerNamespace.GetNamespaceMembers()) 98private static IEnumerable<INamedTypeSymbol> GetSubtypes(INamespaceSymbol namespaceSymbol) 109foreach (var namespaceMember in namespaceSymbol.GetNamespaceMembers()) 140INamespaceSymbol systemRuntimeIntrinsicsNamespace = GetNamespace(context.Compilation.Assembly, "System", "Runtime", "Intrinsics"); 148foreach (var architectureSpecificNamespace in systemRuntimeIntrinsicsNamespace.GetNamespaceMembers()) 447private static INamespaceSymbol? SymbolToNamespaceSymbol(ISymbol symbol) 523var namespaceAttributeTypeSymbol = SymbolToNamespaceSymbol(attributeTypeSymbol); 524var namespaceSymbol = SymbolToNamespaceSymbol(symbol);