Browse Source

fix: Remove ConstructableObjectTransformer (#13)

* Strip out the namespace
* Strip out the instantiation
* Actually strip out the transformer
pull/10407/head 0.1.3
Artyom V. Gorchakov 5 years ago
committed by GitHub
parent
commit
03b33fb9ca
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      src/XamlNameReferenceGenerator/Infrastructure/MiniCompiler.cs
  2. 6
      src/XamlNameReferenceGenerator/Infrastructure/NameReceiver.cs
  3. 9
      src/XamlNameReferenceGenerator/NameReferenceGenerator.cs

1
src/XamlNameReferenceGenerator/Infrastructure/MiniCompiler.cs

@ -32,7 +32,6 @@ namespace XamlNameReferenceGenerator.Infrastructure
Transformers.Add(new XamlIntrinsicsTransformer());
Transformers.Add(new XArgumentsTransformer());
Transformers.Add(new TypeReferenceResolver());
Transformers.Add(new ConstructableObjectTransformer());
}
protected override XamlEmitContext<object, IXamlEmitResult> InitCodeGen(

6
src/XamlNameReferenceGenerator/Infrastructure/NameReceiver.cs

@ -12,9 +12,9 @@ namespace XamlNameReferenceGenerator.Infrastructure
public IXamlAstNode Visit(IXamlAstNode node)
{
if (node is XamlAstConstructableObjectNode constructableObjectNode)
if (node is XamlAstObjectNode objectNode)
{
var clrType = constructableObjectNode.Type.GetClrType();
var clrType = objectNode.Type.GetClrType();
var isAvaloniaControl = clrType
.Interfaces
.Any(abstraction => abstraction.IsInterface &&
@ -25,7 +25,7 @@ namespace XamlNameReferenceGenerator.Infrastructure
return node;
}
foreach (var child in constructableObjectNode.Children)
foreach (var child in objectNode.Children)
{
if (child is XamlAstXamlPropertyValueNode propertyValueNode &&
propertyValueNode.Property is XamlAstNamePropertyReference namedProperty &&

9
src/XamlNameReferenceGenerator/NameReferenceGenerator.cs

@ -15,17 +15,14 @@ namespace XamlNameReferenceGenerator
[Generator]
public class NameReferenceGenerator : ISourceGenerator
{
private const string AttributeName = "Avalonia.Controls.GenerateTypedNameReferencesAttribute";
private const string AttributeName = "GenerateTypedNameReferencesAttribute";
private const string AttributeFile = "GenerateTypedNameReferencesAttribute";
private const string AttributeCode = @"// <auto-generated />
using System;
namespace Avalonia.Controls
{
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
internal sealed class GenerateTypedNameReferencesAttribute : Attribute { }
}
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
internal sealed class GenerateTypedNameReferencesAttribute : Attribute { }
";
private static readonly SymbolDisplayFormat SymbolDisplayFormat = new SymbolDisplayFormat(
typeQualificationStyle: SymbolDisplayTypeQualificationStyle.NameAndContainingTypesAndNamespaces,

Loading…
Cancel
Save