IsLayoutError() public method

public IsLayoutError ( ) : bool
return bool
Exemplo n.º 1
0
        public bool computeManagedType(SymbolLoader symbolLoader)
        {
            if (this.IsVoidType())
            {
                return(false);
            }

            switch (this.fundType())
            {
            case FUNDTYPE.FT_NONE:
            case FUNDTYPE.FT_REF:
            case FUNDTYPE.FT_VAR:
                return(true);

            case FUNDTYPE.FT_STRUCT:
                if (this.IsNullableType())
                {
                    return(true);
                }
                else
                {
                    AggregateSymbol aggT = this.getAggregate();

                    // See if we already know.
                    if (aggT.IsKnownManagedStructStatus())
                    {
                        return(aggT.IsManagedStruct());
                    }

                    // Generics are always managed.
                    if (aggT.GetTypeVarsAll().size > 0)
                    {
                        aggT.SetManagedStruct(true);
                        return(true);
                    }

                    // If the struct layout has an error, dont recurse its children.
                    if (aggT.IsLayoutError())
                    {
                        aggT.SetUnmanagedStruct(true);
                        return(false);
                    }

                    // at this point we can only determine the managed status
                    // if we have members defined, otherwise we don't know the result
                    if (symbolLoader != null)
                    {
                        for (Symbol ps = aggT.firstChild; ps != null; ps = ps.nextChild)
                        {
                            if (ps.IsFieldSymbol() && !ps.AsFieldSymbol().isStatic)
                            {
                                CType type = ps.AsFieldSymbol().GetType();
                                if (type.computeManagedType(symbolLoader))
                                {
                                    aggT.SetManagedStruct(true);
                                    return(true);
                                }
                            }
                        }

                        aggT.SetUnmanagedStruct(true);
                    }

                    return(false);
                }

            default:
                return(false);
            }
        }