示例#1
0
        private static RQEvent BuildEvent(IEventSymbol symbol, bool buildForPublicAPIs)
        {
            var containingType = BuildNamedType(symbol.ContainingType);

            if (containingType == null)
            {
                return null;
            }

            RQMethodPropertyOrEventName name = RQOrdinaryMethodPropertyOrEventName.CreateOrdinaryEventName(symbol.Name);

            if (symbol.ExplicitInterfaceImplementations.Any())
            {
                if (symbol.ExplicitInterfaceImplementations.Length > 1)
                {
                    return null;
                }

                name = new RQExplicitInterfaceMemberName(BuildType(symbol.ExplicitInterfaceImplementations.Single().ContainingType as ITypeSymbol, buildForPublicAPIs), (RQOrdinaryMethodPropertyOrEventName)name);
            }

            return new RQEvent(containingType, name);
        }
示例#2
0
        private static RQMethod BuildMethod(IMethodSymbol symbol, bool buildForPublicAPIs)
        {
            if (symbol.MethodKind == MethodKind.UserDefinedOperator ||
                symbol.MethodKind == MethodKind.BuiltinOperator ||
                symbol.MethodKind == MethodKind.EventAdd ||
                symbol.MethodKind == MethodKind.EventRemove ||
                symbol.MethodKind == MethodKind.PropertySet ||
                symbol.MethodKind == MethodKind.PropertyGet)
            {
                return null;
            }

            RQMethodPropertyOrEventName name;

            if (symbol.MethodKind == MethodKind.Constructor)
            {
                name = RQOrdinaryMethodPropertyOrEventName.CreateConstructorName();
            }
            else if (symbol.MethodKind == MethodKind.Destructor)
            {
                name = RQOrdinaryMethodPropertyOrEventName.CreateDestructorName();
            }
            else
            {
                name = RQOrdinaryMethodPropertyOrEventName.CreateOrdinaryMethodName(symbol.Name);
            }

            if (symbol.ExplicitInterfaceImplementations.Any())
            {
                if (symbol.ExplicitInterfaceImplementations.Length > 1)
                {
                    return null;
                }

                name = new RQExplicitInterfaceMemberName(BuildType(symbol.ExplicitInterfaceImplementations.Single().ContainingType as ITypeSymbol, buildForPublicAPIs), (RQOrdinaryMethodPropertyOrEventName)name);
            }

            var containingType = BuildNamedType(symbol.ContainingType);

            if (containingType == null)
            {
                return null;
            }

            var typeParamCount = symbol.TypeParameters.Length;
            var parameterList = BuildParameterList(symbol.Parameters, buildForPublicAPIs);

            return new RQMethod(containingType, name, typeParamCount, parameterList);
        }
示例#3
0
        private static RQProperty BuildProperty(IPropertySymbol symbol, bool buildForPublicAPIs)
        {
            RQMethodPropertyOrEventName name = symbol.IsIndexer ?
                RQOrdinaryMethodPropertyOrEventName.CreateOrdinaryIndexerName() :
                RQOrdinaryMethodPropertyOrEventName.CreateOrdinaryPropertyName(symbol.Name);

            if (symbol.ExplicitInterfaceImplementations.Any())
            {
                if (symbol.ExplicitInterfaceImplementations.Length > 1)
                {
                    return null;
                }

                name = new RQExplicitInterfaceMemberName(
                    BuildType(symbol.ExplicitInterfaceImplementations.Single().ContainingType as ITypeSymbol, buildForPublicAPIs),
                    (RQOrdinaryMethodPropertyOrEventName)name);
            }

            var containingType = BuildNamedType(symbol.ContainingType);

            if (containingType == null)
            {
                return null;
            }

            var parameterList = BuildParameterList(symbol.Parameters, buildForPublicAPIs);

            return new RQProperty(containingType, name, typeParameterCount: 0, parameters: parameterList);
        }