private IEnumerable <ImportedSymbol> GatherImportedSymbols(UsingSyntax usingDirective, Binder scope)
        {
            var lookup = scope.LookupInGlobalNamespace(usingDirective.Name, package);

            if (!lookup.IsViable)
            {
                diagnostics.AddBindingError(compilationUnit.SourceFile, usingDirective.Name.Position, $"Could not bind using statement for {usingDirective.Name}");
            }

            var symbol     = lookup.Symbols.Single();
            var @namespace = symbol as NamespaceReference;

            if (@namespace != null)
            {
                return(@namespace.GetMembers().Select(m => new ImportedSymbol(m, null)));
            }

            return(new[] { new ImportedSymbol(symbol, null) });
        }
        private IEnumerable<ImportedSymbol> GatherImportedSymbols(UsingSyntax usingDirective, Binder scope)
        {
            var lookup = scope.LookupInGlobalNamespace(usingDirective.Name, package);

            if(!lookup.IsViable)
                diagnostics.AddBindingError(compilationUnit.SourceFile, usingDirective.Name.Position, $"Could not bind using statement for {usingDirective.Name}");

            var symbol = lookup.Symbols.Single();
            var @namespace = symbol as NamespaceReference;
            if(@namespace != null)
                return @namespace.GetMembers().Select(m => new ImportedSymbol(m, null));

            return new[] { new ImportedSymbol(symbol, null) };
        }
Beispiel #3
0
 public virtual LookupResult LookupInGlobalNamespace(NameSyntax name, Package fromPackage)
 {
     return(ContainingScope.LookupInGlobalNamespace(name, fromPackage));
 }