1 write to Cache
Microsoft.Maui.Controls.Build.Tasks (1)
ILContext.cs (1)
22
Cache
= cache;
404 references to Cache
Microsoft.Maui.Controls.Build.Tasks (404)
CompiledConverters\BindablePropertyConverter.cs (2)
71
var typeRef = XmlTypeExtensions.GetTypeReference(context.
Cache
, typeName, module, node);
75
bpRef = GetBindablePropertyFieldReference(context.
Cache
, typeRef, propertyName, module);
CompiledConverters\BoundsTypeConverter.cs (1)
71
yield return Instruction.Create(OpCodes.Newobj, module.ImportCtorReference(context.
Cache
, ("Microsoft.Maui.Graphics", "Microsoft.Maui.Graphics", "Rect"), parameterTypes: new[] {
CompiledConverters\BrushTypeConverter.cs (2)
25
yield return Instruction.Create(OpCodes.Newobj, module.ImportCtorReference(context.
Cache
, ("Microsoft.Maui.Controls", "Microsoft.Maui.Controls", "SolidColorBrush"), parameterTypes: new[] {
31
var propertyGetterReference = module.ImportPropertyGetterReference(context.
Cache
,
CompiledConverters\ColorTypeConverter.cs (3)
32
yield return Instruction.Create(OpCodes.Newobj, module.ImportCtorReference(context.
Cache
, ("Microsoft.Maui.Graphics", "Microsoft.Maui.Graphics", "Color"), parameterTypes: new[] {
52
var fieldReference = module.ImportFieldReference(context.
Cache
, ("Microsoft.Maui.Graphics", "Microsoft.Maui.Graphics", "Colors"),
63
var propertyGetterReference = module.ImportPropertyGetterReference(context.
Cache
, ("Microsoft.Maui.Graphics", "Microsoft.Maui.Graphics", "Colors"),
CompiledConverters\ColumnDefinitionCollectionTypeConverter.cs (3)
23
yield return Create(Newarr, module.ImportReference(context.
Cache
, ("Microsoft.Maui.Controls", "Microsoft.Maui.Controls", "ColumnDefinition")));
30
yield return Create(Newobj, module.ImportCtorReference(context.
Cache
,
35
yield return Create(Newobj, module.ImportCtorReference(context.
Cache
,
CompiledConverters\ConstraintTypeConverter.cs (1)
23
yield return Create(Call, module.ImportMethodReference(context.
Cache
, ("Microsoft.Maui.Controls", "Microsoft.Maui.Controls.Compatibility", "Constraint"),
CompiledConverters\CornerRadiusTypeConverter.cs (1)
43
yield return Instruction.Create(OpCodes.Newobj, module.ImportCtorReference(context.
Cache
, ("Microsoft.Maui", "Microsoft.Maui", "CornerRadius"), parameterTypes: args.Select(a => ("mscorlib", "System", "Double")).ToArray()));
CompiledConverters\EasingTypeConverter.cs (1)
28
var fieldReference = module.ImportFieldReference(context.
Cache
, assemblyTypeInfo, value, isStatic: true, caseSensitive: false);
CompiledConverters\FlexBasisTypeConverter.cs (3)
22
module.ImportFieldReference(context.
Cache
, ("Microsoft.Maui", "Microsoft.Maui.Layouts", "FlexBasis"),
32
yield return Instruction.Create(OpCodes.Newobj, module.ImportCtorReference(context.
Cache
, ("Microsoft.Maui", "Microsoft.Maui.Layouts", "FlexBasis"), parameterTypes: new[] {
41
yield return Instruction.Create(OpCodes.Newobj, module.ImportCtorReference(context.
Cache
, ("Microsoft.Maui", "Microsoft.Maui.Layouts", "FlexBasis"), parameterTypes: new[] {
CompiledConverters\FontSizeTypeConverter.cs (4)
35
context.
Cache
,
41
yield return Instruction.Create(OpCodes.Ldtoken, module.ImportReference(context.
Cache
, ("Microsoft.Maui.Controls", "Microsoft.Maui.Controls", "Label")));
43
context.
Cache
,
50
context.
Cache
,
CompiledConverters\GridLengthTypeConverter.cs (7)
24
yield return Create(Ldsfld, module.ImportFieldReference(context.
Cache
, ("Microsoft.Maui", "Microsoft.Maui", "GridLength"), nameof(GridLength.Auto), isStatic: true));
29
yield return Create(Ldsfld, module.ImportFieldReference(context.
Cache
, ("Microsoft.Maui", "Microsoft.Maui", "GridLength"), nameof(GridLength.Star), isStatic: true));
36
yield return Create(Newobj, module.ImportCtorReference(context.
Cache
,
37
type: module.GetTypeDefinition(context.
Cache
, ("Microsoft.Maui", "Microsoft.Maui", "GridLength")),
38
parameterTypes: new[] { module.TypeSystem.Double, module.GetTypeDefinition(context.
Cache
, ("Microsoft.Maui", "Microsoft.Maui", "GridUnitType")) }));
44
yield return Create(Newobj, module.ImportCtorReference(context.
Cache
,
45
type: module.GetTypeDefinition(context.
Cache
, ("Microsoft.Maui", "Microsoft.Maui", "GridLength")),
CompiledConverters\ImageSourceTypeConverter.cs (3)
22
yield return Instruction.Create(OpCodes.Newobj, module.ImportCtorReference(context.
Cache
, ("System", "System", "Uri"), parameterTypes: new[] {
25
yield return Instruction.Create(OpCodes.Call, module.ImportMethodReference(context.
Cache
, ("Microsoft.Maui.Controls", "Microsoft.Maui.Controls", "ImageSource"), "FromUri", parameterTypes: new[] {
31
yield return Instruction.Create(OpCodes.Call, module.ImportMethodReference(context.
Cache
, ("Microsoft.Maui.Controls", "Microsoft.Maui.Controls", "ImageSource"), "FromFile", parameterTypes: new[] {
CompiledConverters\LayoutOptionsConverter.cs (1)
29
var fieldReference = module.ImportFieldReference(context.
Cache
, ("Microsoft.Maui.Controls", "Microsoft.Maui.Controls", "LayoutOptions"),
CompiledConverters\ListStringTypeConverter.cs (2)
26
yield return Create(Newobj, module.ImportCtorReference(context.
Cache
, ("System.Collections", "System.Collections.Generic", "List`1"),
33
yield return Create(Callvirt, module.ImportMethodReference(context.
Cache
, ("mscorlib", "System.Collections.Generic", "ICollection`1"),
CompiledConverters\PointTypeConverter.cs (1)
30
yield return Instruction.Create(OpCodes.Newobj, module.ImportCtorReference(context.
Cache
, ("Microsoft.Maui.Graphics", "Microsoft.Maui.Graphics", "Point"), parameterTypes: new[] {
CompiledConverters\RDSourceTypeConverter.cs (14)
26
var rootTargetPath = XamlCTask.GetPathForType(context.
Cache
, currentModule, ((ILRootNode)rootNode).TypeReference);
50
var uriVarDef = new VariableDefinition(currentModule.ImportReference(context.
Cache
, ("System", "System", "Uri")));
54
var resourceTypeRef = GetTypeForPath(context.
Cache
, module, resourcePath);
65
var resourceId = XamlCTask.GetResourceIdForPath(context.
Cache
, module, resourcePath);
106
context.
Cache
,
115
foreach (var instruction in context.Variables[rdNode].LoadAs(context.
Cache
, currentModule.GetTypeDefinition(context.
Cache
, ("Microsoft.Maui.Controls", "Microsoft.Maui.Controls", "ResourceDictionary")), currentModule))
132
foreach (var instruction in context.Variables[rdNode].LoadAs(context.
Cache
, currentModule.GetTypeDefinition(context.
Cache
, ("Microsoft.Maui.Controls", "Microsoft.Maui.Controls", "ResourceDictionary")), currentModule))
140
yield return Create(Call, currentModule.ImportMethodReference(context.
Cache
, ("mscorlib", "System.Reflection", "Assembly"), methodName: "Load", parameterTypes: new[] { ("mscorlib", "System", "String") }, isStatic: true));
145
yield return Create(Call, currentModule.ImportMethodReference(context.
Cache
, ("mscorlib", "System", "Type"), methodName: "GetTypeFromHandle", parameterTypes: new[] { ("mscorlib", "System", "RuntimeTypeHandle") }, isStatic: true));
146
yield return Create(Callvirt, currentModule.ImportPropertyGetterReference(context.
Cache
, ("mscorlib", "System", "Type"), propertyName: "Assembly", flatten: true));
153
context.
Cache
,
169
if (!TypeRefComparer.Default.Equals(ca.AttributeType, module.ImportReference(context.
Cache
, ("Microsoft.Maui.Controls", "Microsoft.Maui.Controls.Xaml", "XamlResourceIdAttribute"))))
CompiledConverters\RectangleTypeConverter.cs (1)
44
yield return Instruction.Create(OpCodes.Newobj, module.ImportCtorReference(context.
Cache
, ("Microsoft.Maui.Graphics", "Microsoft.Maui.Graphics", "Rect"), parameterTypes: new[] {
CompiledConverters\RowDefinitionCollectionTypeConverter.cs (3)
23
yield return Create(Newarr, module.ImportReference(context.
Cache
, ("Microsoft.Maui.Controls", "Microsoft.Maui.Controls", "RowDefinition")));
31
context.
Cache
,
37
context.
Cache
,
CompiledConverters\StrokeShapeTypeConverter.cs (23)
26
yield return Instruction.Create(OpCodes.Newobj, module.ImportCtorReference(context.
Cache
, ("Microsoft.Maui.Controls", "Microsoft.Maui.Controls.Shapes", "Ellipse"), parameterTypes: null));
36
yield return Instruction.Create(OpCodes.Newobj, module.ImportCtorReference(context.
Cache
, ("Microsoft.Maui.Controls", "Microsoft.Maui.Controls.Shapes", "Line"), parameterTypes: null));
45
yield return Instruction.Create(OpCodes.Newobj, module.ImportCtorReference(context.
Cache
, ("Microsoft.Maui.Controls", "Microsoft.Maui.Controls.Shapes", "Line"), parameterTypes: null));
56
yield return Instruction.Create(OpCodes.Newobj, module.ImportCtorReference(context.
Cache
, ("Microsoft.Maui.Controls", "Microsoft.Maui.Controls.Shapes", "Line"), parameterTypes: new[] {
71
yield return Instruction.Create(OpCodes.Newobj, module.ImportCtorReference(context.
Cache
, ("Microsoft.Maui.Controls", "Microsoft.Maui.Controls.Shapes", "Line"), parameterTypes: new[] {
88
yield return Instruction.Create(OpCodes.Newobj, module.ImportCtorReference(context.
Cache
, ("Microsoft.Maui.Controls", "Microsoft.Maui.Controls.Shapes", "Path"), parameterTypes: null));
92
yield return Instruction.Create(OpCodes.Newobj, module.ImportCtorReference(context.
Cache
, ("Microsoft.Maui.Controls", "Microsoft.Maui.Controls.Shapes", "Path"), parameterTypes: null));
94
yield return Instruction.Create(OpCodes.Newobj, module.ImportCtorReference(context.
Cache
, ("Microsoft.Maui.Controls", "Microsoft.Maui.Controls.Shapes", "PathGeometryConverter"), parameterTypes: null));
96
yield return Instruction.Create(OpCodes.Call, module.ImportMethodReference(context.
Cache
, ("System", "System.ComponentModel", "TypeConverter"), "ConvertFromInvariantString", parameterTypes: new[] {
98
yield return Instruction.Create(OpCodes.Call, module.ImportPropertySetterReference(context.
Cache
, ("Microsoft.Maui.Controls", "Microsoft.Maui.Controls.Shapes", "Path"), "Data"));
107
yield return Instruction.Create(OpCodes.Newobj, module.ImportCtorReference(context.
Cache
, ("Microsoft.Maui.Controls", "Microsoft.Maui.Controls.Shapes", "Polygon"), parameterTypes: null));
116
yield return Instruction.Create(OpCodes.Newobj, module.ImportCtorReference(context.
Cache
, ("Microsoft.Maui.Controls", "Microsoft.Maui.Controls.Shapes", "Polygon"), parameterTypes: null));
125
yield return Instruction.Create(OpCodes.Newobj, module.ImportCtorReference(context.
Cache
, ("Microsoft.Maui.Controls", "Microsoft.Maui.Controls.Shapes", "Polygon"), parameterTypes: new[] {
135
yield return Instruction.Create(OpCodes.Newobj, module.ImportCtorReference(context.
Cache
, ("Microsoft.Maui.Controls", "Microsoft.Maui.Controls.Shapes", "Polyline"), parameterTypes: null));
144
yield return Instruction.Create(OpCodes.Newobj, module.ImportCtorReference(context.
Cache
, ("Microsoft.Maui.Controls", "Microsoft.Maui.Controls.Shapes", "Polyline"), parameterTypes: null));
153
yield return Instruction.Create(OpCodes.Newobj, module.ImportCtorReference(context.
Cache
, ("Microsoft.Maui.Controls", "Microsoft.Maui.Controls.Shapes", "Polyline"), parameterTypes: new[] {
160
yield return Instruction.Create(OpCodes.Newobj, module.ImportCtorReference(context.
Cache
, ("Microsoft.Maui.Controls", "Microsoft.Maui.Controls.Shapes", "Rectangle"), parameterTypes: null));
169
yield return Instruction.Create(OpCodes.Newobj, module.ImportCtorReference(context.
Cache
, ("Microsoft.Maui.Controls", "Microsoft.Maui.Controls.Shapes", "RoundRectangle"), parameterTypes: null));
173
yield return Instruction.Create(OpCodes.Newobj, module.ImportCtorReference(context.
Cache
, ("Microsoft.Maui.Controls", "Microsoft.Maui.Controls.Shapes", "RoundRectangle"), parameterTypes: null));
184
yield return Instruction.Create(OpCodes.Newobj, module.ImportCtorReference(context.
Cache
, ("Microsoft.Maui", "Microsoft.Maui", "CornerRadius"), parameterTypes: new[] {
190
yield return Instruction.Create(OpCodes.Call, module.ImportPropertySetterReference(context.
Cache
, ("Microsoft.Maui.Controls", "Microsoft.Maui.Controls.Shapes", "RoundRectangle"), "CornerRadius"));
199
var pointType = module.ImportReference(context.
Cache
, ("Microsoft.Maui.Graphics", "Microsoft.Maui.Graphics", "Point"));
218
yield return Instruction.Create(OpCodes.Newobj, module.ImportCtorReference(context.
Cache
, type: ("Microsoft.Maui.Controls", "Microsoft.Maui.Controls", "PointCollection"), paramCount: 1));
CompiledConverters\ThicknessTypeConverter.cs (1)
48
yield return Instruction.Create(OpCodes.Newobj, module.ImportCtorReference(context.
Cache
, ("Microsoft.Maui", "Microsoft.Maui", "Thickness"), parameterTypes: args.Select(a => ("mscorlib", "System", "Double")).ToArray()));
CompiledConverters\TypeTypeConverter.cs (2)
31
var typeRef = xmlType.GetTypeReference(context.
Cache
, module, (IXmlLineInfo)node);
36
yield return Create(Call, module.ImportMethodReference(context.
Cache
, ("mscorlib", "System", "Type"),
CompiledConverters\UriTypeConverter.cs (1)
24
yield return Create(Newobj, module.ImportCtorReference(context.
Cache
, ("System", "System", "Uri"), parameterTypes: new[] {
CompiledMarkupExtensions\ArrayExtension.cs (2)
45
foreach (var instruction in vardef.LoadAs(context.
Cache
, typeTypeRef, module))
53
foreach (var instruction in vardef.LoadAs(context.
Cache
, typeTypeRef, module))
CompiledMarkupExtensions\DataTemplateExtension.cs (5)
16
typeRef = module.ImportReference(context.
Cache
, ("Microsoft.Maui.Controls", "Microsoft.Maui.Controls", "DataTemplate"));
25
var contentTypeRef = module.ImportReference(XmlTypeExtensions.GetTypeReference(context.
Cache
, valueNode.Value as string, module, node as BaseNode))
28
var dataTemplateCtor = module.ImportCtorReference(context.
Cache
, typeRef, new[] { module.ImportReference(context.
Cache
, ("mscorlib", "System", "Type")) });
31
Create(Call, module.ImportMethodReference(context.
Cache
, ("mscorlib", "System", "Type"), methodName: "GetTypeFromHandle", parameterTypes: new[] { ("mscorlib", "System", "RuntimeTypeHandle") }, isStatic: true)),
CompiledMarkupExtensions\StaticExtension.cs (4)
27
var typeRef = module.ImportReference(XmlTypeExtensions.GetTypeReference(context.
Cache
, typename, module, node as BaseNode));
28
var fieldRef = GetFieldReference(context.
Cache
, typeRef, membername, module);
29
var propertyDef = GetPropertyDefinition(context.
Cache
, typeRef, membername, module);
64
if (memberRef.ResolveCached(context.
Cache
).IsEnum)
CompiledMarkupExtensions\StaticResourceExtension.cs (11)
116
var parentType = module.ImportReference((node.Parent as IElementNode).XmlType.GetTypeReference(context.
Cache
, module, (IXmlLineInfo)node));
122
var targetTypeRef = module.ImportReference(bpRef.GetBindablePropertyType(context.
Cache
, node as IXmlLineInfo, module));
131
var propertyRef = parentType.GetProperty(context.
Cache
, pd => pd.Name == localName, out var declaringTypeReference);
139
[propertyRef, propertyType.ResolveCached(context.
Cache
)],
153
var staticResourceExtensionType = module.ImportReference(context.
Cache
,
155
yield return Create(Newobj, module.ImportCtorReference(context.
Cache
,
163
var keyProperty = staticResourceExtensionType.GetProperty(context.
Cache
, pd => pd.Name == "Key", out _);
173
var parentType = module.ImportReference(parentNode.XmlType.GetTypeReference(context.
Cache
, module, (IXmlLineInfo)node));
180
propertyRef = parentType.GetProperty(context.
Cache
, pd => pd.Name == localName, out declaringTypeReference);
184
var requiredServices = staticResourceExtensionType.GetRequiredServices(context.
Cache
, module);
188
yield return Create(Callvirt, module.ImportMethodReference(context.
Cache
,
CompiledMarkupExtensions\TypeExtension.cs (3)
16
memberRef = module.ImportReference(context.
Cache
, ("mscorlib", "System", "Type"));
31
var typeref = module.ImportReference(XmlTypeExtensions.GetTypeReference(context.
Cache
, valueNode.Value as string, module, node as BaseNode));
37
Create(Call, module.ImportMethodReference(context.
Cache
, ("mscorlib", "System", "Type"),
CompiledValueProviders\SetterValueProvider.cs (5)
38
foreach (var instruction in vardefref.VariableDefinition.LoadAs(context.
Cache
, module.GetTypeDefinition(context.
Cache
, setterType), module))
46
yield return Instruction.Create(OpCodes.Callvirt, module.ImportPropertySetterReference(context.
Cache
, setterType, propertyName: "Value"));
57
var generic = bindablePropertyReference.GetBindablePropertyType(context.
Cache
, node, module) as GenericInstanceType;
69
return context.Variables[firstItem].VariableType.InheritsFromOrImplements(context.
Cache
, genericType);
CompiledValueProviders\StyleSheetProvider.cs (6)
43
yield return Create(Call, module.ImportMethodReference(context.
Cache
, ("Microsoft.Maui.Controls", "Microsoft.Maui.Controls.StyleSheets", "StyleSheet"),
60
if (XamlCTask.GetResourceIdForPath(context.
Cache
, module, resourcePath) == null)
66
yield return Create(Call, module.ImportMethodReference(context.
Cache
, ("mscorlib", "System", "Type"), methodName: "GetTypeFromHandle", parameterTypes: new[] { ("mscorlib", "System", "RuntimeTypeHandle") }, isStatic: true));
67
yield return Create(Callvirt, module.ImportPropertyGetterReference(context.
Cache
, ("mscorlib", "System", "Type"), propertyName: "Assembly", flatten: true)); //assembly
72
yield return Create(Call, module.ImportMethodReference(context.
Cache
, ("Microsoft.Maui.Controls", "Microsoft.Maui.Controls.StyleSheets", "StyleSheet"),
79
var vardef = new VariableDefinition(module.ImportReference(context.
Cache
, ("Microsoft.Maui.Controls", "Microsoft.Maui.Controls.StyleSheets", "StyleSheet")));
CreateObjectVisitor.cs (21)
51
var typeref = Module.ImportReference(node.XmlType.GetTypeReference(Context.
Cache
, Module, node));
52
TypeDefinition typedef = typeref.ResolveCached(Context.
Cache
);
99
.GetCustomAttribute(Context.
Cache
, Module, ("Microsoft.Maui.Controls", "Microsoft.Maui.Controls.Xaml", "ProvideCompiledAttribute"))
134
factoryCtorInfo = typedef.AllMethods(Context.
Cache
).FirstOrDefault(md => md.methodDef.IsConstructor &&
145
factoryMethodInfo = typedef.AllMethods(Context.
Cache
).FirstOrDefault(md => !md.methodDef.IsConstructor &&
310
foreach (var instruction in vardef.LoadAs(Context.
Cache
, parameter.ParameterType.ResolveGenericParameters(ctorinfo), Module))
316
[parameter, parameter.ParameterType.ResolveCached(Context.
Cache
)],
348
foreach (var instruction in vardef.LoadAs(Context.
Cache
, parameter.ParameterType.ResolveGenericParameters(factoryCtorInfo), Module))
354
[parameter, parameter.ParameterType.ResolveCached(Context.
Cache
)],
459
module.TypeSystem.Object.ResolveCached(Context.
Cache
)
474
var vardef = new VariableDefinition(module.ImportReference(Context.
Cache
, ("mscorlib", "System", "Decimal")));
485
yield return Create(Call, module.ImportPropertyGetterReference(Context.
Cache
, ("mscorlib", "System.Globalization", "CultureInfo"),
489
yield return Create(Call, module.ImportMethodReference(Context.
Cache
, ("mscorlib", "System", "Decimal"),
504
yield return Create(Newobj, module.ImportCtorReference(Context.
Cache
, ("mscorlib", "System", "Decimal"), parameterTypes: new[] { ("mscorlib", "System", "Int32") }));
522
var vardef = new VariableDefinition(module.ImportReference(Context.
Cache
, ("mscorlib", "System", "TimeSpan")));
526
yield return Create(Call, module.ImportPropertyGetterReference(Context.
Cache
, ("mscorlib", "System.Globalization", "CultureInfo"),
529
yield return Create(Call, module.ImportMethodReference(Context.
Cache
, ("mscorlib", "System", "TimeSpan"),
543
yield return Create(Newobj, module.ImportCtorReference(Context.
Cache
, ("mscorlib", "System", "TimeSpan"), parameterTypes: new[] { ("mscorlib", "System", "Int64") }));
549
var vardef = new VariableDefinition(module.ImportReference(Context.
Cache
, ("System", "System", "Uri")));
555
yield return Create(Call, module.ImportMethodReference(Context.
Cache
, ("System", "System", "Uri"),
570
var defaultCtor = module.ImportCtorReference(Context.
Cache
, typedef, parameterTypes: null);
ExpandMarkupsVisitor.cs (1)
193
if (!type.TryGetTypeReference(contextProvider.Context.
Cache
, contextProvider.Context.Module, null, out _))
MethodDefinitionExtensions.cs (1)
37
if (!argType.InheritsFromOrImplements(context.
Cache
, paramType))
NodeILExtensions.cs (66)
40
var targetTypeRef = bpRef.GetBindablePropertyType(context.
Cache
, node, module);
41
var typeConverter = bpRef.GetBindablePropertyTypeConverter(context.
Cache
, module);
55
if (targetTypeRef.ResolveCached(context.
Cache
).FullName == "System.Nullable`1")
57
if (targetTypeRef.ResolveCached(context.
Cache
).BaseType != null && targetTypeRef.ResolveCached(context.
Cache
).BaseType.FullName == "System.Enum")
93
var implicitOperator = module.TypeSystem.String.GetImplicitOperatorTo(context.
Cache
, targetTypeRef, module);
125
var targetTypeRef = bpRef.GetBindablePropertyType(context.
Cache
, node, module);
126
var typeConverter = bpRef.GetBindablePropertyTypeConverter(context.
Cache
, module);
129
if (targetTypeRef.ResolveCached(context.
Cache
).FullName == "System.Nullable`1")
153
var knownCompiledTypeConverters = context.
Cache
.GetKnownCompiledTypeConverters(module);
158
if (typeConverter?.GetCustomAttribute(context.
Cache
, module, ("Microsoft.Maui.Controls", "Microsoft.Maui.Controls.Xaml", "ProvideCompiledAttribute"))?.ConstructorArguments?.First().Value is string compiledConverterName
188
var isExtendedConverter = typeConverter.ImplementsInterface(context.
Cache
, module.ImportReference(context.
Cache
, ("Microsoft.Maui.Controls", "Microsoft.Maui.Controls", "IExtendedTypeConverter")));
189
var typeConverterCtorRef = module.ImportCtorReference(context.
Cache
, typeConverter, paramCount: 0);
191
? module.ImportReference(context.
Cache
, ("Microsoft.Maui.Controls", "Microsoft.Maui.Controls", "IExtendedTypeConverter"))
192
.ResolveCached(context.
Cache
)
194
: typeConverter.ResolveCached(context.
Cache
)
195
.AllMethods(context.
Cache
)
204
var requiredServiceType = typeConverter.GetRequiredServices(context.
Cache
, module);
220
if (targetTypeRef.ResolveCached(context.
Cache
).FullName == "System.Nullable`1")
225
nullableCtor = originalTypeRef.GetMethods(context.
Cache
, md => md.IsConstructor && md.Parameters.Count == 1, module).Single().Item1;
229
var implicitOperator = module.TypeSystem.String.GetImplicitOperatorTo(context.
Cache
, targetTypeRef, module);
232
if (targetTypeRef.ResolveCached(context.
Cache
).BaseType != null && targetTypeRef.ResolveCached(context.
Cache
).BaseType.FullName == "System.Enum")
233
yield return PushParsedEnum(context.
Cache
, targetTypeRef, str, node);
268
yield return Instruction.Create(OpCodes.Newobj, module.ImportCtorReference(context.
Cache
, ("mscorlib", "System", "TimeSpan"), parameterTypes: new[] { ("mscorlib", "System", "Int64") }));
275
yield return Instruction.Create(OpCodes.Newobj, module.ImportCtorReference(context.
Cache
, ("mscorlib", "System", "DateTime"), parameterTypes: new[] { ("mscorlib", "System", "Int64") }));
288
var vardef = new VariableDefinition(module.ImportReference(context.
Cache
, ("mscorlib", "System", "Decimal")));
299
yield return Create(Call, module.ImportPropertyGetterReference(context.
Cache
, ("mscorlib", "System.Globalization", "CultureInfo"),
302
yield return Create(Call, module.ImportMethodReference(context.
Cache
, ("mscorlib", "System", "Decimal"),
317
yield return Create(Newobj, module.ImportCtorReference(context.
Cache
, ("mscorlib", "System", "Decimal"), parameterTypes: new[] { ("mscorlib", "System", "Int32") }));
453
ctor = module.ImportCtorReference(context.
Cache
, ("Microsoft.Maui.Controls", "Microsoft.Maui.Controls.Xaml", "XmlLineInfo"), parameterTypes: new[] {
459
ctor = module.ImportCtorReference(context.
Cache
, ("Microsoft.Maui.Controls", "Microsoft.Maui.Controls.Xaml", "XmlLineInfo"), parameterTypes: null);
513
var finalArray = new VariableDefinition(module.ImportArrayReference(context.
Cache
, ("mscorlib", "System", "Object")));
526
yield return Create(Call, module.ImportMethodReference(context.
Cache
, ("mscorlib", "System", "Array"),
547
foreach (var instruction in context.Variables[en].LoadAs(context.
Cache
, module.TypeSystem.Object, module))
564
yield return Create(Call, module.ImportMethodReference(context.
Cache
, ("mscorlib", "System", "Type"), methodName: "GetTypeFromHandle", parameterTypes: new[] { ("mscorlib", "System", "RuntimeTypeHandle") }, isStatic: true));
566
yield return Create(Call, module.ImportMethodReference(context.
Cache
, ("System.Reflection.Extensions", "System.Reflection", "RuntimeReflectionExtensions"),
592
yield return Instruction.Create(OpCodes.Newarr, module.ImportReference(context.
Cache
, ("Microsoft.Maui.Controls", "Microsoft.Maui.Controls.Internals", "NameScope")));
616
var addService = module.ImportMethodReference(context.
Cache
, ("Microsoft.Maui.Controls.Xaml", "Microsoft.Maui.Controls.Xaml.Internals", "XamlServiceProvider"),
623
yield return Create(Newobj, module.ImportCtorReference(context.
Cache
, ("Microsoft.Maui.Controls.Xaml", "Microsoft.Maui.Controls.Xaml.Internals", "XamlServiceProvider"), parameterTypes: null));
627
|| requiredServices.Contains(module.ImportReference(context.
Cache
, ("Microsoft.Maui.Controls", "Microsoft.Maui.Controls.Xaml", "IProvideParentValues")), TypeRefComparer.Default)
628
|| requiredServices.Contains(module.ImportReference(context.
Cache
, ("Microsoft.Maui.Controls", "Microsoft.Maui.Controls.Xaml", "IReferenceProvider")), TypeRefComparer.Default))
635
yield return Create(Ldtoken, module.ImportReference(context.
Cache
, ("Microsoft.Maui.Controls", "Microsoft.Maui.Controls.Xaml", "IProvideValueTarget")));
636
yield return Create(Call, module.ImportMethodReference(context.
Cache
, ("mscorlib", "System", "Type"), methodName: "GetTypeFromHandle", parameterTypes: new[] { ("mscorlib", "System", "RuntimeTypeHandle") }, isStatic: true));
648
yield return Create(Newobj, module.ImportCtorReference(context.
Cache
,
653
var refProvider = new VariableDefinition(module.ImportReference(context.
Cache
, ("mscorlib", "System", "Object")));
659
yield return Create(Ldtoken, module.ImportReference(context.
Cache
, ("Microsoft.Maui.Controls", "Microsoft.Maui.Controls.Xaml", "IReferenceProvider")));
660
yield return Create(Call, module.ImportMethodReference(context.
Cache
, ("mscorlib", "System", "Type"), methodName: "GetTypeFromHandle", parameterTypes: new[] { ("mscorlib", "System", "RuntimeTypeHandle") }, isStatic: true));
667
if (!alreadyContainsProvideValueTarget && requiredServices.Contains(module.ImportReference(context.
Cache
, ("Microsoft.Maui.Controls", "Microsoft.Maui.Controls.Xaml", "IProvideValueTarget")), TypeRefComparer.Default))
670
yield return Create(Ldtoken, module.ImportReference(context.
Cache
, ("Microsoft.Maui.Controls", "Microsoft.Maui.Controls.Xaml", "IProvideValueTarget")));
671
yield return Create(Call, module.ImportMethodReference(context.
Cache
, ("mscorlib", "System", "Type"), methodName: "GetTypeFromHandle", parameterTypes: new[] { ("mscorlib", "System", "RuntimeTypeHandle") }, isStatic: true));
676
foreach (var instruction in variableDefinition.LoadAs(context.
Cache
, module.TypeSystem.Object, module))
689
yield return Create(Newobj, module.ImportCtorReference(context.
Cache
, ("Microsoft.Maui.Controls.Xaml", "Microsoft.Maui.Controls.Xaml.Internals", "ValueTargetProvider"), paramCount: 2));
694
if (node.NamespaceResolver != null && createAllServices || requiredServices.Contains(module.ImportReference(context.
Cache
, ("Microsoft.Maui.Controls", "Microsoft.Maui.Controls.Xaml", "IXamlTypeResolver")), TypeRefComparer.Default))
697
yield return Create(Ldtoken, module.ImportReference(context.
Cache
, ("Microsoft.Maui.Controls", "Microsoft.Maui.Controls.Xaml", "IXamlTypeResolver")));
698
yield return Create(Call, module.ImportMethodReference(context.
Cache
, ("mscorlib", "System", "Type"), methodName: "GetTypeFromHandle", parameterTypes: new[] { ("mscorlib", "System", "RuntimeTypeHandle") }, isStatic: true));
699
yield return Create(Newobj, module.ImportCtorReference(context.
Cache
, ("Microsoft.Maui.Controls.Xaml", "Microsoft.Maui.Controls.Xaml.Internals", "XmlNamespaceResolver"), parameterTypes: null));
705
yield return Create(Callvirt, module.ImportMethodReference(context.
Cache
, ("Microsoft.Maui.Controls.Xaml", "Microsoft.Maui.Controls.Xaml.Internals", "XmlNamespaceResolver"),
713
yield return Create(Call, module.ImportMethodReference(context.
Cache
, ("mscorlib", "System", "Type"), methodName: "GetTypeFromHandle", parameterTypes: new[] { ("mscorlib", "System", "RuntimeTypeHandle") }, isStatic: true));
714
yield return Create(Callvirt, module.ImportPropertyGetterReference(context.
Cache
, ("mscorlib", "System", "Type"), propertyName: "Assembly", flatten: true));
715
yield return Create(Newobj, module.ImportCtorReference(context.
Cache
, ("Microsoft.Maui.Controls.Xaml", "Microsoft.Maui.Controls.Xaml.Internals", "XamlTypeResolver"), paramCount: 2));
719
if (node is IXmlLineInfo && createAllServices || requiredServices.Contains(module.ImportReference(context.
Cache
, ("Microsoft.Maui.Controls", "Microsoft.Maui.Controls.Xaml", "IXmlLineInfoProvider")), TypeRefComparer.Default))
722
yield return Create(Ldtoken, module.ImportReference(context.
Cache
, ("Microsoft.Maui.Controls", "Microsoft.Maui.Controls.Xaml", "IXmlLineInfoProvider")));
723
yield return Create(Call, module.ImportMethodReference(context.
Cache
, ("mscorlib", "System", "Type"), methodName: "GetTypeFromHandle", parameterTypes: new[] { ("mscorlib", "System", "RuntimeTypeHandle") }, isStatic: true));
726
yield return Create(Newobj, module.ImportCtorReference(context.
Cache
, ("Microsoft.Maui.Controls.Xaml", "Microsoft.Maui.Controls.Xaml.Internals", "XmlLineInfoProvider"), parameterTypes: new[] { ("System.Xml.ReaderWriter", "System.Xml", "IXmlLineInfo") }));
SetFieldVisitor.cs (1)
37
Context.IL.Append(Context.Variables[(IElementNode)parentNode].LoadAs(Context.
Cache
, field.FieldType, Context.Module));
SetNamescopesAndRegisterNamesVisitor.cs (36)
60
if (setNameScope && Context.Variables[node].VariableType.InheritsFromOrImplements(Context.
Cache
, Context.Body.Method.Module.ImportReference(Context.
Cache
, ("Microsoft.Maui.Controls", "Microsoft.Maui.Controls", "BindableObject"))))
63
else if (Context.Variables[node].VariableType.InheritsFromOrImplements(Context.
Cache
, Context.Body.Method.Module.ImportReference(Context.
Cache
, ("Microsoft.Maui.Controls", "Microsoft.Maui.Controls", "Element"))))
70
Context.IL.Append(Context.Variables[node].LoadAs(Context.
Cache
, module.GetTypeDefinition(Context.
Cache
, parameterTypes[0]), module));
71
Context.IL.Append(namescopeVarDef.LoadAs(Context.
Cache
, module.GetTypeDefinition(Context.
Cache
, parameterTypes[1]), module));
72
Context.IL.Emit(OpCodes.Stfld, module.ImportFieldReference(Context.
Cache
, parameterTypes[0], nameof(Element.transientNamescope)));
81
if (Context.Variables[node].VariableType.InheritsFromOrImplements(Context.
Cache
, Context.Body.Method.Module.ImportReference(Context.
Cache
, ("Microsoft.Maui.Controls", "Microsoft.Maui.Controls", "BindableObject"))))
104
var vardef = new VariableDefinition(module.ImportReference(Context.
Cache
, ("Microsoft.Maui.Controls", "Microsoft.Maui.Controls.Internals", "NameScope")));
108
if (Context.Variables[node].VariableType.InheritsFromOrImplements(Context.
Cache
, Context.Body.Method.Module.ImportReference(Context.
Cache
, ("Microsoft.Maui.Controls", "Microsoft.Maui.Controls", "BindableObject"))))
111
Context.IL.Append(Context.Variables[node].LoadAs(Context.
Cache
, module.GetTypeDefinition(Context.
Cache
, namescoperef), module));
112
Context.IL.Emit(OpCodes.Call, module.ImportMethodReference(Context.
Cache
, ("Microsoft.Maui.Controls", "Microsoft.Maui.Controls.Internals", "NameScope"),
121
Context.IL.Emit(OpCodes.Newobj, module.ImportCtorReference(Context.
Cache
, ("Microsoft.Maui.Controls", "Microsoft.Maui.Controls.Internals", "NameScope"), parameterTypes: null));
130
var vardef = new VariableDefinition(module.ImportReference(Context.
Cache
, ("Microsoft.Maui.Controls", "Microsoft.Maui.Controls.Internals", "NameScope")));
132
Context.IL.Emit(OpCodes.Newobj, module.ImportCtorReference(Context.
Cache
, ("Microsoft.Maui.Controls", "Microsoft.Maui.Controls.Internals", "NameScope"), parameterTypes: null));
144
Context.IL.Append(Context.Variables[node].LoadAs(Context.
Cache
, module.GetTypeDefinition(Context.
Cache
, parameterTypes[0]), module));
145
Context.IL.Append(ns.LoadAs(Context.
Cache
, module.GetTypeDefinition(Context.
Cache
, parameterTypes[1]), module));
146
Context.IL.Emit(OpCodes.Call, module.ImportMethodReference(Context.
Cache
, ("Microsoft.Maui.Controls", "Microsoft.Maui.Controls.Internals", "NameScope"),
160
Context.IL.Append(namescopeVarDef.LoadAs(Context.
Cache
, module.GetTypeDefinition(Context.
Cache
, namescopeType), module));
162
Context.IL.Append(element.LoadAs(Context.
Cache
, module.TypeSystem.Object, module));
163
Context.IL.Emit(OpCodes.Callvirt, module.ImportMethodReference(Context.
Cache
,
174
if (!element.VariableType.InheritsFromOrImplements(Context.
Cache
, Context.Body.Method.Module.ImportReference(Context.
Cache
, ("Microsoft.Maui.Controls", "Microsoft.Maui.Controls", "Element"))))
179
var elementTypeRef = module.GetTypeDefinition(Context.
Cache
, elementType);
182
Context.IL.Append(element.LoadAs(Context.
Cache
, elementTypeRef, module));
183
Context.IL.Emit(OpCodes.Callvirt, module.ImportPropertyGetterReference(Context.
Cache
, elementType, propertyName: "StyleId"));
185
Context.IL.Append(element.LoadAs(Context.
Cache
, elementTypeRef, module));
187
Context.IL.Emit(OpCodes.Callvirt, module.ImportPropertySetterReference(Context.
Cache
, elementType, propertyName: "StyleId"));
SetPropertiesVisitor.cs (161)
62
if ((contentProperty = GetContentProperty(Context.
Cache
, parentVar.VariableType)) != null)
115
propertyRef = Context.Variables[(IElementNode)parentNode].VariableType.GetProperty(Context.
Cache
, pd => pd.Name == localName, out declaringTypeReference);
141
Context.IL.Append(parentVar.LoadAs(Context.
Cache
, Module.GetTypeDefinition(Context.
Cache
, ("Microsoft.Maui.Controls", "Microsoft.Maui.Controls", "ResourceDictionary")), Module));
144
else if ((contentProperty = GetContentProperty(Context.
Cache
, parentVar.VariableType)) != null)
154
else if (parentVar.VariableType.ImplementsInterface(Context.
Cache
, Module.ImportReference(Context.
Cache
, ("mscorlib", "System.Collections", "IEnumerable")))
155
&& parentVar.VariableType.GetMethods(Context.
Cache
, md => md.Name == "Add" && md.Parameters.Count == 1, Module).Any())
158
var adderTuple = elementType.GetMethods(Context.
Cache
, md => md.Name == "Add" && md.Parameters.Count == 1, Module).First();
163
Context.IL.Append(vardef.LoadAs(Context.
Cache
, adderRef.Parameters[0].ParameterType.ResolveGenericParameters(adderRef), Module));
197
var adderTuple = propertyType.GetMethods(Context.
Cache
, md => md.Name == "Add" && md.Parameters.Count == 1, Module).FirstOrDefault() ??
203
Context.IL.Append(vardef.LoadAs(Context.
Cache
, adderRef.Parameters[0].ParameterType.ResolveGenericParameters(adderRef), Module));
260
vardefref.VariableDefinition.VariableType.ImplementsGenericInterface(context.
Cache
, "Microsoft.Maui.Controls.Xaml.IMarkupExtension`1",
263
var markExt = markupExtension.ResolveCached(context.
Cache
);
275
foreach (var instruction in context.Variables[node].LoadAs(context.
Cache
, markupExtension, module))
284
else if (vardefref.VariableDefinition.VariableType.ImplementsGenericInterface(context.
Cache
, "Microsoft.Maui.Controls.Xaml.IMarkupExtension`1",
287
var acceptEmptyServiceProvider = vardefref.VariableDefinition.VariableType.GetCustomAttribute(context.
Cache
, module, ("Microsoft.Maui.Controls", "Microsoft.Maui.Controls.Xaml", "AcceptEmptyServiceProviderAttribute")) != null;
288
var requiredServiceType = vardefref.VariableDefinition.VariableType.GetRequiredServices(context.
Cache
, module);
323
var markExt = markupExtension.ResolveCached(context.
Cache
);
330
foreach (var instruction in context.Variables[node].LoadAs(context.
Cache
, markupExtension, module))
340
else if (context.Variables[node].VariableType.ImplementsInterface(context.
Cache
, module.ImportReference(context.
Cache
, ("Microsoft.Maui.Controls", "Microsoft.Maui.Controls.Xaml", "IMarkupExtension"))))
342
var acceptEmptyServiceProvider = context.Variables[node].VariableType.GetCustomAttribute(context.
Cache
, module, ("Microsoft.Maui.Controls", "Microsoft.Maui.Controls.Xaml", "AcceptEmptyServiceProviderAttribute")) != null;
343
var requiredServiceType = vardefref.VariableDefinition.VariableType.GetRequiredServices(context.
Cache
, module);
350
var compiledValueProviderName = context.Variables[node].VariableType.GetCustomAttribute(context.
Cache
, module, ("Microsoft.Maui.Controls", "Microsoft.Maui.Controls.Xaml", "ProvideCompiledAttribute"))?.ConstructorArguments?[0].Value as string;
370
foreach (var instruction in context.Variables[node].LoadAs(context.
Cache
, module.GetTypeDefinition(context.
Cache
, markupExtensionType), module))
377
yield return Create(Callvirt, module.ImportMethodReference(context.
Cache
,
383
else if (context.Variables[node].VariableType.ImplementsInterface(context.
Cache
, module.ImportReference(context.
Cache
, ("Microsoft.Maui.Controls", "Microsoft.Maui.Controls.Xaml", "IValueProvider"))))
385
var acceptEmptyServiceProvider = context.Variables[node].VariableType.GetCustomAttribute(context.
Cache
, module, ("Microsoft.Maui.Controls", "Microsoft.Maui.Controls.Xaml", "AcceptEmptyServiceProviderAttribute")) != null;
386
var requiredServiceType = vardefref.VariableDefinition.VariableType.GetRequiredServices(context.
Cache
, module);
393
var compiledValueProviderName = valueProviderType?.GetCustomAttribute(context.
Cache
, module, ("Microsoft.Maui.Controls", "Microsoft.Maui.Controls.Xaml", "ProvideCompiledAttribute"))?.ConstructorArguments?[0].Value as string;
411
foreach (var instruction in context.Variables[node].LoadAs(context.
Cache
, module.GetTypeDefinition(context.
Cache
, valueProviderInterface), module))
418
yield return Create(Callvirt, module.ImportMethodReference(context.
Cache
,
513
var tSourceRef = dtXType.GetTypeReference(context.
Cache
, module, (IXmlLineInfo)node);
534
tPropertyRef = lastProp.propDeclTypeRef.ResolveCached(context.
Cache
);
537
var valuetupleRef = context.Module.ImportReference(module.ImportReference(context.
Cache
, ("mscorlib", "System", "ValueTuple`2")).MakeGenericInstanceType(new[] { tPropertyRef, module.TypeSystem.Boolean }));
538
var funcRef = module.ImportReference(module.ImportReference(context.
Cache
, ("mscorlib", "System", "Func`2")).MakeGenericInstanceType(new[] { tSourceRef, valuetupleRef }));
539
var actionRef = module.ImportReference(module.ImportReference(context.
Cache
, ("mscorlib", "System", "Action`2")).MakeGenericInstanceType(new[] { tSourceRef, tPropertyRef }));
540
var funcObjRef = module.ImportReference(module.ImportReference(context.
Cache
, ("mscorlib", "System", "Func`2")).MakeGenericInstanceType(new[] { tSourceRef, module.TypeSystem.Object }));
541
var tupleRef = module.ImportReference(module.ImportReference(context.
Cache
, ("mscorlib", "System", "Tuple`2")).MakeGenericInstanceType(new[] { funcObjRef, module.TypeSystem.String }));
542
var typedBindingRef = module.ImportReference(module.ImportReference(context.
Cache
, ("Microsoft.Maui.Controls", "Microsoft.Maui.Controls.Internals", "TypedBinding`2")).MakeGenericInstanceType(new[] { tSourceRef, tPropertyRef }));
545
var ctorInfo = module.ImportReference(typedBindingRef.ResolveCached(context.
Cache
).Methods.FirstOrDefault(md =>
549
&& !md.HasCustomAttributes(module.ImportReference(context.
Cache
, ("mscorlib", "System", "ObsoleteAttribute")))));
552
foreach (var instruction in bindingExt.LoadAs(context.
Cache
, module.GetTypeDefinition(context.
Cache
, bindingExtensionType), module))
571
yield return Create(Callvirt, module.ImportPropertySetterReference(context.
Cache
, bindingExtensionType, propertyName: "TypedBinding"));
597
&& parentNode.XmlType.TryGetTypeReference(context.
Cache
, module, (IXmlLineInfo)node, out TypeReference parentTypeRef)
598
&& parentTypeRef.ResolveCached(context.
Cache
) is TypeDefinition parentType
599
&& parentType.GetProperty(context.
Cache
, pd => pd.Name == propertyName.LocalName, out var propertyDeclaringTypeRef) is PropertyDefinition propertyDef
641
var property = previousPartTypeRef.GetProperty(context.
Cache
, pd => pd.Name == p && pd.GetMethod != null && pd.GetMethod.IsPublic && !pd.GetMethod.IsStatic, out var propDeclTypeRef);
653
var defaultMemberAttribute = previousPartTypeRef.GetCustomAttribute(context.
Cache
, module, ("mscorlib", "System.Reflection", "DefaultMemberAttribute"));
658
indexer = previousPartTypeRef.GetProperty(context.
Cache
,
661
&& TypeRefComparer.Default.Equals(pd.GetMethod.Parameters[0].ParameterType.ResolveGenericParameters(previousPartTypeRef), module.ImportReference(context.
Cache
, ("mscorlib", "System", "Int32")))
663
indexer = indexer ?? previousPartTypeRef.GetProperty(context.
Cache
,
666
&& TypeRefComparer.Default.Equals(pd.GetMethod.Parameters[0].ParameterType.ResolveGenericParameters(previousPartTypeRef), module.ImportReference(context.
Cache
, ("mscorlib", "System", "String")))
668
indexer = indexer ?? previousPartTypeRef.GetProperty(context.
Cache
,
671
&& TypeRefComparer.Default.Equals(pd.GetMethod.Parameters[0].ParameterType.ResolveGenericParameters(previousPartTypeRef), module.ImportReference(context.
Cache
, ("mscorlib", "System", "Object")))
687
previousPartTypeRef.ResolveCached(context.
Cache
);
776
var tupleRef = module.ImportReference(module.ImportReference(context.
Cache
, ("mscorlib", "System", "ValueTuple`2")).MakeGenericInstanceType(new[] { tPropertyRef, module.TypeSystem.Boolean }));
777
var tupleCtorRef = module.ImportCtorReference(context.
Cache
, tupleRef, 2);
779
var getter = new MethodDefinition($"<{context.Body.Method.Name}>typedBindingsM__{context.
Cache
.TypedBindingCount++}",
784
CustomAttributes = { new CustomAttribute(module.ImportCtorReference(context.
Cache
, ("mscorlib", "System.Runtime.CompilerServices", "CompilerGeneratedAttribute"), parameterTypes: null)) }
844
yield return Create(Newobj, module.ImportCtorReference(context.
Cache
, ("mscorlib", "System", "Func`2"), paramCount: 2, classArguments: new[] { tSourceRef, tupleRef }));
867
var setter = new MethodDefinition($"<{context.Body.Method.Name}>typedBindingsM__{context.
Cache
.TypedBindingCount++}",
876
new CustomAttribute (module.ImportCtorReference(context.
Cache
, ("mscorlib", "System.Runtime.CompilerServices", "CompilerGeneratedAttribute"), parameterTypes: null))
966
yield return Create(Newobj, module.ImportCtorReference(context.
Cache
, ("mscorlib", "System", "Action`2"),
999
var partGetter = new MethodDefinition($"<{context.Body.Method.Name}>typedBindingsM__{context.
Cache
.TypedBindingCount++}", MethodAttributes.Private | MethodAttributes.HideBySig | MethodAttributes.Static, module.TypeSystem.Object)
1005
new CustomAttribute (module.ImportCtorReference(context.
Cache
, ("mscorlib", "System.Runtime.CompilerServices", "CompilerGeneratedAttribute"), parameterTypes: null))
1040
var funcObjRef = context.Module.ImportReference(module.ImportReference(context.
Cache
, ("mscorlib", "System", "Func`2")).MakeGenericInstanceType(new[] { tSourceRef, module.TypeSystem.Object }));
1041
var tupleRef = context.Module.ImportReference(module.ImportReference(context.
Cache
, ("mscorlib", "System", "Tuple`2")).MakeGenericInstanceType(new[] { funcObjRef, module.TypeSystem.String }));
1042
var funcCtor = module.ImportReference(funcObjRef.ResolveCached(context.
Cache
).GetConstructors().First());
1044
var tupleCtor = module.ImportReference(tupleRef.ResolveCached(context.
Cache
).GetConstructors().First());
1163
FieldDefinition bpDef = bpOwnerType.GetField(context.
Cache
,
1181
return !attached && valueNode is ValueNode && parent.VariableType.GetEvent(context.
Cache
, ed => ed.Name == localName, out _) != null;
1189
var eventinfo = elementType.GetEvent(context.
Cache
, ed => ed.Name == localName, out eventDeclaringTypeRef);
1210
var handler = declaringType.AllMethods(context.
Cache
).FirstOrDefault(md =>
1216
var invoke = module.ImportReference(eventinfo.EventType.ResolveCached(context.
Cache
).GetMethods().First(eventmd => eventmd.Name == "Invoke"));
1218
if (!md.methodDef.ReturnType.InheritsFromOrImplements(context.
Cache
, invoke.ReturnType) || invoke.Parameters.Count != md.methodDef.Parameters.Count)
1223
if (!invoke.Parameters[i].ParameterType.InheritsFromOrImplements(context.
Cache
, md.methodDef.Parameters[i].ParameterType))
1236
var ctor = module.ImportReference(eventinfo.EventType.ResolveCached(context.
Cache
).GetConstructors().First());
1246
foreach (var instruction in (context.Root as VariableDefinition).LoadAs(context.
Cache
, ctor.Parameters[0].ParameterType.ResolveGenericParameters(ctor), module))
1290
foreach (var instruction in parent.LoadAs(context.
Cache
, module.GetTypeDefinition(context.
Cache
, dynamicResourceHandlerType), module))
1293
foreach (var instruction in context.Variables[elementNode].LoadAs(context.
Cache
, module.GetTypeDefinition(context.
Cache
, dynamicResourceType), module))
1295
yield return Create(Callvirt, module.ImportPropertyGetterReference(context.
Cache
, dynamicResourceType, propertyName: "Key"));
1296
yield return Create(Callvirt, module.ImportMethodReference(context.
Cache
,
1316
var implicitOperator = varValue.VariableType.GetImplicitOperatorTo(context.
Cache
, module.ImportReference(context.
Cache
, ("Microsoft.Maui.Controls", "Microsoft.Maui.Controls", "BindingBase")), module);
1320
return varValue.VariableType.InheritsFromOrImplements(context.
Cache
, module.ImportReference(context.
Cache
, ("Microsoft.Maui.Controls", "Microsoft.Maui.Controls", "BindingBase")));
1333
foreach (var instruction in parent.LoadAs(context.
Cache
, module.GetTypeDefinition(context.
Cache
, bindableObjectType), module))
1336
foreach (var instruction in context.Variables[elementNode].LoadAs(context.
Cache
, module.GetTypeDefinition(context.
Cache
, parameterTypes[1]), module))
1338
yield return Create(Callvirt, module.ImportMethodReference(context.
Cache
, ("Microsoft.Maui.Controls", "Microsoft.Maui.Controls", "BindableObject"),
1359
var bpTypeRef = bpRef.GetBindablePropertyType(context.
Cache
, iXmlLineInfo, module);
1364
var implicitOperator = varValue.VariableType.GetImplicitOperatorTo(context.
Cache
, bpTypeRef, module);
1372
return varValue.VariableType.InheritsFromOrImplements(context.
Cache
, bpTypeRef) || varValue.VariableType.FullName == "System.Object";
1383
if (!parent.VariableType.InheritsFromOrImplements(context.
Cache
, module.ImportReference(context.
Cache
, ("Microsoft.Maui.Controls", "Microsoft.Maui.Controls", "BindableObject"))))
1386
propertyType = bpRef.GetBindablePropertyType(context.
Cache
, iXmlLineInfo, module);
1402
foreach (var instruction in parent.LoadAs(context.
Cache
, module.GetTypeDefinition(context.
Cache
, bindableObjectType), module))
1424
yield return Create(Ldtoken, module.ImportReference(context.
Cache
, ("Microsoft.Maui.Controls", "Microsoft.Maui.Controls", "BindingBase")));
1425
yield return Create(Call, module.ImportMethodReference(context.
Cache
, ("mscorlib", "System", "Type"), methodName: "GetTypeFromHandle", parameterTypes: new[] { ("mscorlib", "System", "RuntimeTypeHandle") }, isStatic: true));
1427
yield return Create(Callvirt, module.ImportMethodReference(context.
Cache
, ("mscorlib", "System", "Object"), methodName: "GetType", paramCount: 0));
1428
yield return Create(Callvirt, module.ImportMethodReference(context.
Cache
, ("mscorlib", "System", "Type"), methodName: "IsAssignableFrom", parameterTypes: new[] { ("mscorlib", "System", "Type") }));
1436
var bpTypeRef = bpRef.GetBindablePropertyType(context.
Cache
, iXmlLineInfo, module);
1437
foreach (var instruction in context.Variables[elementNode].LoadAs(context.
Cache
, bpTypeRef, module))
1447
yield return Create(Callvirt, module.ImportMethodReference(context.
Cache
,
1458
propertyType = bpRef.GetBindablePropertyType(context.
Cache
, iXmlLineInfo, context.Body.Method.Module);
1467
foreach (var instruction in parent.LoadAs(context.
Cache
, module.GetTypeDefinition(context.
Cache
, bindableObjectType), module))
1471
yield return Create(Callvirt, module.ImportMethodReference(context.
Cache
,
1481
var property = parent.VariableType.GetProperty(context.
Cache
, pd => pd.Name == localName, out declaringTypeReference);
1490
if (valueNode != null && valueNode.CanConvertValue(context, propertyType, new ICustomAttributeProvider[] { property, propertyType.ResolveCached(context.
Cache
) }))
1498
var implicitOperator = vardef.VariableType.GetImplicitOperatorTo(context.
Cache
, propertyType, module);
1500
if (vardef.VariableType.InheritsFromOrImplements(context.
Cache
, propertyType))
1519
var property = parent.VariableType.GetProperty(context.
Cache
, pd => pd.Name == localName, out declaringTypeReference);
1526
module.ImportReference(parent.VariableType.ResolveCached(context.
Cache
));
1538
var property = parent.VariableType.GetProperty(context.
Cache
, pd => pd.Name == localName, out declaringTypeReference);
1552
module.ImportReference(parent.VariableType.ResolveCached(context.
Cache
));
1568
foreach (var instruction in valueNode.PushConvertedValue(context, propertyType, new ICustomAttributeProvider[] { property, propertyType.ResolveCached(context.
Cache
) }, (requiredServices) => valueNode.PushServiceProvider(context, requiredServices, propertyRef: property), false, true))
1577
foreach (var instruction in context.Variables[elementNode].LoadAs(context.
Cache
, propertyType, module))
1589
var property = parent.VariableType.GetProperty(context.
Cache
, pd => pd.Name == localName, out var declaringTypeReference);
1592
module.ImportReference(parent.VariableType.ResolveCached(context.
Cache
));
1625
var adderTuple = propertyType.GetMethods(context.
Cache
, md => md.Name == "Add"
1633
if (varValue.VariableType.InheritsFromOrImplements(context.
Cache
, paramType))
1636
if (varValue.VariableType.GetImplicitOperatorTo(context.
Cache
, paramType, module) != null)
1648
&& !collectionType.InheritsFromOrImplements(context.
Cache
, context.Module.ImportReference(context.
Cache
, ("Microsoft.Maui.Controls", "Microsoft.Maui.Controls", "ResourceDictionary"))))
1655
var names = context.
Cache
.GetResourceNamesInUse(parent);
1664
if (module.ImportMethodReference(context.
Cache
,
1665
module.GetTypeDefinition(context.
Cache
, ("Microsoft.Maui.Controls", "Microsoft.Maui.Controls", "ResourceDictionary")),
1689
var adderTuple = propertyType.GetMethods(context.
Cache
, md => md.Name == "Add" && md.Parameters.Count == 1, module).FirstOrDefault();
1693
foreach (var instruction in vardef.LoadAs(context.
Cache
, adderRef.Parameters[0].ParameterType.ResolveGenericParameters(adderRef), module))
1706
var names = context.
Cache
.GetResourceNamesInUse(parent);
1715
foreach (var instruction in context.Variables[node].LoadAs(context.
Cache
, module.TypeSystem.Object, module))
1717
yield return Create(Callvirt, module.ImportMethodReference(context.
Cache
, ("Microsoft.Maui.Controls", "Microsoft.Maui.Controls", "ResourceDictionary"),
1728
yield return Create(Callvirt, module.ImportMethodReference(context.
Cache
, ("Microsoft.Maui.Controls", "Microsoft.Maui.Controls", "ResourceDictionary"),
1742
elementType = new XmlType(namespaceURI, typename, null).GetTypeReference(context.
Cache
, context.Body.Method.Module, lineInfo);
1755
parentContext.IL.Append(parentVar.LoadAs(parentContext.
Cache
, module.GetTypeDefinition(parentContext.
Cache
, dataTemplateType), module));
1764
"<" + parentContext.Body.Method.Name + ">_anonXamlCDataTemplate_" + parentContext.
Cache
.DataTemplateCount++,
1771
new CustomAttribute (module.ImportCtorReference(parentContext.
Cache
, ("mscorlib", "System.Runtime.CompilerServices", "CompilerGeneratedAttribute"), parameterTypes: null)),
1776
var ctor = anonType.AddDefaultConstructor(parentContext.
Cache
);
1784
var parentValues = new FieldDefinition("parentValues", FieldAttributes.Assembly, module.ImportArrayReference(parentContext.
Cache
, ("mscorlib", "System", "Object")));
1801
var templateContext = new ILContext(templateIl, loadTemplate.Body, module, parentContext.
Cache
, parentValues)
1821
parentIl.Append(kvp.Value.Item1.LoadAs(parentContext.
Cache
, module.ImportReference(parentContext.
Cache
, ("Microsoft.Maui.Controls", "Microsoft.Maui.Controls.Internals", "NameScope")), module));
1822
var fieldDefScope = new FieldDefinition($"_scope{i++}", FieldAttributes.Assembly, module.ImportReference(parentContext.
Cache
, ("Microsoft.Maui.Controls", "Microsoft.Maui.Controls.Internals", "NameScope")));
1828
var varDefScope = new VariableDefinition(module.ImportReference(parentContext.
Cache
, ("Microsoft.Maui.Controls", "Microsoft.Maui.Controls.Internals", "NameScope")));
1842
templateIl.Append(templateContext.Variables[node].LoadAs(parentContext.
Cache
, module.TypeSystem.Object, module));
1852
parentIl.Append((parentContext.Root as VariableDefinition).LoadAs(parentContext.
Cache
, module.TypeSystem.Object, module));
1864
parentIl.Emit(Newobj, module.ImportCtorReference(parentContext.
Cache
, ("mscorlib", "System", "Func`1"),
1868
parentContext.IL.Emit(OpCodes.Callvirt, module.ImportPropertySetterReference(parentContext.
Cache
, dataTemplateType, propertyName: "LoadTemplate"));
1878
var attributes = variableDefinition.VariableType.ResolveCached(Context.
Cache
)
SetResourcesVisitor.cs (1)
76
|| parentVar.VariableType.ResolveCached(Context.
Cache
).BaseType?.FullName == "Microsoft.Maui.Controls.ResourceDictionary";