2using System.Collections.Generic;
3using System.Collections.Immutable;
4using System.Diagnostics;
6using System.Reflection;
15 readonly
Assembly _underlyingAssembly;
16 readonly ConditionalWeakTable<Module, ReflectionModuleSymbol> _modules =
new();
18 ImmutableArray<CustomAttributeSymbol> _customAttributes =
default;
28 _underlyingAssembly = underlyingAssembly ??
throw new ArgumentNullException(nameof(underlyingAssembly));
31 internal Assembly UnderlyingAssembly => _underlyingAssembly;
41 Debug.Assert(module.Assembly == _underlyingAssembly);
45 public IEnumerable<ITypeSymbol>
DefinedTypes => ResolveTypeSymbols(_underlyingAssembly.DefinedTypes);
49 public IEnumerable<ITypeSymbol>
ExportedTypes => ResolveTypeSymbols(_underlyingAssembly.ExportedTypes);
51 public string?
FullName => _underlyingAssembly.FullName;
55 public IEnumerable<IModuleSymbol>
Modules => ResolveModuleSymbols(_underlyingAssembly.Modules);
59 return ResolveTypeSymbols(_underlyingAssembly.GetExportedTypes());
64 return _underlyingAssembly.GetModule(name) is
Module m ? GetOrCreateModuleSymbol(m) :
null;
69 return ResolveModuleSymbols(_underlyingAssembly.GetModules()).CastArray<
IModuleSymbol>();
72 public ImmutableArray<IModuleSymbol>
GetModules(
bool getResourceModules)
74 return ResolveModuleSymbols(_underlyingAssembly.GetModules(getResourceModules)).CastArray<
IModuleSymbol>();
79 return _underlyingAssembly.GetName();
84 return _underlyingAssembly.GetReferencedAssemblies().ToImmutableArray();
99 return ResolveTypeSymbols(_underlyingAssembly.GetTypes());
104 return _customAttributes.IsDefault ? _customAttributes = ResolveCustomAttributes(_underlyingAssembly.GetCustomAttributesData()) : _customAttributes;
109 return GetCustomAttributes().Where(i => i.AttributeType == attributeType).ToImmutableArray();
IKVM.Reflection.Module Module
IKVM.Reflection.Type Type
IKVM.Reflection.Assembly Assembly
IKVM.Reflection.AssemblyName AssemblyName
IModuleSymbol? GetModule(string name)
Gets the specified module in this assembly.
ITypeSymbol[] GetTypes()
Gets all types defined in this assembly.
bool IsDefined(ITypeSymbol attributeType)
Indicates whether one or more instance of attributeType is defined on this member.
ITypeSymbol? GetType(string name, bool throwOnError)
Gets the ITypeSymbol object with the specified name in the assembly instance and optionally throws an...
IEnumerable< ITypeSymbol > ExportedTypes
Gets a collection of the public types defined in this assembly that are visible outside the assembly.
ImmutableArray< IModuleSymbol > GetModules(bool getResourceModules)
Gets all the modules that are part of this assembly, specifying whether to include resource modules.
ImmutableArray< CustomAttributeSymbol > GetCustomAttributes()
Returns an array of all of the custom attributes defined on this member, excluding named attributes,...
string? FullName
Gets the display name of the assembly.
AssemblyName GetName()
Gets an AssemblyName for this assembly.
IModuleSymbol ManifestModule
Gets the module that contains the manifest for the current assembly.
ImmutableArray< IModuleSymbol > GetModules()
Gets all the modules that are part of this assembly.
ITypeSymbol? GetType(string name)
Gets the ITypeSymbol object with the specified name in the assembly instance.
IEnumerable< IModuleSymbol > Modules
Gets a collection that contains the modules in this assembly.
ReflectionAssemblySymbol(ReflectionSymbolContext context, Assembly underlyingAssembly)
Initializes a new instance.
IMethodSymbol? EntryPoint
Gets the entry point of this assembly.
ImmutableArray< AssemblyName > GetReferencedAssemblies()
Gets the AssemblyName objects for all the assemblies referenced by this assembly.
IEnumerable< ITypeSymbol > DefinedTypes
Gets a collection of the types defined in this assembly.
ITypeSymbol[] GetExportedTypes()
Gets the public types defined in this assembly that are visible outside the assembly.
ImmutableArray< CustomAttributeSymbol > GetCustomAttributes(ITypeSymbol attributeType)
Returns an array of custom attributes defined on this member, identified by type, or an empty array i...
Implementation of IModuleSymbol derived from System.Reflection.
Holds references to symbols derived from System.Reflection.
ReflectionTypeSymbol GetOrCreateTypeSymbol(Type type)
Gets or creates a ReflectionTypeSymbol for the specified Type.
Base class for managed symbols.
ReflectionSymbolContext Context
Gets the associated ReflectionSymbolContext.
Represents an assembly, which is a reusable, versionable, and self-describing building block of a com...
Discovers the attributes of a method and provides access to method metadata.
Performs reflection on a module.
Represents type declarations: class types, interface types, array types, value types,...