diff --git a/src/Avalonia.Build.Tasks/Avalonia.Build.Tasks.csproj b/src/Avalonia.Build.Tasks/Avalonia.Build.Tasks.csproj
index 582e4499c5..49e793cfda 100644
--- a/src/Avalonia.Build.Tasks/Avalonia.Build.Tasks.csproj
+++ b/src/Avalonia.Build.Tasks/Avalonia.Build.Tasks.csproj
@@ -21,10 +21,10 @@
XamlIlExtensions/%(RecursiveDir)%(FileName)%(Extension)
-
+
XamlIl/%(RecursiveDir)%(FileName)%(Extension)
-
+
XamlIl.Cecil/%(RecursiveDir)%(FileName)%(Extension)
@@ -44,7 +44,7 @@
-
+
diff --git a/src/Avalonia.Build.Tasks/XamlCompilerTaskExecutor.Helpers.cs b/src/Avalonia.Build.Tasks/XamlCompilerTaskExecutor.Helpers.cs
index f94f10f792..5a2c74e16f 100644
--- a/src/Avalonia.Build.Tasks/XamlCompilerTaskExecutor.Helpers.cs
+++ b/src/Avalonia.Build.Tasks/XamlCompilerTaskExecutor.Helpers.cs
@@ -5,7 +5,7 @@ using Avalonia.Utilities;
using Mono.Cecil;
using Mono.Cecil.Cil;
using Mono.Collections.Generic;
-using XamlIl.TypeSystem;
+using XamlX.TypeSystem;
namespace Avalonia.Build.Tasks
{
diff --git a/src/Avalonia.Build.Tasks/XamlCompilerTaskExecutor.cs b/src/Avalonia.Build.Tasks/XamlCompilerTaskExecutor.cs
index 30e8f120d7..b8e521100d 100644
--- a/src/Avalonia.Build.Tasks/XamlCompilerTaskExecutor.cs
+++ b/src/Avalonia.Build.Tasks/XamlCompilerTaskExecutor.cs
@@ -7,17 +7,18 @@ using System.Text;
using Avalonia.Markup.Xaml.XamlIl.CompilerExtensions;
using Microsoft.Build.Framework;
using Mono.Cecil;
-using XamlIl.TypeSystem;
using Avalonia.Utilities;
using Mono.Cecil.Cil;
using Mono.Cecil.Rocks;
-using XamlIl;
-using XamlIl.Ast;
-using XamlIl.Parsers;
-using XamlIl.Transform;
+using XamlX;
+using XamlX.Ast;
+using XamlX.Parsers;
+using XamlX.Transform;
+using XamlX.TypeSystem;
using FieldAttributes = Mono.Cecil.FieldAttributes;
using MethodAttributes = Mono.Cecil.MethodAttributes;
using TypeAttributes = Mono.Cecil.TypeAttributes;
+using XamlX.IL;
namespace Avalonia.Build.Tasks
{
@@ -51,11 +52,11 @@ namespace Avalonia.Build.Tasks
// Nothing to do
return new CompileResult(true);
- var xamlLanguage = AvaloniaXamlIlLanguage.Configure(typeSystem);
- var compilerConfig = new XamlIlTransformerConfiguration(typeSystem,
+ var (xamlLanguage , emitConfig) = AvaloniaXamlIlLanguage.Configure(typeSystem);
+ var compilerConfig = new TransformerConfiguration(typeSystem,
typeSystem.TargetAssembly,
xamlLanguage,
- XamlIlXmlnsMappings.Resolve(typeSystem, xamlLanguage),
+ XamlXmlnsMappings.Resolve(typeSystem, xamlLanguage),
AvaloniaXamlIlLanguage.CustomValueConverter);
@@ -63,10 +64,10 @@ namespace Avalonia.Build.Tasks
TypeAttributes.Class, asm.MainModule.TypeSystem.Object);
asm.MainModule.Types.Add(contextDef);
- var contextClass = XamlIlContextDefinition.GenerateContextClass(typeSystem.CreateTypeBuilder(contextDef), typeSystem,
- xamlLanguage);
+ var contextClass = XamlILContextDefinition.GenerateContextClass(typeSystem.CreateTypeBuilder(contextDef), typeSystem,
+ xamlLanguage, emitConfig);
- var compiler = new AvaloniaXamlIlCompiler(compilerConfig, contextClass) { EnableIlVerification = verifyIl };
+ var compiler = new AvaloniaXamlIlCompiler(compilerConfig, emitConfig, contextClass) { EnableIlVerification = verifyIl };
var editorBrowsableAttribute = typeSystem
.GetTypeReference(typeSystem.FindType("System.ComponentModel.EditorBrowsableAttribute"))
@@ -126,35 +127,35 @@ namespace Avalonia.Build.Tasks
// StreamReader is needed here to handle BOM
var xaml = new StreamReader(new MemoryStream(res.FileContents)).ReadToEnd();
- var parsed = XDocumentXamlIlParser.Parse(xaml);
+ var parsed = XDocumentXamlParser.Parse(xaml);
- var initialRoot = (XamlIlAstObjectNode)parsed.Root;
+ var initialRoot = (XamlAstObjectNode)parsed.Root;
- var precompileDirective = initialRoot.Children.OfType()
+ var precompileDirective = initialRoot.Children.OfType()
.FirstOrDefault(d => d.Namespace == XamlNamespaces.Xaml2006 && d.Name == "Precompile");
if (precompileDirective != null)
{
- var precompileText = (precompileDirective.Values[0] as XamlIlAstTextNode)?.Text.Trim()
+ var precompileText = (precompileDirective.Values[0] as XamlAstTextNode)?.Text.Trim()
.ToLowerInvariant();
if (precompileText == "false")
continue;
if (precompileText != "true")
- throw new XamlIlParseException("Invalid value for x:Precompile", precompileDirective);
+ throw new XamlParseException("Invalid value for x:Precompile", precompileDirective);
}
- var classDirective = initialRoot.Children.OfType()
+ var classDirective = initialRoot.Children.OfType()
.FirstOrDefault(d => d.Namespace == XamlNamespaces.Xaml2006 && d.Name == "Class");
- IXamlIlType classType = null;
+ IXamlType classType = null;
if (classDirective != null)
{
- if (classDirective.Values.Count != 1 || !(classDirective.Values[0] is XamlIlAstTextNode tn))
- throw new XamlIlParseException("x:Class should have a string value", classDirective);
+ if (classDirective.Values.Count != 1 || !(classDirective.Values[0] is XamlAstTextNode tn))
+ throw new XamlParseException("x:Class should have a string value", classDirective);
classType = typeSystem.TargetAssembly.FindType(tn.Text);
if (classType == null)
- throw new XamlIlParseException($"Unable to find type `{tn.Text}`", classDirective);
+ throw new XamlParseException($"Unable to find type `{tn.Text}`", classDirective);
compiler.OverrideRootType(parsed,
- new XamlIlAstClrTypeReference(classDirective, classType, false));
+ new XamlAstClrTypeReference(classDirective, classType, false));
initialRoot.Children.Remove(classDirective);
}
@@ -323,7 +324,7 @@ namespace Avalonia.Build.Tasks
catch (Exception e)
{
int lineNumber = 0, linePosition = 0;
- if (e is XamlIlParseException xe)
+ if (e is XamlParseException xe)
{
lineNumber = xe.LineNumber;
linePosition = xe.LinePosition;
diff --git a/src/Markup/Avalonia.Markup.Xaml/Avalonia.Markup.Xaml.csproj b/src/Markup/Avalonia.Markup.Xaml/Avalonia.Markup.Xaml.csproj
index 985a6b9f5a..48f4b75e90 100644
--- a/src/Markup/Avalonia.Markup.Xaml/Avalonia.Markup.Xaml.csproj
+++ b/src/Markup/Avalonia.Markup.Xaml/Avalonia.Markup.Xaml.csproj
@@ -58,8 +58,8 @@
-
-
+
+
diff --git a/src/Markup/Avalonia.Markup.Xaml/XamlIl/AvaloniaXamlIlRuntimeCompiler.cs b/src/Markup/Avalonia.Markup.Xaml/XamlIl/AvaloniaXamlIlRuntimeCompiler.cs
index 5a5da518d0..88da8dcc9e 100644
--- a/src/Markup/Avalonia.Markup.Xaml/XamlIl/AvaloniaXamlIlRuntimeCompiler.cs
+++ b/src/Markup/Avalonia.Markup.Xaml/XamlIl/AvaloniaXamlIlRuntimeCompiler.cs
@@ -10,12 +10,15 @@ using System.Runtime.InteropServices;
using Avalonia.Markup.Xaml.XamlIl.CompilerExtensions;
using Avalonia.Markup.Xaml.XamlIl.Runtime;
using Avalonia.Platform;
-using XamlIl.Transform;
-using XamlIl.TypeSystem;
+using XamlX.Transform;
+using XamlX.TypeSystem;
+using XamlX.IL;
+using XamlX.Emit;
#if RUNTIME_XAML_CECIL
using TypeAttributes = Mono.Cecil.TypeAttributes;
using Mono.Cecil;
-using XamlIl.Ast;
+using XamlX.Ast;
+using XamlX.IL.Cecil;
#endif
namespace Avalonia.Markup.Xaml.XamlIl
{
@@ -24,9 +27,10 @@ namespace Avalonia.Markup.Xaml.XamlIl
#if !RUNTIME_XAML_CECIL
private static SreTypeSystem _sreTypeSystem;
private static ModuleBuilder _sreBuilder;
- private static IXamlIlType _sreContextType;
- private static XamlIlLanguageTypeMappings _sreMappings;
- private static XamlIlXmlnsMappings _sreXmlns;
+ private static IXamlType _sreContextType;
+ private static XamlLanguageTypeMappings _sreMappings;
+ private static XamlLanguageEmitMappings _sreEmitMappings;
+ private static XamlXmlnsMappings _sreXmlns;
private static AssemblyBuilder _sreAsm;
private static bool _sreCanSave;
@@ -82,13 +86,14 @@ namespace Avalonia.Markup.Xaml.XamlIl
}
if (_sreMappings == null)
- _sreMappings = AvaloniaXamlIlLanguage.Configure(_sreTypeSystem);
+ (_sreMappings, _sreEmitMappings) = AvaloniaXamlIlLanguage.Configure(_sreTypeSystem);
if (_sreXmlns == null)
- _sreXmlns = XamlIlXmlnsMappings.Resolve(_sreTypeSystem, _sreMappings);
+ _sreXmlns = XamlXmlnsMappings.Resolve(_sreTypeSystem, _sreMappings);
if (_sreContextType == null)
- _sreContextType = XamlIlContextDefinition.GenerateContextClass(
+ _sreContextType = XamlILContextDefinition.GenerateContextClass(
_sreTypeSystem.CreateTypeBuilder(
- _sreBuilder.DefineType("XamlIlContext")), _sreTypeSystem, _sreMappings);
+ _sreBuilder.DefineType("XamlIlContext")), _sreTypeSystem, _sreMappings,
+ _sreEmitMappings);
}
@@ -115,12 +120,13 @@ namespace Avalonia.Markup.Xaml.XamlIl
InitializeSre();
var asm = localAssembly == null ? null : _sreTypeSystem.GetAssembly(localAssembly);
- var compiler = new AvaloniaXamlIlCompiler(new XamlIlTransformerConfiguration(_sreTypeSystem, asm,
+ var compiler = new AvaloniaXamlIlCompiler(new TransformerConfiguration(_sreTypeSystem, asm,
_sreMappings, _sreXmlns, AvaloniaXamlIlLanguage.CustomValueConverter),
+ _sreEmitMappings,
_sreContextType) { EnableIlVerification = true };
var tb = _sreBuilder.DefineType("Builder_" + Guid.NewGuid().ToString("N") + "_" + uri);
- IXamlIlType overrideType = null;
+ IXamlType overrideType = null;
if (rootInstance != null)
{
overrideType = _sreTypeSystem.GetType(rootInstance.GetType());
@@ -203,6 +209,7 @@ namespace Avalonia.Markup.Xaml.XamlIl
private static string _cecilEmitDir;
private static CecilTypeSystem _cecilTypeSystem;
private static XamlIlLanguageTypeMappings _cecilMappings;
+ private static XamlLanguageEmitMappings _cecilEmitMappings;
private static XamlIlXmlnsMappings _cecilXmlns;
private static bool _cecilInitialized;
@@ -215,7 +222,7 @@ namespace Avalonia.Markup.Xaml.XamlIl
Directory.CreateDirectory(_cecilEmitDir);
var refs = new[] {path}.Concat(File.ReadAllLines(path + ".refs"));
_cecilTypeSystem = new CecilTypeSystem(refs);
- _cecilMappings = AvaloniaXamlIlLanguage.Configure(_cecilTypeSystem);
+ (_cecilMappings, _cecilEmitMappings) = AvaloniaXamlIlLanguage.Configure(_cecilTypeSystem);
_cecilXmlns = XamlIlXmlnsMappings.Resolve(_cecilTypeSystem, _cecilMappings);
_cecilInitialized = true;
}
@@ -226,7 +233,7 @@ namespace Avalonia.Markup.Xaml.XamlIl
if (uri == null)
throw new InvalidOperationException("Please, go away");
InitializeCecil();
- IXamlIlType overrideType = null;
+ IXamlType overrideType = null;
if (rootInstance != null)
{
overrideType = _cecilTypeSystem.GetType(rootInstance.GetType().FullName);
@@ -261,6 +268,7 @@ namespace Avalonia.Markup.Xaml.XamlIl
localAssembly == null ? null : _cecilTypeSystem.FindAssembly(localAssembly.GetName().Name),
_cecilMappings, XamlIlXmlnsMappings.Resolve(_cecilTypeSystem, _cecilMappings),
AvaloniaXamlIlLanguage.CustomValueConverter),
+ _cecilEmitMappings,
_cecilTypeSystem.CreateTypeBuilder(contextDef));
compiler.ParseAndCompile(xaml, uri.ToString(), tb, overrideType);
var asmPath = Path.Combine(_cecilEmitDir, safeUri + ".dll");
diff --git a/src/Markup/Avalonia.Markup.Xaml/XamlIl/CompilerExtensions/AvaloniaXamlIlCompiler.cs b/src/Markup/Avalonia.Markup.Xaml/XamlIl/CompilerExtensions/AvaloniaXamlIlCompiler.cs
index b84f50fa8d..1e7128e75c 100644
--- a/src/Markup/Avalonia.Markup.Xaml/XamlIl/CompilerExtensions/AvaloniaXamlIlCompiler.cs
+++ b/src/Markup/Avalonia.Markup.Xaml/XamlIl/CompilerExtensions/AvaloniaXamlIlCompiler.cs
@@ -1,29 +1,32 @@
using System.Collections.Generic;
using System.Linq;
using Avalonia.Markup.Xaml.XamlIl.CompilerExtensions.Transformers;
-using XamlIl;
-using XamlIl.Ast;
-using XamlIl.Parsers;
-using XamlIl.Transform;
-using XamlIl.Transform.Transformers;
-using XamlIl.TypeSystem;
+using XamlX;
+using XamlX.Ast;
+using XamlX.Emit;
+using XamlX.IL;
+using XamlX.Parsers;
+using XamlX.Transform;
+using XamlX.Transform.Transformers;
+using XamlX.TypeSystem;
namespace Avalonia.Markup.Xaml.XamlIl.CompilerExtensions
{
- class AvaloniaXamlIlCompiler : XamlIlCompiler
+ class AvaloniaXamlIlCompiler : XamlILCompiler
{
- private readonly XamlIlTransformerConfiguration _configuration;
- private readonly IXamlIlType _contextType;
+ private readonly TransformerConfiguration _configuration;
+ private readonly IXamlType _contextType;
private readonly AvaloniaXamlIlDesignPropertiesTransformer _designTransformer;
- private AvaloniaXamlIlCompiler(XamlIlTransformerConfiguration configuration) : base(configuration, true)
+ private AvaloniaXamlIlCompiler(TransformerConfiguration configuration, XamlLanguageEmitMappings emitMappings)
+ : base(configuration, emitMappings, true)
{
_configuration = configuration;
- void InsertAfter(params IXamlIlAstTransformer[] t)
+ void InsertAfter(params IXamlAstTransformer[] t)
=> Transformers.InsertRange(Transformers.FindIndex(x => x is T) + 1, t);
- void InsertBefore(params IXamlIlAstTransformer[] t)
+ void InsertBefore(params IXamlAstTransformer[] t)
=> Transformers.InsertRange(Transformers.FindIndex(x => x is T), t);
@@ -37,12 +40,12 @@ namespace Avalonia.Markup.Xaml.XamlIl.CompilerExtensions
// Targeted
- InsertBefore(new AvaloniaXamlIlTransformInstanceAttachedProperties());
- InsertAfter(new AvaloniaXamlIlAvaloniaPropertyResolver());
+ InsertBefore(new AvaloniaXamlIlTransformInstanceAttachedProperties());
+ InsertAfter(new AvaloniaXamlIlAvaloniaPropertyResolver());
- InsertBefore(
+ InsertBefore(
new AvaloniaXamlIlSelectorTransformer(),
new AvaloniaXamlIlSetterTransformer(),
new AvaloniaXamlIlControlTemplateTargetTypeMetadataTransformer(),
@@ -55,17 +58,21 @@ namespace Avalonia.Markup.Xaml.XamlIl.CompilerExtensions
Transformers.Add(new AddNameScopeRegistration());
Transformers.Add(new AvaloniaXamlIlMetadataRemover());
+ Emitters.Add(new AvaloniaNameScopeRegistrationXamlIlNodeEmitter());
}
- public AvaloniaXamlIlCompiler(XamlIlTransformerConfiguration configuration,
- IXamlIlTypeBuilder contextTypeBuilder) : this(configuration)
+ public AvaloniaXamlIlCompiler(TransformerConfiguration configuration,
+ XamlLanguageEmitMappings emitMappings,
+ IXamlTypeBuilder contextTypeBuilder)
+ : this(configuration, emitMappings)
{
_contextType = CreateContextType(contextTypeBuilder);
}
- public AvaloniaXamlIlCompiler(XamlIlTransformerConfiguration configuration,
- IXamlIlType contextType) : this(configuration)
+ public AvaloniaXamlIlCompiler(TransformerConfiguration configuration,
+ XamlLanguageEmitMappings emitMappings,
+ IXamlType contextType) : this(configuration, emitMappings)
{
_contextType = contextType;
}
@@ -79,37 +86,35 @@ namespace Avalonia.Markup.Xaml.XamlIl.CompilerExtensions
set => _designTransformer.IsDesignMode = value;
}
- public void ParseAndCompile(string xaml, string baseUri, IFileSource fileSource, IXamlIlTypeBuilder tb, IXamlIlType overrideRootType)
+ public void ParseAndCompile(string xaml, string baseUri, IFileSource fileSource, IXamlTypeBuilder tb, IXamlType overrideRootType)
{
- var parsed = XDocumentXamlIlParser.Parse(xaml, new Dictionary
+ var parsed = XDocumentXamlParser.Parse(xaml, new Dictionary
{
{XamlNamespaces.Blend2008, XamlNamespaces.Blend2008}
});
- var rootObject = (XamlIlAstObjectNode)parsed.Root;
+ var rootObject = (XamlAstObjectNode)parsed.Root;
var classDirective = rootObject.Children
- .OfType().FirstOrDefault(x =>
+ .OfType().FirstOrDefault(x =>
x.Namespace == XamlNamespaces.Xaml2006
&& x.Name == "Class");
var rootType =
classDirective != null ?
- new XamlIlAstClrTypeReference(classDirective,
- _configuration.TypeSystem.GetType(((XamlIlAstTextNode)classDirective.Values[0]).Text),
+ new XamlAstClrTypeReference(classDirective,
+ _configuration.TypeSystem.GetType(((XamlAstTextNode)classDirective.Values[0]).Text),
false) :
- XamlIlTypeReferenceResolver.ResolveType(CreateTransformationContext(parsed, true),
- (XamlIlAstXmlTypeReference)rootObject.Type, true);
+ TypeReferenceResolver.ResolveType(CreateTransformationContext(parsed, true),
+ (XamlAstXmlTypeReference)rootObject.Type, true);
if (overrideRootType != null)
{
-
-
if (!rootType.Type.IsAssignableFrom(overrideRootType))
- throw new XamlIlLoadException(
+ throw new XamlX.XamlLoadException(
$"Unable to substitute {rootType.Type.GetFqn()} with {overrideRootType.GetFqn()}", rootObject);
- rootType = new XamlIlAstClrTypeReference(rootObject, overrideRootType, false);
+ rootType = new XamlAstClrTypeReference(rootObject, overrideRootType, false);
}
OverrideRootType(parsed, rootType);
@@ -119,17 +124,17 @@ namespace Avalonia.Markup.Xaml.XamlIl.CompilerExtensions
}
- public void OverrideRootType(XamlIlDocument doc, IXamlIlAstTypeReference newType)
+ public void OverrideRootType(XamlDocument doc, IXamlAstTypeReference newType)
{
- var root = (XamlIlAstObjectNode)doc.Root;
+ var root = (XamlAstObjectNode)doc.Root;
var oldType = root.Type;
if (oldType.Equals(newType))
return;
root.Type = newType;
- foreach (var child in root.Children.OfType())
+ foreach (var child in root.Children.OfType())
{
- if (child.Property is XamlIlAstNamePropertyReference prop)
+ if (child.Property is XamlAstNamePropertyReference prop)
{
if (prop.DeclaringType.Equals(oldType))
prop.DeclaringType = newType;
diff --git a/src/Markup/Avalonia.Markup.Xaml/XamlIl/CompilerExtensions/AvaloniaXamlIlLanguage.cs b/src/Markup/Avalonia.Markup.Xaml/XamlIl/CompilerExtensions/AvaloniaXamlIlLanguage.cs
index a1fe6976b7..e1e360cd37 100644
--- a/src/Markup/Avalonia.Markup.Xaml/XamlIl/CompilerExtensions/AvaloniaXamlIlLanguage.cs
+++ b/src/Markup/Avalonia.Markup.Xaml/XamlIl/CompilerExtensions/AvaloniaXamlIlLanguage.cs
@@ -2,10 +2,12 @@ using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using Avalonia.Markup.Xaml.XamlIl.CompilerExtensions.Transformers;
-using XamlIl;
-using XamlIl.Ast;
-using XamlIl.Transform;
-using XamlIl.TypeSystem;
+using XamlX;
+using XamlX.Ast;
+using XamlX.Emit;
+using XamlX.IL;
+using XamlX.Transform;
+using XamlX.TypeSystem;
namespace Avalonia.Markup.Xaml.XamlIl.CompilerExtensions
{
@@ -17,12 +19,12 @@ namespace Avalonia.Markup.Xaml.XamlIl.CompilerExtensions
class AvaloniaXamlIlLanguage
{
- public static XamlIlLanguageTypeMappings Configure(IXamlIlTypeSystem typeSystem)
+ public static (XamlLanguageTypeMappings language, XamlLanguageEmitMappings emit) Configure(IXamlTypeSystem typeSystem)
{
var runtimeHelpers = typeSystem.GetType("Avalonia.Markup.Xaml.XamlIl.Runtime.XamlIlRuntimeHelpers");
var assignBindingAttribute = typeSystem.GetType("Avalonia.Data.AssignBindingAttribute");
var bindingType = typeSystem.GetType("Avalonia.Data.IBinding");
- var rv = new XamlIlLanguageTypeMappings(typeSystem)
+ var rv = new XamlLanguageTypeMappings(typeSystem)
{
SupportInitialize = typeSystem.GetType("System.ComponentModel.ISupportInitialize"),
XmlnsAttributes =
@@ -51,18 +53,22 @@ namespace Avalonia.Markup.Xaml.XamlIl.CompilerExtensions
},
InnerServiceProviderFactoryMethod =
runtimeHelpers.FindMethod(m => m.Name == "CreateInnerServiceProviderV1"),
- ProvideValueTargetPropertyEmitter = XamlIlAvaloniaPropertyHelper.Emit,
};
rv.CustomAttributeResolver = new AttributeResolver(typeSystem, rv);
- rv.ContextTypeBuilderCallback = (b, c) => EmitNameScopeField(rv, typeSystem, b, c);
- return rv;
+
+ var emit = new XamlLanguageEmitMappings
+ {
+ ProvideValueTargetPropertyEmitter = XamlIlAvaloniaPropertyHelper.Emit,
+ ContextTypeBuilderCallback = (b, c) => EmitNameScopeField(rv, typeSystem, b, c)
+ };
+ return (rv, emit);
}
public const string ContextNameScopeFieldName = "AvaloniaNameScope";
- private static void EmitNameScopeField(XamlIlLanguageTypeMappings mappings,
- IXamlIlTypeSystem typeSystem,
- IXamlIlTypeBuilder typebuilder, IXamlIlEmitter constructor)
+ private static void EmitNameScopeField(XamlLanguageTypeMappings mappings,
+ IXamlTypeSystem typeSystem,
+ IXamlTypeBuilder typebuilder, IXamlILEmitter constructor)
{
var nameScopeType = typeSystem.FindType("Avalonia.Controls.INameScope");
@@ -78,23 +84,23 @@ namespace Avalonia.Markup.Xaml.XamlIl.CompilerExtensions
}
- class AttributeResolver : IXamlIlCustomAttributeResolver
+ class AttributeResolver : IXamlCustomAttributeResolver
{
- private readonly IXamlIlType _typeConverterAttribute;
+ private readonly IXamlType _typeConverterAttribute;
- private readonly List> _converters =
- new List>();
+ private readonly List> _converters =
+ new List>();
- private readonly IXamlIlType _avaloniaList;
- private readonly IXamlIlType _avaloniaListConverter;
+ private readonly IXamlType _avaloniaList;
+ private readonly IXamlType _avaloniaListConverter;
- public AttributeResolver(IXamlIlTypeSystem typeSystem, XamlIlLanguageTypeMappings mappings)
+ public AttributeResolver(IXamlTypeSystem typeSystem, XamlLanguageTypeMappings mappings)
{
_typeConverterAttribute = mappings.TypeConverterAttributes.First();
- void AddType(IXamlIlType type, IXamlIlType conv)
- => _converters.Add(new KeyValuePair(type, conv));
+ void AddType(IXamlType type, IXamlType conv)
+ => _converters.Add(new KeyValuePair(type, conv));
void Add(string type, string conv)
=> AddType(typeSystem.GetType(type), typeSystem.GetType(conv));
@@ -113,7 +119,7 @@ namespace Avalonia.Markup.Xaml.XamlIl.CompilerExtensions
_avaloniaListConverter = typeSystem.GetType("Avalonia.Collections.AvaloniaListConverter`1");
}
- IXamlIlType LookupConverter(IXamlIlType type)
+ IXamlType LookupConverter(IXamlType type)
{
foreach(var p in _converters)
if (p.Key.Equals(type))
@@ -123,15 +129,15 @@ namespace Avalonia.Markup.Xaml.XamlIl.CompilerExtensions
return null;
}
- class ConstructedAttribute : IXamlIlCustomAttribute
+ class ConstructedAttribute : IXamlCustomAttribute
{
- public bool Equals(IXamlIlCustomAttribute other) => false;
+ public bool Equals(IXamlCustomAttribute other) => false;
- public IXamlIlType Type { get; }
+ public IXamlType Type { get; }
public List