コード例 #1
0
        internal override bool TryGetBaseList(ExpressionSyntax expression, out TypeKindOptions typeKindValue)
        {
            typeKindValue = TypeKindOptions.AllOptions;

            if (expression == null)
            {
                return(false);
            }

            var node = expression as SyntaxNode;

            while (node != null)
            {
                if (node is BaseListSyntax)
                {
                    if (node.Parent.IsKind(SyntaxKind.InterfaceDeclaration, SyntaxKind.StructDeclaration, SyntaxKind.RecordStructDeclaration))
                    {
                        typeKindValue = TypeKindOptions.Interface;
                        return(true);
                    }

                    typeKindValue = TypeKindOptions.BaseList;
                    return(true);
                }

                node = node.Parent;
            }

            return(false);
        }
コード例 #2
0
        internal override bool TryGetBaseList(ExpressionSyntax expression, out TypeKindOptions typeKindValue)
        {
            typeKindValue = TypeKindOptions.AllOptions;

            if (expression == null)
            {
                return(false);
            }

            var node = expression as SyntaxNode;

            while (node != null)
            {
                if (node is ImplementListSyntax)
                {
                    if (node.Parent != null && (node.Parent is InterfaceDeclarationSyntax || node.Parent is StructDeclarationSyntax))
                    {
                        typeKindValue = TypeKindOptions.Interface;
                        return(true);
                    }

                    typeKindValue = TypeKindOptions.BaseList;
                    return(true);
                }

                node = node.Parent;
            }

            return(false);
        }
コード例 #3
0
 public GenerateTypeDialogOptions(
     bool isPublicOnlyAccessibility  = false,
     TypeKindOptions typeKindOptions = TypeKindOptions.AllOptions,
     bool isAttribute = false)
 {
     IsPublicOnlyAccessibility = isPublicOnlyAccessibility;
     this.TypeKindOptions      = typeKindOptions;
     IsAttribute = isAttribute;
 }
コード例 #4
0
 public GenerateTypeDialogOptions(
     bool isPublicOnlyAccessibility = false,
     TypeKindOptions typeKindOptions = TypeKindOptions.AllOptions,
     bool isAttribute = false)
 {
     IsPublicOnlyAccessibility = isPublicOnlyAccessibility;
     TypeKindOptions = typeKindOptions;
     IsAttribute = isAttribute;
 }
コード例 #5
0
		public static TypeKindOptions RemoveOptions(TypeKindOptions fromValue, params TypeKindOptions[] removeValues)
		{
			var tempReturnValue = fromValue;
			foreach (var removeValue in removeValues)
			{
				tempReturnValue = tempReturnValue & ~removeValue;
			}

			return tempReturnValue;
		}
コード例 #6
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);
            }
コード例 #7
0
ファイル: TypeKindOptions.cs プロジェクト: stark-lang/stark
        public static TypeKindOptions RemoveOptions(TypeKindOptions fromValue, params TypeKindOptions[] removeValues)
        {
            var tempReturnValue = fromValue;

            foreach (var removeValue in removeValues)
            {
                tempReturnValue = tempReturnValue & ~removeValue;
            }

            return(tempReturnValue);
        }
コード例 #8
0
		public static bool IsStructure(TypeKindOptions option)
		{
			return (option & TypeKindOptions.Structure) != 0 ? true : false;
		}
コード例 #9
0
 internal abstract bool TryGetBaseList(TExpressionSyntax expression, out TypeKindOptions returnValue);
コード例 #10
0
 public static bool IsStructure(TypeKindOptions option)
 => (option & TypeKindOptions.Structure) != 0 ? true : false;
コード例 #11
0
 public static bool IsInterface(TypeKindOptions option)
 => (option & TypeKindOptions.Interface) != 0 ? true : false;
コード例 #12
0
		internal static TypeKindOptions AddOption(TypeKindOptions toValue, TypeKindOptions addValue)
		{
			return toValue | addValue;
		}
コード例 #13
0
 public static bool IsEnum(TypeKindOptions option)
 => (option & TypeKindOptions.Enum) != 0 ? true : false;
コード例 #14
0
 public static bool IsClass(TypeKindOptions option)
 => (option & TypeKindOptions.Class) != 0 ? true : false;
コード例 #15
0
ファイル: TypeKindOptions.cs プロジェクト: stark-lang/stark
 public static bool IsInterface(TypeKindOptions option)
 {
     return((option & TypeKindOptions.Interface) != 0 ? true : false);
 }
コード例 #16
0
ファイル: TypeKindOptions.cs プロジェクト: stark-lang/stark
 public static bool IsDelegate(TypeKindOptions option)
 {
     return((option & TypeKindOptions.Delegate) != 0 ? true : false);
 }
コード例 #17
0
ファイル: TypeKindOptions.cs プロジェクト: stark-lang/stark
 public static bool IsClass(TypeKindOptions option)
 {
     return((option & TypeKindOptions.Class) != 0 ? true : false);
 }
コード例 #18
0
		public static bool IsClass(TypeKindOptions option)
		{
			return (option & TypeKindOptions.Class) != 0 ? true : false;
		}
コード例 #19
0
 public static bool IsDelegate(TypeKindOptions option)
 => (option & TypeKindOptions.Delegate) != 0 ? true : false;
コード例 #20
0
 internal static TypeKindOptions AddOption(TypeKindOptions toValue, TypeKindOptions addValue)
 => toValue | addValue;
コード例 #21
0
 public static bool IsModule(TypeKindOptions option)
 => (option & TypeKindOptions.Module) != 0 ? true : false;
コード例 #22
0
ファイル: TypeKindOptions.cs プロジェクト: stark-lang/stark
 public static bool IsStructure(TypeKindOptions option)
 {
     return((option & TypeKindOptions.Structure) != 0 ? true : false);
 }
コード例 #23
0
		public static bool IsInterface(TypeKindOptions option)
		{
			return (option & TypeKindOptions.Interface) != 0 ? true : false;
		}
コード例 #24
0
ファイル: TypeKindOptions.cs プロジェクト: stark-lang/stark
 public static bool IsEnum(TypeKindOptions option)
 {
     return((option & TypeKindOptions.Enum) != 0 ? true : false);
 }
コード例 #25
0
		public static bool IsEnum(TypeKindOptions option)
		{
			return (option & TypeKindOptions.Enum) != 0 ? true : false;
		}
コード例 #26
0
ファイル: TypeKindOptions.cs プロジェクト: stark-lang/stark
 public static bool IsModule(TypeKindOptions option)
 {
     return((option & TypeKindOptions.Module) != 0 ? true : false);
 }
コード例 #27
0
		public static bool IsDelegate(TypeKindOptions option)
		{
			return (option & TypeKindOptions.Delegate) != 0 ? true : false;
		}
コード例 #28
0
ファイル: TypeKindOptions.cs プロジェクト: stark-lang/stark
 internal static TypeKindOptions AddOption(TypeKindOptions toValue, TypeKindOptions addValue)
 {
     return(toValue | addValue);
 }
コード例 #29
0
		public static bool IsModule(TypeKindOptions option)
		{
			return (option & TypeKindOptions.Module) != 0 ? true : false;
		}