@ -72,7 +72,10 @@ namespace Avalonia.Markup.Xaml.XamlIl.CompilerExtensions.Transformers
public IXamlType Int { get ; }
public IXamlType Long { get ; }
public IXamlType Uri { get ; }
public IXamlType TaskOfT { get ; }
public IXamlType IDictionaryT { get ; }
public IXamlType WeakReferenceOfT { get ; }
public IXamlType IObservableOfT { get ; }
public IXamlType FontFamily { get ; }
public IXamlConstructor FontFamilyConstructorUriName { get ; }
public IXamlType Thickness { get ; }
@ -129,6 +132,8 @@ namespace Avalonia.Markup.Xaml.XamlIl.CompilerExtensions.Transformers
public IXamlType Style { get ; }
public IXamlType Container { get ; }
public IXamlType Styles { get ; }
public IXamlType StyleQueries { get ; }
public IXamlType Selectors { get ; }
public IXamlType ControlTheme { get ; }
public IXamlType WindowTransparencyLevel { get ; }
public IXamlType IReadOnlyListOfT { get ; }
@ -149,22 +154,21 @@ namespace Avalonia.Markup.Xaml.XamlIl.CompilerExtensions.Transformers
public IXamlMethod AddHandlerT { get ; }
[UnconditionalSuppressMessage("Trimming", "IL2122", Justification = TrimmingMessages.TypesInCoreOrAvaloniaAssembly)]
internal InteractivityWellKnownTypes ( TransformerConfiguration cfg )
internal InteractivityWellKnownTypes ( IXamlTypeSystem typeSystem , XamlTypeWellKnownTypes wellKnownTypes )
{
var ts = cfg . TypeSystem ;
Interactive = ts . GetType ( "Avalonia.Interactivity.Interactive" ) ;
RoutedEvent = ts . GetType ( "Avalonia.Interactivity.RoutedEvent" ) ;
RoutedEventArgs = ts . GetType ( "Avalonia.Interactivity.RoutedEventArgs" ) ;
var eventHanlderT = ts . GetType ( "System.EventHandler`1" ) ;
Interactive = typeSystem . GetType ( "Avalonia.Interactivity.Interactive" ) ;
RoutedEvent = typeSystem . GetType ( "Avalonia.Interactivity.RoutedEvent" ) ;
RoutedEventArgs = typeSystem . GetType ( "Avalonia.Interactivity.RoutedEventArgs" ) ;
var eventHanlderT = typeSystem . GetType ( "System.EventHandler`1" ) ;
RoutedEventHandler = eventHanlderT . MakeGenericType ( RoutedEventArgs ) ;
AddHandler = Interactive . GetMethod ( m = > m . IsPublic
& & ! m . IsStatic
& & m . Name = = "AddHandler"
& & m . Parameters . Count = = 4
& & m . Parameters [ 0 ] . Equals ( RoutedEvent )
& & m . Parameters [ 1 ] . Equals ( cfg . W ellKnownTypes. Delegate )
& & m . Parameters [ 1 ] . Equals ( w ellKnownTypes. Delegate )
& & m . Parameters [ 2 ] . IsEnum
& & m . Parameters [ 3 ] . Equals ( cfg . W ellKnownTypes. Boolean )
& & m . Parameters [ 3 ] . Equals ( w ellKnownTypes. Boolean )
) ;
AddHandlerT = Interactive . GetMethod ( m = > m . IsPublic
& & ! m . IsStatic
@ -172,9 +176,9 @@ namespace Avalonia.Markup.Xaml.XamlIl.CompilerExtensions.Transformers
& & m . Parameters . Count = = 4
& & RoutedEvent . IsAssignableFrom ( m . Parameters [ 0 ] )
& & m . Parameters [ 0 ] . GenericArguments . Count = = 1 // This is specific this case workaround to check is generic method
& & ( cfg . W ellKnownTypes. Delegate ) . IsAssignableFrom ( m . Parameters [ 1 ] )
& & w ellKnownTypes. Delegate . IsAssignableFrom ( m . Parameters [ 1 ] )
& & m . Parameters [ 2 ] . IsEnum
& & m . Parameters [ 3 ] . Equals ( cfg . W ellKnownTypes. Boolean )
& & m . Parameters [ 3 ] . Equals ( w ellKnownTypes. Boolean )
) ;
}
@ -183,44 +187,44 @@ namespace Avalonia.Markup.Xaml.XamlIl.CompilerExtensions.Transformers
public InteractivityWellKnownTypes Interactivity { get ; }
[UnconditionalSuppressMessage("Trimming", "IL2122", Justification = TrimmingMessages.TypesInCoreOrAvaloniaAssembly)]
public AvaloniaXamlIlWellKnownTypes ( TransformerConfiguration cfg )
public AvaloniaXamlIlWellKnownTypes ( IXamlTypeSystem typeSystem )
{
RuntimeHelpers = cfg . T ypeSystem. GetType ( "Avalonia.Markup.Xaml.XamlIl.Runtime.XamlIlRuntimeHelpers" ) ;
RuntimeHelpers = t ypeSystem. GetType ( "Avalonia.Markup.Xaml.XamlIl.Runtime.XamlIlRuntimeHelpers" ) ;
XamlIlTypes = cfg . WellKnownTypes ;
AvaloniaObject = cfg . T ypeSystem. GetType ( "Avalonia.AvaloniaObject" ) ;
AvaloniaObjectExtensions = cfg . T ypeSystem. GetType ( "Avalonia.AvaloniaObjectExtensions" ) ;
AvaloniaProperty = cfg . T ypeSystem. GetType ( "Avalonia.AvaloniaProperty" ) ;
AvaloniaPropertyT = cfg . T ypeSystem. GetType ( "Avalonia.AvaloniaProperty`1" ) ;
StyledPropertyT = cfg . T ypeSystem. GetType ( "Avalonia.StyledProperty`1" ) ;
AvaloniaAttachedPropertyT = cfg . T ypeSystem. GetType ( "Avalonia.AttachedProperty`1" ) ;
BindingPriority = cfg . T ypeSystem. GetType ( "Avalonia.Data.BindingPriority" ) ;
XamlIlTypes = typeSystem . WellKnownTypes ;
AvaloniaObject = t ypeSystem. GetType ( "Avalonia.AvaloniaObject" ) ;
AvaloniaObjectExtensions = t ypeSystem. GetType ( "Avalonia.AvaloniaObjectExtensions" ) ;
AvaloniaProperty = t ypeSystem. GetType ( "Avalonia.AvaloniaProperty" ) ;
AvaloniaPropertyT = t ypeSystem. GetType ( "Avalonia.AvaloniaProperty`1" ) ;
StyledPropertyT = t ypeSystem. GetType ( "Avalonia.StyledProperty`1" ) ;
AvaloniaAttachedPropertyT = t ypeSystem. GetType ( "Avalonia.AttachedProperty`1" ) ;
BindingPriority = t ypeSystem. GetType ( "Avalonia.Data.BindingPriority" ) ;
AvaloniaObjectSetStyledPropertyValue = AvaloniaObject
. GetMethod ( m = > m . IsPublic & & ! m . IsStatic & & m . Name = = "SetValue"
& & m . Parameters . Count = = 3
& & m . Parameters [ 0 ] . Name = = "StyledProperty`1"
& & m . Parameters [ 2 ] . Equals ( BindingPriority ) ) ;
BindingBase = cfg . T ypeSystem. GetType ( "Avalonia.Data.BindingBase" ) ;
BindingExpressionBase = cfg . T ypeSystem. GetType ( "Avalonia.Data.BindingExpressionBase" ) ;
MultiBinding = cfg . T ypeSystem. GetType ( "Avalonia.Data.MultiBinding" ) ;
IDisposable = cfg . T ypeSystem. GetType ( "System.IDisposable" ) ;
ICommand = cfg . T ypeSystem. GetType ( "System.Windows.Input.ICommand" ) ;
Transitions = cfg . T ypeSystem. GetType ( "Avalonia.Animation.Transitions" ) ;
AssignBindingAttribute = cfg . T ypeSystem. GetType ( "Avalonia.Data.AssignBindingAttribute" ) ;
DependsOnAttribute = cfg . T ypeSystem. GetType ( "Avalonia.Metadata.DependsOnAttribute" ) ;
DataTypeAttribute = cfg . T ypeSystem. GetType ( "Avalonia.Metadata.DataTypeAttribute" ) ;
InheritDataTypeFromItemsAttribute = cfg . T ypeSystem. GetType ( "Avalonia.Metadata.InheritDataTypeFromItemsAttribute" ) ;
InheritDataTypeFromAttribute = cfg . T ypeSystem. GetType ( "Avalonia.Metadata.InheritDataTypeFromAttribute" ) ;
MarkupExtensionOptionAttribute = cfg . T ypeSystem. GetType ( "Avalonia.Metadata.MarkupExtensionOptionAttribute" ) ;
MarkupExtensionDefaultOptionAttribute = cfg . T ypeSystem. GetType ( "Avalonia.Metadata.MarkupExtensionDefaultOptionAttribute" ) ;
ControlTemplateScopeAttribute = cfg . T ypeSystem. GetType ( "Avalonia.Metadata.ControlTemplateScopeAttribute" ) ;
AvaloniaListAttribute = cfg . T ypeSystem. GetType ( "Avalonia.Metadata.AvaloniaListAttribute" ) ;
AvaloniaList = cfg . T ypeSystem. GetType ( "Avalonia.Collections.AvaloniaList`1" ) ;
OnExtensionType = cfg . T ypeSystem. GetType ( "Avalonia.Markup.Xaml.MarkupExtensions.On" ) ;
BindingBase = t ypeSystem. GetType ( "Avalonia.Data.BindingBase" ) ;
BindingExpressionBase = t ypeSystem. GetType ( "Avalonia.Data.BindingExpressionBase" ) ;
MultiBinding = t ypeSystem. GetType ( "Avalonia.Data.MultiBinding" ) ;
IDisposable = t ypeSystem. GetType ( "System.IDisposable" ) ;
ICommand = t ypeSystem. GetType ( "System.Windows.Input.ICommand" ) ;
Transitions = t ypeSystem. GetType ( "Avalonia.Animation.Transitions" ) ;
AssignBindingAttribute = t ypeSystem. GetType ( "Avalonia.Data.AssignBindingAttribute" ) ;
DependsOnAttribute = t ypeSystem. GetType ( "Avalonia.Metadata.DependsOnAttribute" ) ;
DataTypeAttribute = t ypeSystem. GetType ( "Avalonia.Metadata.DataTypeAttribute" ) ;
InheritDataTypeFromItemsAttribute = t ypeSystem. GetType ( "Avalonia.Metadata.InheritDataTypeFromItemsAttribute" ) ;
InheritDataTypeFromAttribute = t ypeSystem. GetType ( "Avalonia.Metadata.InheritDataTypeFromAttribute" ) ;
MarkupExtensionOptionAttribute = t ypeSystem. GetType ( "Avalonia.Metadata.MarkupExtensionOptionAttribute" ) ;
MarkupExtensionDefaultOptionAttribute = t ypeSystem. GetType ( "Avalonia.Metadata.MarkupExtensionDefaultOptionAttribute" ) ;
ControlTemplateScopeAttribute = t ypeSystem. GetType ( "Avalonia.Metadata.ControlTemplateScopeAttribute" ) ;
AvaloniaListAttribute = t ypeSystem. GetType ( "Avalonia.Metadata.AvaloniaListAttribute" ) ;
AvaloniaList = t ypeSystem. GetType ( "Avalonia.Collections.AvaloniaList`1" ) ;
OnExtensionType = t ypeSystem. GetType ( "Avalonia.Markup.Xaml.MarkupExtensions.On" ) ;
AvaloniaObjectBindMethod = AvaloniaObject . GetMethod ( "Bind" , BindingExpressionBase , false , AvaloniaProperty , BindingBase ) ;
UnsetValueType = cfg . T ypeSystem. GetType ( "Avalonia.UnsetValueType" ) ;
StyledElement = cfg . T ypeSystem. GetType ( "Avalonia.StyledElement" ) ;
INameScope = cfg . T ypeSystem. GetType ( "Avalonia.Controls.INameScope" ) ;
UnsetValueType = t ypeSystem. GetType ( "Avalonia.UnsetValueType" ) ;
StyledElement = t ypeSystem. GetType ( "Avalonia.StyledElement" ) ;
INameScope = t ypeSystem. GetType ( "Avalonia.Controls.INameScope" ) ;
INameScopeRegister = INameScope . GetMethod (
new FindMethodMethodSignature ( "Register" , XamlIlTypes . Void ,
XamlIlTypes . String , XamlIlTypes . Object )
@ -236,42 +240,45 @@ namespace Avalonia.Markup.Xaml.XamlIl.CompilerExtensions.Transformers
DeclaringOnly = true ,
IsExactMatch = true
} ) ;
NameScope = cfg . T ypeSystem. GetType ( "Avalonia.Controls.NameScope" ) ;
NameScope = t ypeSystem. GetType ( "Avalonia.Controls.NameScope" ) ;
NameScopeSetNameScope = NameScope . GetMethod ( new FindMethodMethodSignature ( "SetNameScope" ,
XamlIlTypes . Void , StyledElement , INameScope )
{ IsStatic = true } ) ;
AvaloniaObjectSetValueMethod = AvaloniaObject . GetMethod ( "SetValue" , IDisposable ,
false , AvaloniaProperty , XamlIlTypes . Object , BindingPriority ) ;
IPropertyInfo = cfg . TypeSystem . GetType ( "Avalonia.Data.Core.IPropertyInfo" ) ;
ClrPropertyInfo = cfg . TypeSystem . GetType ( "Avalonia.Data.Core.ClrPropertyInfo" ) ;
IPropertyAccessor = cfg . TypeSystem . GetType ( "Avalonia.Data.Core.Plugins.IPropertyAccessor" ) ;
PropertyInfoAccessorFactory = cfg . TypeSystem . GetType ( "Avalonia.Markup.Xaml.MarkupExtensions.CompiledBindings.PropertyInfoAccessorFactory" ) ;
CompiledBinding = cfg . TypeSystem . GetType ( "Avalonia.Data.CompiledBinding" ) ;
CompiledBindingPathBuilder = cfg . TypeSystem . GetType ( "Avalonia.Data.CompiledBindingPathBuilder" ) ;
CompiledBindingPath = cfg . TypeSystem . GetType ( "Avalonia.Data.CompiledBindingPath" ) ;
CompiledBindingExtension = cfg . TypeSystem . GetType ( "Avalonia.Markup.Xaml.MarkupExtensions.CompiledBindingExtension" ) ;
ResolveByNameExtension = cfg . TypeSystem . GetType ( "Avalonia.Markup.Xaml.MarkupExtensions.ResolveByNameExtension" ) ;
DataTemplate = cfg . TypeSystem . GetType ( "Avalonia.Markup.Xaml.Templates.DataTemplate" ) ;
IDataTemplate = cfg . TypeSystem . GetType ( "Avalonia.Controls.Templates.IDataTemplate" ) ;
Control = cfg . TypeSystem . GetType ( "Avalonia.Controls.Control" ) ;
ContentControl = cfg . TypeSystem . GetType ( "Avalonia.Controls.ContentControl" ) ;
ITemplateOfControl = cfg . TypeSystem . GetType ( "Avalonia.Controls.ITemplate`1" ) . MakeGenericType ( Control ) ;
ItemsControl = cfg . TypeSystem . GetType ( "Avalonia.Controls.ItemsControl" ) ;
ReflectionBindingExtension = cfg . TypeSystem . GetType ( "Avalonia.Markup.Xaml.MarkupExtensions.ReflectionBindingExtension" ) ;
RelativeSource = cfg . TypeSystem . GetType ( "Avalonia.Data.RelativeSource" ) ;
UInt = cfg . TypeSystem . GetType ( "System.UInt32" ) ;
Int = cfg . TypeSystem . GetType ( "System.Int32" ) ;
Long = cfg . TypeSystem . GetType ( "System.Int64" ) ;
Uri = cfg . TypeSystem . GetType ( "System.Uri" ) ;
IDictionaryT = cfg . TypeSystem . GetType ( "System.Collections.Generic.IDictionary`2" ) ;
FontFamily = cfg . TypeSystem . GetType ( "Avalonia.Media.FontFamily" ) ;
IPropertyInfo = typeSystem . GetType ( "Avalonia.Data.Core.IPropertyInfo" ) ;
ClrPropertyInfo = typeSystem . GetType ( "Avalonia.Data.Core.ClrPropertyInfo" ) ;
IPropertyAccessor = typeSystem . GetType ( "Avalonia.Data.Core.Plugins.IPropertyAccessor" ) ;
PropertyInfoAccessorFactory = typeSystem . GetType ( "Avalonia.Markup.Xaml.MarkupExtensions.CompiledBindings.PropertyInfoAccessorFactory" ) ;
CompiledBinding = typeSystem . GetType ( "Avalonia.Data.CompiledBinding" ) ;
CompiledBindingPathBuilder = typeSystem . GetType ( "Avalonia.Data.CompiledBindingPathBuilder" ) ;
CompiledBindingPath = typeSystem . GetType ( "Avalonia.Data.CompiledBindingPath" ) ;
CompiledBindingExtension = typeSystem . GetType ( "Avalonia.Markup.Xaml.MarkupExtensions.CompiledBindingExtension" ) ;
ResolveByNameExtension = typeSystem . GetType ( "Avalonia.Markup.Xaml.MarkupExtensions.ResolveByNameExtension" ) ;
DataTemplate = typeSystem . GetType ( "Avalonia.Markup.Xaml.Templates.DataTemplate" ) ;
IDataTemplate = typeSystem . GetType ( "Avalonia.Controls.Templates.IDataTemplate" ) ;
Control = typeSystem . GetType ( "Avalonia.Controls.Control" ) ;
ContentControl = typeSystem . GetType ( "Avalonia.Controls.ContentControl" ) ;
ITemplateOfControl = typeSystem . GetType ( "Avalonia.Controls.ITemplate`1" ) . MakeGenericType ( Control ) ;
ItemsControl = typeSystem . GetType ( "Avalonia.Controls.ItemsControl" ) ;
ReflectionBindingExtension = typeSystem . GetType ( "Avalonia.Markup.Xaml.MarkupExtensions.ReflectionBindingExtension" ) ;
RelativeSource = typeSystem . GetType ( "Avalonia.Data.RelativeSource" ) ;
UInt = typeSystem . GetType ( "System.UInt32" ) ;
Int = typeSystem . GetType ( "System.Int32" ) ;
Long = typeSystem . GetType ( "System.Int64" ) ;
Uri = typeSystem . GetType ( "System.Uri" ) ;
TaskOfT = typeSystem . GetType ( "System.Threading.Tasks.Task`1" ) ;
IDictionaryT = typeSystem . GetType ( "System.Collections.Generic.IDictionary`2" ) ;
WeakReferenceOfT = typeSystem . GetType ( "System.WeakReference`1" ) ;
IObservableOfT = typeSystem . GetType ( "System.IObservable`1" ) ;
FontFamily = typeSystem . GetType ( "Avalonia.Media.FontFamily" ) ;
FontFamilyConstructorUriName = FontFamily . GetConstructor ( new List < IXamlType > { Uri , XamlIlTypes . String } ) ;
ThemeVariant = cfg . TypeSystem . GetType ( "Avalonia.Styling.ThemeVariant" ) ;
WindowTransparencyLevel = cfg . TypeSystem . GetType ( "Avalonia.Controls.WindowTransparencyLevel" ) ;
ThemeVariant = t ypeSystem. GetType ( "Avalonia.Styling.ThemeVariant" ) ;
WindowTransparencyLevel = t ypeSystem. GetType ( "Avalonia.Controls.WindowTransparencyLevel" ) ;
( IXamlType , IXamlConstructor ) GetNumericTypeInfo ( [ DynamicallyAccessedMembers ( DynamicallyAccessedMemberTypes . All ) ] string name , IXamlType componentType , int componentCount )
{
var type = cfg . T ypeSystem. GetType ( name ) ;
var type = t ypeSystem. GetType ( name ) ;
var ctor = type . GetConstructor ( Enumerable . Range ( 0 , componentCount ) . Select ( _ = > componentType ) . ToList ( ) ) ;
return ( type , ctor ) ;
@ -284,70 +291,72 @@ namespace Avalonia.Markup.Xaml.XamlIl.CompilerExtensions.Transformers
( Matrix , MatrixFullConstructor ) = GetNumericTypeInfo ( "Avalonia.Matrix" , XamlIlTypes . Double , 6 ) ;
( CornerRadius , CornerRadiusFullConstructor ) = GetNumericTypeInfo ( "Avalonia.CornerRadius" , XamlIlTypes . Double , 4 ) ;
RelativeUnit = cfg . T ypeSystem. GetType ( "Avalonia.RelativeUnit" ) ;
RelativePoint = cfg . T ypeSystem. GetType ( "Avalonia.RelativePoint" ) ;
RelativeUnit = t ypeSystem. GetType ( "Avalonia.RelativeUnit" ) ;
RelativePoint = t ypeSystem. GetType ( "Avalonia.RelativePoint" ) ;
RelativePointFullConstructor = RelativePoint . GetConstructor ( new List < IXamlType > { XamlIlTypes . Double , XamlIlTypes . Double , RelativeUnit } ) ;
GridLength = cfg . T ypeSystem. GetType ( "Avalonia.Controls.GridLength" ) ;
GridLengthConstructorValueType = GridLength . GetConstructor ( new List < IXamlType > { XamlIlTypes . Double , cfg . T ypeSystem. GetType ( "Avalonia.Controls.GridUnitType" ) } ) ;
Color = cfg . T ypeSystem. GetType ( "Avalonia.Media.Color" ) ;
StandardCursorType = cfg . T ypeSystem. GetType ( "Avalonia.Input.StandardCursorType" ) ;
Cursor = cfg . T ypeSystem. GetType ( "Avalonia.Input.Cursor" ) ;
GridLength = t ypeSystem. GetType ( "Avalonia.Controls.GridLength" ) ;
GridLengthConstructorValueType = GridLength . GetConstructor ( new List < IXamlType > { XamlIlTypes . Double , t ypeSystem. GetType ( "Avalonia.Controls.GridUnitType" ) } ) ;
Color = t ypeSystem. GetType ( "Avalonia.Media.Color" ) ;
StandardCursorType = t ypeSystem. GetType ( "Avalonia.Input.StandardCursorType" ) ;
Cursor = t ypeSystem. GetType ( "Avalonia.Input.Cursor" ) ;
CursorTypeConstructor = Cursor . GetConstructor ( new List < IXamlType > { StandardCursorType } ) ;
ColumnDefinition = cfg . T ypeSystem. GetType ( "Avalonia.Controls.ColumnDefinition" ) ;
ColumnDefinitions = cfg . T ypeSystem. GetType ( "Avalonia.Controls.ColumnDefinitions" ) ;
RowDefinition = cfg . T ypeSystem. GetType ( "Avalonia.Controls.RowDefinition" ) ;
RowDefinitions = cfg . T ypeSystem. GetType ( "Avalonia.Controls.RowDefinitions" ) ;
Classes = cfg . T ypeSystem. GetType ( "Avalonia.Controls.Classes" ) ;
ColumnDefinition = t ypeSystem. GetType ( "Avalonia.Controls.ColumnDefinition" ) ;
ColumnDefinitions = t ypeSystem. GetType ( "Avalonia.Controls.ColumnDefinitions" ) ;
RowDefinition = t ypeSystem. GetType ( "Avalonia.Controls.RowDefinition" ) ;
RowDefinitions = t ypeSystem. GetType ( "Avalonia.Controls.RowDefinitions" ) ;
Classes = t ypeSystem. GetType ( "Avalonia.Controls.Classes" ) ;
StyledElementClassesProperty =
StyledElement . Properties . First ( x = > x . Name = = "Classes" & & x . PropertyType . Equals ( Classes ) ) ;
ClassesBindMethod = cfg . T ypeSystem. GetType ( "Avalonia.StyledElementExtensions" )
ClassesBindMethod = t ypeSystem. GetType ( "Avalonia.StyledElementExtensions" )
. GetMethod ( "BindClass" , IDisposable , false , StyledElement ,
cfg . WellKnownTypes . String ,
BindingBase , cfg . WellKnownTypes . Object ) ;
typeSystem . WellKnownTypes . String ,
BindingBase , typeSystem . WellKnownTypes . Object ) ;
IBrush = cfg . T ypeSystem. GetType ( "Avalonia.Media.IBrush" ) ;
ImmutableSolidColorBrush = cfg . T ypeSystem. GetType ( "Avalonia.Media.Immutable.ImmutableSolidColorBrush" ) ;
IBrush = t ypeSystem. GetType ( "Avalonia.Media.IBrush" ) ;
ImmutableSolidColorBrush = t ypeSystem. GetType ( "Avalonia.Media.Immutable.ImmutableSolidColorBrush" ) ;
ImmutableSolidColorBrushConstructorColor = ImmutableSolidColorBrush . GetConstructor ( new List < IXamlType > { UInt } ) ;
TypeUtilities = cfg . T ypeSystem. GetType ( "Avalonia.Utilities.TypeUtilities" ) ;
TextDecorationCollection = cfg . T ypeSystem. GetType ( "Avalonia.Media.TextDecorationCollection" ) ;
TextDecorations = cfg . T ypeSystem. GetType ( "Avalonia.Media.TextDecorations" ) ;
TextTrimming = cfg . T ypeSystem. GetType ( "Avalonia.Media.TextTrimming" ) ;
SetterBase = cfg . T ypeSystem. GetType ( "Avalonia.Styling.SetterBase" ) ;
Setter = cfg . T ypeSystem. GetType ( "Avalonia.Styling.Setter" ) ;
IStyle = cfg . T ypeSystem. GetType ( "Avalonia.Styling.IStyle" ) ;
StyleInclude = cfg . T ypeSystem. GetType ( "Avalonia.Markup.Xaml.Styling.StyleInclude" ) ;
ResourceInclude = cfg . T ypeSystem. GetType ( "Avalonia.Markup.Xaml.Styling.ResourceInclude" ) ;
MergeResourceInclude = cfg . T ypeSystem. GetType ( "Avalonia.Markup.Xaml.Styling.MergeResourceInclude" ) ;
IResourceDictionary = cfg . T ypeSystem. GetType ( "Avalonia.Controls.IResourceDictionary" ) ;
ResourceDictionary = cfg . T ypeSystem. GetType ( "Avalonia.Controls.ResourceDictionary" ) ;
TypeUtilities = t ypeSystem. GetType ( "Avalonia.Utilities.TypeUtilities" ) ;
TextDecorationCollection = t ypeSystem. GetType ( "Avalonia.Media.TextDecorationCollection" ) ;
TextDecorations = t ypeSystem. GetType ( "Avalonia.Media.TextDecorations" ) ;
TextTrimming = t ypeSystem. GetType ( "Avalonia.Media.TextTrimming" ) ;
SetterBase = t ypeSystem. GetType ( "Avalonia.Styling.SetterBase" ) ;
Setter = t ypeSystem. GetType ( "Avalonia.Styling.Setter" ) ;
IStyle = t ypeSystem. GetType ( "Avalonia.Styling.IStyle" ) ;
StyleInclude = t ypeSystem. GetType ( "Avalonia.Markup.Xaml.Styling.StyleInclude" ) ;
ResourceInclude = t ypeSystem. GetType ( "Avalonia.Markup.Xaml.Styling.ResourceInclude" ) ;
MergeResourceInclude = t ypeSystem. GetType ( "Avalonia.Markup.Xaml.Styling.MergeResourceInclude" ) ;
IResourceDictionary = t ypeSystem. GetType ( "Avalonia.Controls.IResourceDictionary" ) ;
ResourceDictionary = t ypeSystem. GetType ( "Avalonia.Controls.ResourceDictionary" ) ;
ResourceDictionaryDeferredAdd = ResourceDictionary . GetMethod ( "AddDeferred" , XamlIlTypes . Void , true , XamlIlTypes . Object ,
cfg . T ypeSystem. GetType ( "Avalonia.Controls.IDeferredContent" ) ) ;
t ypeSystem. GetType ( "Avalonia.Controls.IDeferredContent" ) ) ;
ResourceDictionaryNotSharedDeferredAdd = ResourceDictionary . GetMethod ( "AddNotSharedDeferred" , XamlIlTypes . Void , true , XamlIlTypes . Object ,
cfg . T ypeSystem. GetType ( "Avalonia.Controls.IDeferredContent" ) ) ;
t ypeSystem. GetType ( "Avalonia.Controls.IDeferredContent" ) ) ;
ResourceDictionaryEnsureCapacity = ResourceDictionary . GetMethod ( "EnsureCapacity" , XamlIlTypes . Void , true , XamlIlTypes . Int32 ) ;
ResourceDictionaryGetCount = ResourceDictionary . GetMethod ( "get_Count" , XamlIlTypes . Int32 , true ) ;
IThemeVariantProvider = cfg . TypeSystem . GetType ( "Avalonia.Controls.IThemeVariantProvider" ) ;
UriKind = cfg . TypeSystem . GetType ( "System.UriKind" ) ;
UriConstructor = Uri . GetConstructor ( new List < IXamlType > ( ) { cfg . WellKnownTypes . String , UriKind } ) ;
Style = cfg . TypeSystem . GetType ( "Avalonia.Styling.Style" ) ;
Container = cfg . TypeSystem . GetType ( "Avalonia.Styling.ContainerQuery" ) ;
Styles = cfg . TypeSystem . GetType ( "Avalonia.Styling.Styles" ) ;
ControlTheme = cfg . TypeSystem . GetType ( "Avalonia.Styling.ControlTheme" ) ;
ControlTemplate = cfg . TypeSystem . GetType ( "Avalonia.Markup.Xaml.Templates.ControlTemplate" ) ;
IReadOnlyListOfT = cfg . TypeSystem . GetType ( "System.Collections.Generic.IReadOnlyList`1" ) ;
EventHandlerT = cfg . TypeSystem . GetType ( "System.EventHandler`1" ) ;
Interactivity = new InteractivityWellKnownTypes ( cfg ) ;
IThemeVariantProvider = typeSystem . GetType ( "Avalonia.Controls.IThemeVariantProvider" ) ;
UriKind = typeSystem . GetType ( "System.UriKind" ) ;
UriConstructor = Uri . GetConstructor ( new List < IXamlType > ( ) { typeSystem . WellKnownTypes . String , UriKind } ) ;
Style = typeSystem . GetType ( "Avalonia.Styling.Style" ) ;
Container = typeSystem . GetType ( "Avalonia.Styling.ContainerQuery" ) ;
Styles = typeSystem . GetType ( "Avalonia.Styling.Styles" ) ;
StyleQueries = typeSystem . GetType ( "Avalonia.Styling.StyleQueries" ) ;
Selectors = typeSystem . GetType ( "Avalonia.Styling.Selectors" ) ;
ControlTheme = typeSystem . GetType ( "Avalonia.Styling.ControlTheme" ) ;
ControlTemplate = typeSystem . GetType ( "Avalonia.Markup.Xaml.Templates.ControlTemplate" ) ;
IReadOnlyListOfT = typeSystem . GetType ( "System.Collections.Generic.IReadOnlyList`1" ) ;
EventHandlerT = typeSystem . GetType ( "System.EventHandler`1" ) ;
Interactivity = new InteractivityWellKnownTypes ( typeSystem , typeSystem . WellKnownTypes ) ;
GetClassProperty = cfg . TypeSystem . GetType ( "Avalonia.StyledElementExtensions" )
GetClassProperty = t ypeSystem. GetType ( "Avalonia.StyledElementExtensions" )
. GetMethod ( name : "GetClassProperty" ,
returnType : AvaloniaProperty ,
allowDowncast : false ,
cfg . WellKnownTypes . String
typeSystem . WellKnownTypes . String
) ;
var xamlSourceInfo = cfg . T ypeSystem. GetType ( "Avalonia.Markup.Xaml.Diagnostics.XamlSourceInfo" ) ;
var xamlSourceInfo = t ypeSystem. GetType ( "Avalonia.Markup.Xaml.Diagnostics.XamlSourceInfo" ) ;
XamlSourceInfoConstructor = xamlSourceInfo . GetConstructor ( [
XamlIlTypes . Int32 , XamlIlTypes . Int32 , XamlIlTypes . String
] ) ;
@ -360,28 +369,16 @@ namespace Avalonia.Markup.Xaml.XamlIl.CompilerExtensions.Transformers
static class AvaloniaXamlIlWellKnownTypesExtensions
{
public static AvaloniaXamlIlWellKnownTypes GetAvaloniaTypes ( this TransformerConfiguration cfg )
= > cfg . GetExtra < AvaloniaXamlIlWellKnownTypes > ( ) ;
public static AvaloniaXamlIlWellKnownTypes GetAvaloniaTypes ( this AstTransformationContext ctx )
{
if ( ctx . TryGetItem < AvaloniaXamlIlWellKnownTypes > ( out var rv ) )
return rv ;
ctx . SetItem ( rv = new AvaloniaXamlIlWellKnownTypes ( ctx . Configuration ) ) ;
return rv ;
}
= > ctx . Configuration . GetAvaloniaTypes ( ) ;
public static AvaloniaXamlIlWellKnownTypes GetAvaloniaTypes ( this XamlEmitContext < IXamlILEmitter , XamlILNodeEmitResult > ctx )
{
if ( ctx . TryGetItem < AvaloniaXamlIlWellKnownTypes > ( out var rv ) )
return rv ;
ctx . SetItem ( rv = new AvaloniaXamlIlWellKnownTypes ( ctx . Configuration ) ) ;
return rv ;
}
= > ctx . Configuration . GetAvaloniaTypes ( ) ;
public static AvaloniaXamlIlWellKnownTypes GetAvaloniaTypes ( this AstGroupTransformationContext ctx )
{
if ( ctx . TryGetItem < AvaloniaXamlIlWellKnownTypes > ( out var rv ) )
return rv ;
ctx . SetItem ( rv = new AvaloniaXamlIlWellKnownTypes ( ctx . Configuration ) ) ;
return rv ;
}
= > ctx . Configuration . GetAvaloniaTypes ( ) ;
}
}