private LexicalScope BuildUsingDirectivesScope( LexicalScope containingScope, FixedList <UsingDirectiveSyntax> usingDirectives) { if (!usingDirectives.Any()) { return(containingScope); } var importedSymbols = usingDirectives .SelectMany(d => allSymbols.Where(s => s.FullName.HasQualifier(d.Name))); return(new NestedScope(containingScope, importedSymbols, Enumerable.Empty <ISymbol>())); }
private static FixedDictionary <NamespaceName, Namespace> BuildNamespaces( FixedList <NonMemberSymbol> declarationSymbols) { var namespaces = declarationSymbols.SelectMany(s => s.ContainingNamespace.NamespaceNames()).Distinct(); var nsSymbols = new List <Namespace>(); foreach (var ns in namespaces) { var symbols = declarationSymbols.Where(s => s.ContainingNamespace == ns).ToList(); var nestedSymbols = declarationSymbols.Where(s => s.ContainingNamespace.IsNestedIn(ns)).ToList(); nsSymbols.Add(new Namespace( ns, ToDictionary(symbols), ToDictionary(nestedSymbols), ToDictionary(symbols.Where(s => s.InCurrentPackage)), ToDictionary(nestedSymbols.Where(s => s.InCurrentPackage)))); } return(nsSymbols.ToFixedDictionary(ns => ns.Name)); }