Linker.Dataflow\CompilerGeneratedState.cs (32)
20readonly Dictionary<TypeDefinition, MethodDefinition> _compilerGeneratedTypeToUserCodeMethod;
21readonly Dictionary<TypeDefinition, TypeArgumentInfo> _generatedTypeToTypeArgumentInfo;
33readonly Dictionary<TypeDefinition, Dictionary<MethodDefinition, List<IMemberDefinition>>?> _cachedTypeToCompilerGeneratedMembers;
38_compilerGeneratedTypeToUserCodeMethod = new Dictionary<TypeDefinition, MethodDefinition>();
39_generatedTypeToTypeArgumentInfo = new Dictionary<TypeDefinition, TypeArgumentInfo>();
41_cachedTypeToCompilerGeneratedMembers = new Dictionary<TypeDefinition, Dictionary<MethodDefinition, List<IMemberDefinition>>?>();
44static IEnumerable<TypeDefinition> GetCompilerGeneratedNestedTypes(TypeDefinition type)
46foreach (var nestedType in type.NestedTypes)
53foreach (var recursiveNestedType in GetCompilerGeneratedNestedTypes(nestedType))
79if (member.DeclaringType is not TypeDefinition declaringType)
85public static bool TryGetStateMachineType(MethodDefinition method, [NotNullWhen(true)] out TypeDefinition? stateMachineType)
116TypeDefinition? GetCompilerGeneratedStateForType(TypeDefinition type)
134var generatedTypeToTypeArgs = new Dictionary<TypeDefinition, TypeArgumentInfo>();
240if (TryGetStateMachineType(method, out TypeDefinition? stateMachineType))
257static bool IsSameOrNestedType(TypeDefinition type, TypeDefinition potentialOuterType)
282foreach (var nestedType in GetCompilerGeneratedNestedTypes(type))
322case TypeDefinition stateMachineType:
338foreach (var generatedType in generatedTypeToTypeArgs.Keys)
388TypeDefinition generatedType,
389Dictionary<TypeDefinition, TypeArgumentInfo> generatedTypeToTypeArgs,
456TypeDefinition compilerGeneratedType,
509static TypeDefinition? GetFirstConstructorArgumentAsType(CustomAttribute attribute)
514return attribute.ConstructorArguments[0].Value as TypeDefinition;
523var typeToCache = GetCompilerGeneratedStateForType(method.DeclaringType);
534public IList<GenericParameter>? GetGeneratedTypeAttributes(TypeDefinition generatedType)
547var typeToCache = GetCompilerGeneratedStateForType(generatedType);
574TypeDefinition sourceType = sourceMember as TypeDefinition ?? sourceMember.DeclaringType;
585var typeToCache = GetCompilerGeneratedStateForType(sourceType);
Linker.Dataflow\DynamicallyAccessedMembersBinder.cs (28)
18public static IEnumerable<IMetadataTokenProvider> GetDynamicallyAccessedMembers(this TypeDefinition typeDefinition, LinkContext context, DynamicallyAccessedMemberTypes memberTypes, bool declaredOnly = false)
83foreach (var nested in typeDefinition.ApplyIncludeInherited(context, t => t.GetNestedTypesOnType(context, filter: null, bindingFlags: BindingFlags.NonPublic), withInherited))
96foreach (var nested in typeDefinition.ApplyIncludeInherited(context, t => t.GetNestedTypesOnType(context, filter: null, bindingFlags: BindingFlags.Public), withInherited))
139public static IEnumerable<MethodDefinition> GetConstructorsOnType(this TypeDefinition type, Func<MethodDefinition, bool>? filter, BindingFlags? bindingFlags = null)
167TypeDefinition? type = thisType.ResolveToTypeDefinition(context);
211public static IEnumerable<FieldDefinition> GetFieldsOnTypeHierarchy(this TypeDefinition thisType, LinkContext context, Func<FieldDefinition, bool>? filter, BindingFlags? bindingFlags = BindingFlags.Default)
213TypeDefinition? type = thisType;
253public static IEnumerable<TypeDefinition> GetNestedTypesOnType(this TypeReference typeRef, LinkContext context, Func<TypeDefinition, bool>? filter, BindingFlags? bindingFlags = BindingFlags.Default)
255if (typeRef.ResolveToTypeDefinition(context) is not TypeDefinition type)
258foreach (var nestedType in type.NestedTypes)
279public static IEnumerable<PropertyDefinition> GetPropertiesOnTypeHierarchy(this TypeDefinition thisType, LinkContext context, Func<PropertyDefinition, bool>? filter, BindingFlags? bindingFlags = BindingFlags.Default)
281TypeDefinition? type = thisType;
334public static IEnumerable<EventDefinition> GetEventsOnTypeHierarchy(this TypeDefinition thisType, LinkContext context, Func<EventDefinition, bool>? filter, BindingFlags? bindingFlags = BindingFlags.Default)
336TypeDefinition? type = thisType;
391public static IEnumerable<InterfaceImplementation> GetAllInterfaceImplementations(this TypeDefinition thisType, LinkContext context, bool declaredOnly)
393TypeDefinition? type = thisType;
400TypeDefinition? interfaceType = context.TryResolve(i.InterfaceType);
418public static void GetAllOnType(this TypeDefinition type, LinkContext context, bool declaredOnly, List<IMetadataTokenProvider> members) => GetAllOnType(type, context, declaredOnly, members, new HashSet<TypeDefinition>());
420static void GetAllOnType(TypeDefinition type, LinkContext context, bool declaredOnly, List<IMetadataTokenProvider> members, HashSet<TypeDefinition> types)
427foreach (var nested in type.NestedTypes)
437var baseType = context.TryResolve(type.BaseType);
454var interfaceType = context.TryResolve(iface.InterfaceType);
487private static IEnumerable<T> ApplyIncludeInherited<T>(this TypeDefinition thisType, LinkContext context, Func<TypeDefinition, IEnumerable<T>> selector, bool includeBases)
489TypeDefinition? type = thisType;
Linker.Steps\DescriptorMarker.cs (14)
59foreach (var type in assembly.MainModule.Types)
81foreach (TypeDefinition type in assembly.MainModule.Types)
97void MarkAndPreserveAll(TypeDefinition type, XPathNavigator nav)
105foreach (TypeDefinition nested in type.NestedTypes)
109protected override TypeDefinition? ProcessExportedType(ExportedType exported, AssemblyDefinition assembly, XPathNavigator nav)
129protected override void ProcessType(TypeDefinition type, XPathNavigator nav)
169var currentType = type;
172var parent = currentType.DeclaringType;
190protected override void ProcessField(TypeDefinition type, FieldDefinition field, XPathNavigator nav)
201protected override void ProcessMethod(TypeDefinition type, MethodDefinition method, XPathNavigator nav, object? customData)
222void ProcessMethodIfNotNull(TypeDefinition type, MethodDefinition method, XPathNavigator nav, object? customData)
230protected override MethodDefinition? GetMethod(TypeDefinition type, string signature)
267protected override void ProcessEvent(TypeDefinition type, EventDefinition @event, XPathNavigator nav, object? customData)
277protected override void ProcessProperty(TypeDefinition type, PropertyDefinition property, XPathNavigator nav, object? customData, bool fromSignature)
Linker.Steps\LinkAttributesParser.cs (22)
50TypeDefinition? attributeType;
59if (provider is not TypeDefinition)
111TypeDefinition? GenerateRemoveAttributeInstancesAttribute()
113TypeDefinition? td = null;
115if (_context.MarkedKnownMembers.RemoveAttributeInstancesAttributeDefinition is TypeDefinition knownTypeDef)
120var voidType = BCL.FindPredefinedType(WellKnownType.System_Void, _context);
124var attributeType = BCL.FindPredefinedType(WellKnownType.System_Attribute, _context);
128var objectType = BCL.FindPredefinedType(WellKnownType.System_Object, _context);
166CustomAttribute? CreateCustomAttribute(XPathNavigator nav, TypeDefinition attributeType, ICustomAttributeProvider provider)
186MethodDefinition? FindBestMatchingConstructor(TypeDefinition attributeType, CustomAttributeArgument[] args)
204var parameterType = _context.TryResolve(p.ParameterType);
216void ReadCustomAttributeProperties(XPathNavigator nav, TypeDefinition attributeType, CustomAttribute customAttribute)
280var typedef = _context.TryResolve(typeref);
303var enumType = _context.Resolve(typeref);
446bool GetAttributeType(XPathNavigator nav, string attributeFullName, [NotNullWhen(true)] out TypeDefinition? attributeType)
507protected override void ProcessType(TypeDefinition type, XPathNavigator nav)
519foreach (TypeDefinition nested in type.NestedTypes)
527protected override void ProcessField(TypeDefinition type, FieldDefinition field, XPathNavigator nav)
532protected override void ProcessMethod(TypeDefinition type, MethodDefinition method, XPathNavigator nav, object? customData)
586protected override MethodDefinition? GetMethod(TypeDefinition type, string signature)
633protected override void ProcessProperty(TypeDefinition type, PropertyDefinition property, XPathNavigator nav, object? customData, bool fromSignature)
638protected override void ProcessEvent(TypeDefinition type, EventDefinition @event, XPathNavigator nav, object? customData)
Linker.Steps\MarkStep.cs (112)
67protected List<(TypeDefinition, MessageOrigin)> _typesWithInterfaces;
69protected List<TypeDefinition> _dynamicInterfaceCastableImplementationTypes;
72readonly List<(TypeDefinition Type, MethodBody Body, Instruction Instr)> _pending_isinst_instr;
89readonly HashSet<TypeDefinition> _entireTypesMarked;
229_typesWithInterfaces = new List<(TypeDefinition, MessageOrigin)>();
231_dynamicInterfaceCastableImplementationTypes = new List<TypeDefinition>();
233_pending_isinst_instr = new List<(TypeDefinition, MethodBody, Instruction)>();
234_entireTypesMarked = new HashSet<TypeDefinition>();
305static bool TypeIsDynamicInterfaceCastableImplementation(TypeDefinition type)
318protected bool IsFullyPreserved(TypeDefinition type)
336internal void MarkEntireType(TypeDefinition type, in DependencyInfo reason, MessageOrigin origin)
352foreach (TypeDefinition nested in type.NestedTypes)
479case TypeDefinition type:
501foreach (var type in Annotations.GetPendingPreserve())
533TypeDefinition type = item.Type;
587(var type, var origin) = _typesWithInterfaces[i];
629foreach (TypeDefinition type in assembly.MainModule.Types)
636void CheckIfTypeOrNestedTypesIsDynamicCastableImplementation(TypeDefinition type)
643foreach (var nestedType in type.NestedTypes)
658var type = _dynamicInterfaceCastableImplementationTypes[i];
803bool IsInterfaceImplementationMarkedRecursively(TypeDefinition type, TypeDefinition interfaceType)
810internal static bool IsInterfaceImplementationMarkedRecursively(TypeDefinition type, TypeDefinition interfaceType, LinkContext context)
816TypeDefinition? resolvedInterface = context.Resolve(intf.InterfaceType);
850TypeDefinition? type = Context.Resolve(marshaler.ManagedType);
877var resolvedAttributeType = Context.Resolve(ca.AttributeType);
899bool IsAttributeRemoved(CustomAttribute ca, TypeDefinition attributeType)
970TypeDefinition? type;
1031case TypeDefinition type:
1081TypeDefinition? td;
1137bool MarkDependencyMethod(TypeDefinition type, string name, string[]? signature, in DependencyInfo reason, MessageOrigin origin)
1209TypeDefinition? type = Context.Resolve(constructor_type);
1244TypeDefinition? type = Context.Resolve(attr_type);
1252protected virtual bool ShouldMarkTypeStaticConstructor(TypeDefinition type)
1263protected internal void MarkStaticConstructor(TypeDefinition type, in DependencyInfo reason, in MessageOrigin origin)
1288var displayTargetType = GetDebuggerAttributeTargetType(app.Attribute, (AssemblyDefinition)app.Provider);
1320TypeDefinition? type = Context.Resolve(security_type);
1333protected void MarkCustomAttributeProperties(ICustomAttribute ca, TypeDefinition attribute, MessageOrigin origin)
1342protected void MarkCustomAttributeProperty(CustomAttributeNamedArgument namedArgument, TypeDefinition attribute, ICustomAttribute ca, in DependencyInfo reason, MessageOrigin origin)
1357PropertyDefinition? GetProperty(TypeDefinition inputType, string propertyname)
1359TypeDefinition? type = inputType;
1372protected void MarkCustomAttributeFields(ICustomAttribute ca, TypeDefinition attribute, MessageOrigin origin)
1381protected void MarkCustomAttributeField(CustomAttributeNamedArgument namedArgument, TypeDefinition attribute, ICustomAttribute ca, MessageOrigin origin)
1396FieldDefinition? GetField(TypeDefinition inputType, string fieldname)
1398TypeDefinition? type = inputType;
1411MethodDefinition? GetMethodWithNoParameters(TypeDefinition inputType, string methodname)
1413TypeDefinition? type = inputType;
1541foreach (TypeDefinition type in module.Types)
1610TypeDefinition? moduleType = assembly.MainModule.Types.FirstOrDefault(t => t.MetadataToken.RID == 1);
1661TypeDefinition? targetType = GetDebuggerAttributeTargetType(assemblyLevelAttribute.Attribute, (AssemblyDefinition)assemblyLevelAttribute.Provider);
1668TypeDefinition? targetType = GetDebuggerAttributeTargetType(assemblyLevelAttribute.Attribute, (AssemblyDefinition)assemblyLevelAttribute.Provider);
1822var type = origin.Provider as TypeDefinition;
1825static bool IsDeclaredWithinType(IMemberDefinition member, TypeDefinition type)
1900TypeDefinition? typeWithFields = field.DeclaringType;
1908var parent = field.DeclaringType;
1985protected virtual void MarkSerializable(TypeDefinition type, MessageOrigin origin)
2004TypeDefinition? definition = MarkType(type, reason, origin);
2016internal void MarkRelevantToVariantCasting(TypeDefinition type)
2047bool MarkMethodsVisibleToReflection(TypeDefinition type, in DependencyInfo reason, MessageOrigin origin)
2080bool MarkFieldsVisibleToReflection(TypeDefinition type, in DependencyInfo reason, MessageOrigin origin, bool markBackingFieldsOnlyIfPropertyMarked = false)
2128internal void MarkStaticConstructorVisibleToReflection(TypeDefinition type, in DependencyInfo reason, in MessageOrigin origin)
2139protected internal virtual TypeDefinition? MarkType(TypeReference reference, DependencyInfo reason, MessageOrigin origin)
2156TypeDefinition? type = Context.Resolve(reference);
2200foreach (Action<TypeDefinition> handleMarkType in MarkContext.MarkTypeActions)
2310protected virtual void DoAdditionalTypeProcessing(TypeDefinition type, MessageOrigin origin)
2330protected virtual void DoAdditionalInstantiatedTypeProcessing(TypeDefinition type, MessageOrigin origin)
2334TypeDefinition? GetDebuggerAttributeTargetType(CustomAttribute ca, AssemblyDefinition asm)
2351void MarkTypeSpecialCustomAttributes(TypeDefinition type, MessageOrigin origin)
2359var resolvedAttributeType = Context.Resolve(attrType);
2404void MarkXmlSchemaProvider(TypeDefinition type, CustomAttribute attribute, MessageOrigin origin)
2419void MarkTypeWithDebuggerDisplayAttribute(TypeDefinition type, CustomAttribute attribute, MessageOrigin origin)
2441void MarkTypeWithDebuggerDisplayAttributeValue(TypeDefinition type, CustomAttribute attribute, string? displayString, MessageOrigin origin)
2499if (Context.TryResolve(type.BaseType) is not TypeDefinition baseType)
2507void MarkTypeWithDebuggerTypeProxyAttribute(TypeDefinition type, CustomAttribute attribute, MessageOrigin origin)
2529if (Context.TryResolve(proxyTypeReference) is TypeDefinition proxyType)
2549protected int MarkNamedMethod(TypeDefinition type, string method_name, in DependencyInfo reason, MessageOrigin origin)
2576bool MarkNamedField(TypeDefinition type, string field_name, in DependencyInfo reason, MessageOrigin origin)
2593void MarkNamedProperty(TypeDefinition type, string property_name, in DependencyInfo reason, MessageOrigin origin)
2609void MarkInterfaceImplementations(TypeDefinition type)
2624protected virtual bool ShouldMarkInterfaceImplementationList(TypeDefinition type, List<InterfaceImplementation> ifaces, TypeReference ifaceType)
2632if (Context.Resolve(ifaceType) is not TypeDefinition resolvedInterfaceType)
2792protected bool MarkDefaultConstructor(TypeDefinition type, in DependencyInfo reason, MessageOrigin origin)
2800void MarkCustomMarshalerGetInstance(TypeDefinition type, in DependencyInfo reason, MessageOrigin origin)
2815void MarkICustomMarshalerMethods(TypeDefinition inputType, in DependencyInfo reason, MessageOrigin origin)
2817TypeDefinition? type = inputType;
2833var tdef = Context.Resolve(iface_type);
2884protected virtual bool AlwaysMarkTypeAsInstantiated(TypeDefinition td)
2903void MarkEventSourceProviders(TypeDefinition td, MessageOrigin origin)
2906foreach (var nestedType in td.NestedTypes)
2913protected virtual void MarkMulticastDelegate(TypeDefinition type, MessageOrigin origin)
2971var argumentTypeDef = MarkType(argument, new DependencyInfo(DependencyKind.GenericArgumentType, instance), origin);
2990void ApplyPreserveInfo(TypeDefinition type)
3090void ApplyPreserveMethods(TypeDefinition type, MessageOrigin origin)
3110protected bool MarkFields(TypeDefinition type, bool includeStatic, in DependencyInfo reason, MessageOrigin origin)
3143protected void MarkStaticFields(TypeDefinition type, in DependencyInfo reason, MessageOrigin origin)
3155protected virtual bool MarkMethods(TypeDefinition type, in DependencyInfo reason, MessageOrigin origin)
3179if (reference.Name == ".ctor" && Context.TryResolve(arrayType) is TypeDefinition typeDefinition)
3486TypeDefinition declaringType = method.DeclaringType;
3517void MarkImplicitlyUsedFields(TypeDefinition type, MessageOrigin origin)
3527static bool TypeIsInlineArrayType(TypeDefinition type)
3539protected internal virtual void MarkRequirementsForInstantiatedTypes(TypeDefinition type)
3594var baseType = Context.Resolve(method.DeclaringType.BaseType);
3613var nse = BCL.FindPredefinedType(WellKnownType.System_NotSupportedException, Context);
3623var objectType = BCL.FindPredefinedType(WellKnownType.System_Object, Context);
3639var disablePrivateReflection = BCL.FindPredefinedType(WellKnownType.System_Runtime_CompilerServices_DisablePrivateReflectionAttribute, Context);
3693TypeDefinition? returnTypeDefinition = Context.TryResolve(method.ReturnType);
3720TypeDefinition? paramTypeDefinition = Context.TryResolve(paramTypeReference);
4056if (Context.TryResolve(operand) is TypeDefinition typeDefinition)
4068TypeDefinition? type = Context.Resolve(operand);
4144case TypeDefinition stateMachineType:
Linker.Steps\ProcessLinkerXmlBase.cs (26)
185TypeDefinition type = assembly.MainModule.GetType(fullname);
193var resolvedExternal = ProcessExportedType(exported, assembly, typeNav);
214protected virtual TypeDefinition? ProcessExportedType(ExportedType exported, AssemblyDefinition assembly, XPathNavigator nav) => _context.TryResolve(exported);
216void MatchType(TypeDefinition type, Regex regex, XPathNavigator nav)
224foreach (var nt in type.NestedTypes)
232foreach (TypeDefinition type in assembly.MainModule.Types)
243var type = ProcessExportedType(exported, assembly, nav);
255protected abstract void ProcessType(TypeDefinition type, XPathNavigator nav);
257protected void ProcessTypeChildren(TypeDefinition type, XPathNavigator nav, object? customData = null)
268void ProcessSelectedFields(XPathNavigator nav, TypeDefinition type)
278protected virtual void ProcessField(TypeDefinition type, XPathNavigator nav)
316protected static FieldDefinition? GetField(TypeDefinition type, string signature)
328protected virtual void ProcessField(TypeDefinition type, FieldDefinition field, XPathNavigator nav) { }
330void ProcessSelectedMethods(XPathNavigator nav, TypeDefinition type, object? customData)
340protected virtual void ProcessMethod(TypeDefinition type, XPathNavigator nav, object? customData)
378protected virtual MethodDefinition? GetMethod(TypeDefinition type, string signature) => null;
380protected virtual void ProcessMethod(TypeDefinition type, MethodDefinition method, XPathNavigator nav, object? customData) { }
382void ProcessSelectedEvents(XPathNavigator nav, TypeDefinition type, object? customData)
392protected virtual void ProcessEvent(TypeDefinition type, XPathNavigator nav, object? customData)
427protected static EventDefinition? GetEvent(TypeDefinition type, string signature)
439protected virtual void ProcessEvent(TypeDefinition type, EventDefinition @event, XPathNavigator nav, object? customData) { }
441void ProcessSelectedProperties(XPathNavigator nav, TypeDefinition type, object? customData)
451protected virtual void ProcessProperty(TypeDefinition type, XPathNavigator nav, object? customData)
486protected static PropertyDefinition? GetProperty(TypeDefinition type, string signature)
498protected virtual void ProcessProperty(TypeDefinition type, PropertyDefinition property, XPathNavigator nav, object? customData, bool fromSignature) { }
644_context.TryResolve(target) is TypeDefinition typeDefinition &&
Linker.Steps\UnsafeAccessorMarker.cs (6)
121bool TryResolveTargetType(TypeReference targetTypeReference, ICustomAttributeProvider unsafeAccessorTypeProvider, AssemblyDefinition assembly, [NotNullWhen(true)] out TypeDefinition? targetType)
124if (_context.TryResolve(targetTypeReference) is not TypeDefinition initialTargetType)
135TypeDefinition? newTargetType = _context.TryResolve(assembly, typeName);
156if (!TryResolveTargetType(method.ReturnType, method.MethodReturnType, method.Module.Assembly, out TypeDefinition? targetType))
178if (!TryResolveTargetType(targetTypeReference, method.Parameters[0], method.Module.Assembly, out TypeDefinition? targetType))
206if (!TryResolveTargetType(targetTypeReference, method.Parameters[0], method.Module.Assembly, out TypeDefinition? targetType))
Linker\Annotations.cs (32)
50protected readonly HashSet<TypeDefinition> fieldType_init = new HashSet<TypeDefinition>();
57protected readonly Dictionary<TypeDefinition, (TypePreserve preserve, bool applied)> preserved_types = new Dictionary<TypeDefinition, (TypePreserve, bool)>();
58protected readonly HashSet<TypeDefinition> pending_preserve = new HashSet<TypeDefinition>();
59protected readonly Dictionary<TypeDefinition, TypePreserveMembers> preserved_type_members = new();
69readonly HashSet<TypeDefinition> marked_types_with_cctor = new HashSet<TypeDefinition>();
70protected readonly HashSet<TypeDefinition> marked_instantiated = new HashSet<TypeDefinition>();
72protected readonly HashSet<TypeDefinition> types_relevant_to_variant_casting = new HashSet<TypeDefinition>();
76readonly List<(TypeDefinition Type, MessageOrigin Origin)> pending_reflection_visible_types = new();
228public void MarkInstantiated(TypeDefinition type)
233public bool IsInstantiated(TypeDefinition type)
238public void MarkRelevantToVariantCasting(TypeDefinition type)
244public bool IsRelevantToVariantCasting(TypeDefinition type)
264internal void MarkPendingReflectionVisibleType(TypeDefinition type, in MessageOrigin origin)
281internal (TypeDefinition Type, MessageOrigin Origin)[] DrainPendingReflectionVisibleTypes()
313public TypeDefinition[] GetPendingPreserve()
318public bool SetAppliedPreserve(TypeDefinition type, TypePreserve preserve)
337public void SetPreserve(TypeDefinition type, TypePreserve preserve)
384public bool TryGetPreserve(TypeDefinition type, out TypePreserve preserve)
396public void SetMembersPreserve(TypeDefinition type, TypePreserveMembers preserve)
417public bool TryGetPreservedMembers(TypeDefinition type, out TypePreserveMembers preserve)
506public List<MethodDefinition>? GetPreservedMethods(TypeDefinition type)
511public bool ClearPreservedMethods(TypeDefinition type)
516public void AddPreservedMethod(TypeDefinition type, MethodDefinition method)
599public bool HasPreservedStaticCtor(TypeDefinition type)
604public bool SetPreservedStaticCtor(TypeDefinition type)
779internal List<(TypeReference InterfaceType, List<InterfaceImplementation> ImplementationChain)>? GetRecursiveInterfaces(TypeDefinition type)
Linker\DocumentationSignatureParser.cs (17)
52public static TypeDefinition? GetTypeByDocumentationSignature(AssemblyDefinition assembly, string signature, ITryResolveMetadata resolver)
58return results.Count == 0 ? null : (TypeDefinition)results[0];
62public static IEnumerable<IMemberDefinition> GetMembersByDocumentationSignature(TypeDefinition type, string signature, ITryResolveMetadata resolver, bool acceptName = false)
140TypeDefinition? containingType = null;
170Debug.Assert(result is TypeDefinition);
172containingType = result as TypeDefinition;
195public static void GetMatchingMembers(string id, ref int index, ModuleDefinition module, TypeDefinition? containingType, string memberName, int arity, MemberType memberTypes, List<IMemberDefinition> results, ITryResolveMetadata resolver, bool acceptName = false)
355(typeParameterContext is TypeDefinition && typeParameterContext.GenericParameterType == GenericParameterType.Type)
378var typeContext = typeParameterContext is MethodDefinition methodContext
380: typeParameterContext as TypeDefinition;
524static void GetMatchingTypes(ModuleDefinition module, TypeDefinition? declaringType, string name, int arity, List<IMemberDefinition> results, ITryResolveMetadata resolver)
530var type = module.ResolveType(name, resolver);
541foreach (var nestedType in declaringType.NestedTypes)
559static void GetMatchingMethods(string id, ref int index, TypeDefinition? type, string memberName, int arity, List<IMemberDefinition> results, ITryResolveMetadata resolver, bool acceptName = false)
618static void GetMatchingProperties(string id, ref int index, TypeDefinition? type, string memberName, List<IMemberDefinition> results, ITryResolveMetadata resolver, bool acceptName = false)
661static void GetMatchingFields(TypeDefinition? type, string memberName, List<IMemberDefinition> results)
673static void GetMatchingEvents(TypeDefinition? type, string memberName, List<IMemberDefinition> results)
Linker\MethodBodyScanner.cs (16)
71public IEnumerable<(InterfaceImplementation, TypeDefinition)>? GetReferencedInterfaces(MethodIL methodIL)
81var interfaceImplementations = new HashSet<(InterfaceImplementation, TypeDefinition)>();
86foreach (var type in possibleStackTypes)
92TypeDefinition? currentType = type;
103HashSet<TypeDefinition> AllPossibleStackTypes(MethodIL methodIL)
105var types = new HashSet<TypeDefinition>();
156void AddMatchingInterfaces(HashSet<(InterfaceImplementation, TypeDefinition)> results, TypeDefinition type, TypeDefinition[] interfaceTypes)
161foreach (var interfaceType in interfaceTypes)
168bool HasInterface(TypeDefinition type, TypeDefinition interfaceType, [NotNullWhen(true)] out InterfaceImplementation? implementation)
186void AddFromGenericInstance(HashSet<TypeDefinition> set, IGenericInstance instance)
195void AddFromGenericParameterProvider(HashSet<TypeDefinition> set, IGenericParameterProvider provider)
207void AddIfResolved(HashSet<TypeDefinition> set, TypeReference item)
209var resolved = context.TryResolve(item);
Linker\TypeMapHandler.cs (12)
22readonly Dictionary<TypeDefinition, Dictionary<TypeReference, List<CustomAttributeWithOrigin>>> _unmarkedExternalTypeMapEntries = [];
25readonly Dictionary<TypeDefinition, Dictionary<TypeReference, List<CustomAttributeWithOrigin>>> _unmarkedProxyTypeMapEntries = [];
111&& _context.Resolve(UnwrapToResolvableType(targetType)) is TypeDefinition targetTypeDef)
115public void ProcessType(TypeDefinition definition)
122TypeDefinition targetType,
123Dictionary<TypeDefinition, Dictionary<TypeReference, List<CustomAttributeWithOrigin>>> unmarkedTypeMapAttributes,
150public void ProcessInstantiated(TypeDefinition definition)
185/// from <paramref name="type"/> until a <see cref="TypeDefinition"/> or <see cref="GenericInstanceType"/>
213void RecordTypeMapEntry(CustomAttributeWithOrigin attr, TypeReference group, TypeReference? dependencySource, Dictionary<TypeDefinition, Dictionary<TypeReference, List<CustomAttributeWithOrigin>>> pendingDependencySourceMarking, HashSet<TypeReference> seenTypeGroups, Dictionary<TypeReference, List<CustomAttributeWithOrigin>> pendingTypeMapGroupMarking)
231TypeDefinition? dependencyTypeDef = _context.Resolve(dependencySource);
262public static bool IsTypeMapAttributeType(TypeDefinition type)
323public bool DependencySourceRequiresTarget(LinkContext context, TypeDefinition sourceType)