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); }
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); }
public GenerateTypeDialogOptions( bool isPublicOnlyAccessibility = false, TypeKindOptions typeKindOptions = TypeKindOptions.AllOptions, bool isAttribute = false) { IsPublicOnlyAccessibility = isPublicOnlyAccessibility; this.TypeKindOptions = typeKindOptions; IsAttribute = isAttribute; }
public GenerateTypeDialogOptions( bool isPublicOnlyAccessibility = false, TypeKindOptions typeKindOptions = TypeKindOptions.AllOptions, bool isAttribute = false) { IsPublicOnlyAccessibility = isPublicOnlyAccessibility; TypeKindOptions = typeKindOptions; IsAttribute = isAttribute; }
public static TypeKindOptions RemoveOptions(TypeKindOptions fromValue, params TypeKindOptions[] removeValues) { var tempReturnValue = fromValue; foreach (var removeValue in removeValues) { tempReturnValue = tempReturnValue & ~removeValue; } return tempReturnValue; }
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); }
public static TypeKindOptions RemoveOptions(TypeKindOptions fromValue, params TypeKindOptions[] removeValues) { var tempReturnValue = fromValue; foreach (var removeValue in removeValues) { tempReturnValue = tempReturnValue & ~removeValue; } return(tempReturnValue); }
public static bool IsStructure(TypeKindOptions option) { return (option & TypeKindOptions.Structure) != 0 ? true : false; }
internal abstract bool TryGetBaseList(TExpressionSyntax expression, out TypeKindOptions returnValue);
public static bool IsStructure(TypeKindOptions option) => (option & TypeKindOptions.Structure) != 0 ? true : false;
public static bool IsInterface(TypeKindOptions option) => (option & TypeKindOptions.Interface) != 0 ? true : false;
internal static TypeKindOptions AddOption(TypeKindOptions toValue, TypeKindOptions addValue) { return toValue | addValue; }
public static bool IsEnum(TypeKindOptions option) => (option & TypeKindOptions.Enum) != 0 ? true : false;
public static bool IsClass(TypeKindOptions option) => (option & TypeKindOptions.Class) != 0 ? true : false;
public static bool IsInterface(TypeKindOptions option) { return((option & TypeKindOptions.Interface) != 0 ? true : false); }
public static bool IsDelegate(TypeKindOptions option) { return((option & TypeKindOptions.Delegate) != 0 ? true : false); }
public static bool IsClass(TypeKindOptions option) { return((option & TypeKindOptions.Class) != 0 ? true : false); }
public static bool IsClass(TypeKindOptions option) { return (option & TypeKindOptions.Class) != 0 ? true : false; }
public static bool IsDelegate(TypeKindOptions option) => (option & TypeKindOptions.Delegate) != 0 ? true : false;
internal static TypeKindOptions AddOption(TypeKindOptions toValue, TypeKindOptions addValue) => toValue | addValue;
public static bool IsModule(TypeKindOptions option) => (option & TypeKindOptions.Module) != 0 ? true : false;
public static bool IsStructure(TypeKindOptions option) { return((option & TypeKindOptions.Structure) != 0 ? true : false); }
public static bool IsInterface(TypeKindOptions option) { return (option & TypeKindOptions.Interface) != 0 ? true : false; }
public static bool IsEnum(TypeKindOptions option) { return((option & TypeKindOptions.Enum) != 0 ? true : false); }
public static bool IsEnum(TypeKindOptions option) { return (option & TypeKindOptions.Enum) != 0 ? true : false; }
public static bool IsModule(TypeKindOptions option) { return((option & TypeKindOptions.Module) != 0 ? true : false); }
public static bool IsDelegate(TypeKindOptions option) { return (option & TypeKindOptions.Delegate) != 0 ? true : false; }
internal static TypeKindOptions AddOption(TypeKindOptions toValue, TypeKindOptions addValue) { return(toValue | addValue); }
public static bool IsModule(TypeKindOptions option) { return (option & TypeKindOptions.Module) != 0 ? true : false; }