コード例 #1
0
            private bool GetPredefinedTypeKindOption(
                State state,
                out TypeKindOptions typeKindValueFinal
                )
            {
                if (state.IsAttribute)
                {
                    typeKindValueFinal = TypeKindOptions.Attribute;
                    return(true);
                }

                if (
                    _service.TryGetBaseList(
                        state.NameOrMemberAccessExpression,
                        out var typeKindValue
                        ) || _service.TryGetBaseList(state.SimpleName, out typeKindValue)
                    )
                {
                    typeKindValueFinal = typeKindValue;
                    return(true);
                }

                if (state.IsClassInterfaceTypes)
                {
                    typeKindValueFinal = TypeKindOptions.BaseList;
                    return(true);
                }

                if (state.IsDelegateOnly)
                {
                    typeKindValueFinal = TypeKindOptions.Delegate;
                    return(true);
                }

                if (state.IsTypeGeneratedIntoNamespaceFromMemberAccess)
                {
                    typeKindValueFinal = state.IsSimpleNameGeneric
                        ? TypeKindOptionsHelper.RemoveOptions(
                        TypeKindOptions.MemberAccessWithNamespace,
                        TypeKindOptions.GenericInCompatibleTypes
                        )
                        : TypeKindOptions.MemberAccessWithNamespace;
                    typeKindValueFinal = state.IsEnumNotAllowed
                        ? TypeKindOptionsHelper.RemoveOptions(
                        typeKindValueFinal,
                        TypeKindOptions.Enum
                        )
                        : typeKindValueFinal;
                    return(true);
                }

                typeKindValueFinal = TypeKindOptions.AllOptions;
                return(false);
            }