<PackageReference Include="Microsoft.CSharp" Version="4.4.1" />

AggregateSymbol

using Microsoft.CSharp.RuntimeBinder.Syntax; using System; using System.Reflection; namespace Microsoft.CSharp.RuntimeBinder.Semantics { internal class AggregateSymbol : NamespaceOrAggregateSymbol { public Type AssociatedSystemType; public Assembly AssociatedAssembly; private InputFile _infile; private AggregateType _atsInst; private AggregateType _pBaseClass; private AggregateType _pUnderlyingType; private TypeArray _ifaces; private TypeArray _ifacesAll; private TypeArray _typeVarsThis; private TypeArray _typeVarsAll; private TypeManager _pTypeManager; private MethodSymbol _pConvFirst; private AggKindEnum _aggKind; private bool _isLayoutError; private bool _isSource; private bool _isPredefined; private PredefinedType _iPredef; private bool _isAbstract; private bool _isSealed; private bool _isUnmanagedStruct; private bool _isManagedStruct; private bool _hasPubNoArgCtor; private bool _hasExternReference; private bool _isSkipUDOps; private bool _isComImport; private bool _isAnonymousType; private bool? _hasConversion; public NamespaceOrAggregateSymbol Parent => parent.AsNamespaceOrAggregateSymbol(); public AggregateSymbol GetBaseAgg() { if (_pBaseClass != null) return _pBaseClass.getAggregate(); return null; } public AggregateType getThisType() { if (_atsInst == null) { AggregateType atsOuter = isNested() ? GetOuterAgg().getThisType() : null; _atsInst = _pTypeManager.GetAggregate(this, atsOuter, GetTypeVars()); } return _atsInst; } public void InitFromInfile(InputFile infile) { _infile = infile; _isSource = infile.isSource; } public bool FindBaseAgg(AggregateSymbol agg) { for (AggregateSymbol aggregateSymbol = this; aggregateSymbol != null; aggregateSymbol = aggregateSymbol.GetBaseAgg()) { if (aggregateSymbol == agg) return true; } return false; } public new AggregateDeclaration DeclFirst() { return (AggregateDeclaration)base.DeclFirst(); } public AggregateDeclaration DeclOnly() { return DeclFirst(); } public bool InAlias(KAID aid) { if (aid < KAID.kaidMinModule) return _infile.InAlias(aid); return aid == GetModuleID(); } public KAID GetModuleID() { return KAID.kaidGlobal; } public KAID GetAssemblyID() { return _infile.GetAssemblyID(); } public bool IsUnresolved() { if (_infile != null) return _infile.GetAssemblyID() == KAID.kaidUnresolved; return false; } public bool isNested() { if (parent != null) return parent.IsAggregateSymbol(); return false; } public AggregateSymbol GetOuterAgg() { if (parent == null || !parent.IsAggregateSymbol()) return null; return parent.AsAggregateSymbol(); } public bool isPredefAgg(PredefinedType pt) { if (_isPredefined) return _iPredef == pt; return false; } public AggKindEnum AggKind() { return _aggKind; } public void SetAggKind(AggKindEnum aggKind) { _aggKind = aggKind; if (aggKind == AggKindEnum.Interface) SetAbstract(true); } public bool IsClass() { return AggKind() == AggKindEnum.Class; } public bool IsDelegate() { return AggKind() == AggKindEnum.Delegate; } public bool IsInterface() { return AggKind() == AggKindEnum.Interface; } public bool IsStruct() { return AggKind() == AggKindEnum.Struct; } public bool IsEnum() { return AggKind() == AggKindEnum.Enum; } public bool IsValueType() { if (AggKind() != AggKindEnum.Struct) return AggKind() == AggKindEnum.Enum; return true; } public bool IsRefType() { if (AggKind() != AggKindEnum.Class && AggKind() != AggKindEnum.Interface) return AggKind() == AggKindEnum.Delegate; return true; } public bool IsStatic() { if (_isAbstract) return _isSealed; return false; } public bool IsAnonymousType() { return _isAnonymousType; } public void SetAnonymousType(bool isAnonymousType) { _isAnonymousType = isAnonymousType; } public bool IsAbstract() { return _isAbstract; } public void SetAbstract(bool abstract) { _isAbstract = abstract; } public bool IsPredefined() { return _isPredefined; } public void SetPredefined(bool predefined) { _isPredefined = predefined; } public PredefinedType GetPredefType() { return _iPredef; } public void SetPredefType(PredefinedType predef) { _iPredef = predef; } public bool IsLayoutError() { return _isLayoutError; } public void SetLayoutError(bool layoutError) { _isLayoutError = layoutError; } public bool IsSealed() { return _isSealed; } public void SetSealed(bool sealed) { _isSealed = sealed; } public bool HasConversion(SymbolLoader pLoader) { pLoader.RuntimeBinderSymbolTable.AddConversionsForType(AssociatedSystemType); if (!_hasConversion.HasValue) _hasConversion = (GetBaseAgg() != null && GetBaseAgg().HasConversion(pLoader)); return _hasConversion.Value; } public void SetHasConversion() { _hasConversion = true; } public bool IsUnmanagedStruct() { return _isUnmanagedStruct; } public void SetUnmanagedStruct(bool unmanagedStruct) { _isUnmanagedStruct = unmanagedStruct; } public bool IsManagedStruct() { return _isManagedStruct; } public void SetManagedStruct(bool managedStruct) { _isManagedStruct = managedStruct; } public bool IsKnownManagedStructStatus() { if (!IsManagedStruct()) return IsUnmanagedStruct(); return true; } public bool HasPubNoArgCtor() { return _hasPubNoArgCtor; } public void SetHasPubNoArgCtor(bool hasPubNoArgCtor) { _hasPubNoArgCtor = hasPubNoArgCtor; } public bool HasExternReference() { return _hasExternReference; } public void SetHasExternReference(bool hasExternReference) { _hasExternReference = hasExternReference; } public bool IsSkipUDOps() { return _isSkipUDOps; } public void SetSkipUDOps(bool skipUDOps) { _isSkipUDOps = skipUDOps; } public void SetComImport(bool comImport) { _isComImport = comImport; } public bool IsSource() { return _isSource; } public TypeArray GetTypeVars() { return _typeVarsThis; } public void SetTypeVars(TypeArray typeVars) { if (typeVars == null) { _typeVarsThis = null; _typeVarsAll = null; } else { TypeArray pTypeArray = (GetOuterAgg() == null) ? BSYMMGR.EmptyTypeArray() : GetOuterAgg().GetTypeVarsAll(); _typeVarsThis = typeVars; _typeVarsAll = _pTypeManager.ConcatenateTypeArrays(pTypeArray, typeVars); } } public TypeArray GetTypeVarsAll() { return _typeVarsAll; } public AggregateType GetBaseClass() { return _pBaseClass; } public void SetBaseClass(AggregateType baseClass) { _pBaseClass = baseClass; } public AggregateType GetUnderlyingType() { return _pUnderlyingType; } public void SetUnderlyingType(AggregateType underlyingType) { _pUnderlyingType = underlyingType; } public TypeArray GetIfaces() { return _ifaces; } public void SetIfaces(TypeArray ifaces) { _ifaces = ifaces; } public TypeArray GetIfacesAll() { return _ifacesAll; } public void SetIfacesAll(TypeArray ifacesAll) { _ifacesAll = ifacesAll; } public TypeManager GetTypeManager() { return _pTypeManager; } public void SetTypeManager(TypeManager typeManager) { _pTypeManager = typeManager; } public MethodSymbol GetFirstUDConversion() { return _pConvFirst; } public void SetFirstUDConversion(MethodSymbol conv) { _pConvFirst = conv; } public new bool InternalsVisibleTo(Assembly assembly) { return _pTypeManager.InternalsVisibleTo(AssociatedAssembly, assembly); } } }