コード例 #1
0
ファイル: MethodSymbolInfo.cs プロジェクト: fs7744/Norns
        public MethodSymbolInfo(MethodBase m)
        {
            ContainingType = m.DeclaringType.GetSymbolInfo();
            RealMethod     = m;
            if (IsGenericMethod && m is MethodInfo mi)
            {
                TypeParameters = EnumerableExtensions.CreateLazyImmutableArray(() => (mi.IsGenericMethodDefinition ? mi : mi.GetGenericMethodDefinition())
                                                                               .GetGenericArguments().Select(i => new TypeParameterSymbolInfo(i)));
            }
            else
            {
                TypeParameters = EnumerableExtensions.EmptyImmutableArray <ITypeParameterSymbolInfo>();
            }
            Parameters = EnumerableExtensions.CreateLazyImmutableArray(() => RealMethod.GetParameters().Select(i => new ParameterSymbolInfo(i)));
            ReturnType = m is MethodInfo mei?mei.ReturnType.GetSymbolInfo() : null;

            Accessibility = RealMethod.ConvertAccessibilityInfo();
            MethodKind    = RealMethod.ConvertMethodKindInfo();
            var(isAsync, hasReturnValue) = this.GetMethodExtensionInfo();
            IsAsync        = isAsync;
            HasReturnValue = hasReturnValue;
            Attributes     = EnumerableExtensions.CreateLazyImmutableArray <IAttributeSymbolInfo>(() => RealMethod.GetCustomAttributesData().Select(i => new AttributeSymbolInfo(i)));
        }