Microsoft.CSharp.RuntimeBinder.Semantics.CType.computeCurrentBogusState C# (CSharp) Méthode

computeCurrentBogusState() public méthode

public computeCurrentBogusState ( ) : bool
Résultat bool
        public bool computeCurrentBogusState()
        {
            if (hasBogus())
            {
                return checkBogus();
            }

            bool fBogus = false;

            switch (GetTypeKind())
            {
                case TypeKind.TK_ParameterModifierType:
                case TypeKind.TK_PointerType:
                case TypeKind.TK_ArrayType:
                case TypeKind.TK_NullableType:
                    if (GetBaseOrParameterOrElementType() != null)
                    {
                        fBogus = GetBaseOrParameterOrElementType().computeCurrentBogusState();
                    }
                    break;

                case TypeKind.TK_ErrorType:
                    setBogus(false);
                    break;

                case TypeKind.TK_AggregateType:
                    fBogus = AsAggregateType().getAggregate().computeCurrentBogusState();
                    for (int i = 0; !fBogus && i < AsAggregateType().GetTypeArgsAll().size; i++)
                    {
                        fBogus |= AsAggregateType().GetTypeArgsAll().Item(i).computeCurrentBogusState();
                    }
                    break;

                case TypeKind.TK_TypeParameterType:
                case TypeKind.TK_VoidType:
                case TypeKind.TK_NullType:
                case TypeKind.TK_OpenTypePlaceholderType:
                case TypeKind.TK_ArgumentListType:
                case TypeKind.TK_NaturalIntegerType:
                    setBogus(false);
                    break;

                default:
                    throw Error.InternalCompilerError();
                    //setBogus(false);
                    //break;
            }

            if (fBogus)
            {
                // Only set this if at least 1 declared thing is bogus
                setBogus(fBogus);
            }

            return hasBogus() && checkBogus();
        }

Usage Example

Exemple #1
0
        public bool CheckBogus(CType pType)
        {
            if (pType == null)
            {
                return(false);
            }

            if (!pType.hasBogus())
            {
                bool fBogus = pType.computeCurrentBogusState();

                if (fBogus)
                {
                    // Only set this if everything is declared or
                    // at least 1 declared thing is bogus
                    pType.setBogus(fBogus);
                }
            }

            return(pType.hasBogus() && pType.checkBogus());
        }
All Usage Examples Of Microsoft.CSharp.RuntimeBinder.Semantics.CType::computeCurrentBogusState