private BoundNode BindNamespace(NamespaceSyntax declaration)
        {
            var enclosingNamespace = LookupEnclosingNamespace();
            var namespaceSymbol = new NamespaceSymbol(declaration, enclosingNamespace);

            AddSymbol(namespaceSymbol, declaration.Name.Span);

            var namespaceBinder = new NamespaceBinder(_sharedBinderState, this, namespaceSymbol);
            namespaceSymbol.Binder = namespaceBinder;

            var boundDeclarations = namespaceBinder.BindTopLevelDeclarations(declaration.Declarations, namespaceSymbol);

            foreach (var member in namespaceBinder.LocalSymbols.Values.SelectMany(x => x))
                namespaceSymbol.AddMember(member);

            return new BoundNamespace(namespaceSymbol, boundDeclarations);
        }
Beispiel #2
0
 public BoundNamespace(NamespaceSymbol namespaceSymbol, ImmutableArray<BoundNode> declarations)
     : base(BoundNodeKind.Namespace)
 {
     NamespaceSymbol = namespaceSymbol;
     Declarations = declarations;
 }
Beispiel #3
0
 public NamespaceBinder(SharedBinderState sharedBinderState, Binder parent, NamespaceSymbol namespaceSymbol)
     : base(sharedBinderState, parent)
 {
     NamespaceSymbol = namespaceSymbol;
 }