Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Obsolete CompiledBindingPathBuilder.SetRawSource #16505

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -336,20 +336,4 @@ class TemplatedParentBindingExpressionNode : BindingExpressionGrammar.INode
{
public IXamlType Type { get; set; }
}

class RawSourceBindingExpressionNode : XamlAstNode, BindingExpressionGrammar.INode
{
public RawSourceBindingExpressionNode(IXamlAstValueNode rawSource)
: base(rawSource)
{
RawSource = rawSource;
}

public IXamlAstValueNode RawSource { get; private set; }

public override void VisitChildren(IXamlAstVisitor visitor)
{
RawSource = (IXamlAstValueNode)RawSource.Visit(visitor);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -325,9 +325,6 @@ private static XamlIlBindingPathNode TransformBindingPath(AstTransformationConte
}
nodes.Add(new ElementNamePathElementNode(elementName.Name, elementType));
break;
case RawSourceBindingExpressionNode rawSource:
nodes.Add(new RawSourcePathElementNode(rawSource.RawSource));
break;
case BindingExpressionGrammar.TypeCastNode typeCastNode:
var castType = GetType(typeCastNode.Namespace, typeCastNode.TypeName);

Expand Down Expand Up @@ -862,28 +859,6 @@ public void Emit(XamlIlEmitContext context, IXamlILEmitter codeGen)
public IXamlType Type => _arrayType.ArrayElementType;
}

class RawSourcePathElementNode : XamlAstNode, IXamlIlBindingPathElementNode
{
private readonly IXamlAstValueNode _rawSource;

public RawSourcePathElementNode(IXamlAstValueNode rawSource)
: base(rawSource)
{
_rawSource = rawSource;

}

public IXamlType Type => _rawSource.Type.GetClrType();

public void Emit(XamlIlEmitContext context, IXamlILEmitter codeGen)
{
context.Emit(_rawSource, codeGen, Type);
codeGen
.EmitCall(context.GetAvaloniaTypes()
.CompiledBindingPathBuilder.FindMethod(m => m.Name == "SetRawSource"));
}
}

class TypeCastPathElementNode : IXamlIlBindingPathElementNode
{
public TypeCastPathElementNode(IXamlType ancestorType)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,8 @@ public class CompiledBindingPath
public CompiledBindingPath()
=> _elements = Array.Empty<ICompiledBindingPathElement>();

internal CompiledBindingPath(ICompiledBindingPathElement[] elements, object? rawSource)
{
_elements = elements;
RawSource = rawSource;
}
internal CompiledBindingPath(ICompiledBindingPathElement[] elements)
=> _elements = elements;

internal void BuildExpression(List<ExpressionNode> result, out bool isRooted)
{
Expand Down Expand Up @@ -97,8 +94,6 @@ internal void BuildExpression(List<ExpressionNode> result, out bool isRooted)
internal SourceMode SourceMode => Array.Exists(_elements, e => e is IControlSourceBindingPathElement)
? SourceMode.Control : SourceMode.Data;

internal object? RawSource { get; }

/// <inheritdoc />
public override string ToString()
=> string.Concat((IEnumerable<ICompiledBindingPathElement>) _elements);
Expand All @@ -107,7 +102,6 @@ public override string ToString()
public class CompiledBindingPathBuilder
{
private readonly int _apiVersion;
private object? _rawSource;
private readonly List<ICompiledBindingPathElement> _elements = new();

public CompiledBindingPathBuilder()
Expand Down Expand Up @@ -210,13 +204,13 @@ public CompiledBindingPathBuilder TemplatedParent()
return this;
}

[Obsolete("This method doesn't do anything anymore. Use Binding.Source instead.")]
public CompiledBindingPathBuilder SetRawSource(object? rawSource)
{
_rawSource = rawSource;
return this;
}

public CompiledBindingPath Build() => new CompiledBindingPath(_elements.ToArray(), _rawSource);
public CompiledBindingPath Build() => new CompiledBindingPath(_elements.ToArray());
}

internal interface ICompiledBindingPathElement
Expand Down
Loading