예제 #1
0
 public BoundInterfaceType(InterfaceSymbol interfaceSymbol, ImmutableArray<BoundFunction> methods)
     : base(BoundNodeKind.InterfaceType, interfaceSymbol)
 {
     InterfaceSymbol = interfaceSymbol;
     Methods = methods;
 }
예제 #2
0
        private void BindInterfaceDeclaration(InterfaceTypeSyntax declaration)
        {
            Func<TypeSymbol, IEnumerable<MethodDeclarationSymbol>> lazyMemberSymbols = cd =>
            {
                var memberSymbols = new List<MethodDeclarationSymbol>();
                foreach (var memberSyntax in declaration.Methods)
                    memberSymbols.Add(BindMethodDeclaration(memberSyntax, cd));
                return memberSymbols;
            };

            var symbol = new InterfaceSymbol(declaration, null, lazyMemberSymbols);
            _bindingResult.AddSymbol(declaration, symbol);

            _symbolSet.AddGlobal(symbol);
        }
예제 #3
0
        private BoundInterfaceType BindInterfaceDeclaration(InterfaceTypeSyntax declaration, Symbol parent)
        {
            var interfaceSymbol = new InterfaceSymbol(declaration, parent);
            AddSymbol(interfaceSymbol, declaration.Name.Span);

            var methods = new List<BoundFunction>();
            var interfaceBinder = new Binder(_sharedBinderState, this);
            foreach (var memberSyntax in declaration.Methods)
                methods.Add(interfaceBinder.Bind(memberSyntax, x => interfaceBinder.BindFunctionDeclaration(x, interfaceSymbol)));

            foreach (var member in interfaceBinder.LocalSymbols.Values.SelectMany(x => x))
                interfaceSymbol.AddMember(member);

            return new BoundInterfaceType(interfaceSymbol, methods.ToImmutableArray());
        }