Browse Source

Removed unused field.

pull/3255/head
Steven Kirk 6 years ago
parent
commit
270f9718b8
  1. 9
      src/Avalonia.Base/PropertyStore/PriorityValue.cs
  2. 8
      src/Avalonia.Base/ValueStore.cs
  3. 21
      tests/Avalonia.Base.UnitTests/PriorityValueTests.cs

9
src/Avalonia.Base/PropertyStore/PriorityValue.cs

@ -8,27 +8,23 @@ namespace Avalonia.PropertyStore
{ {
internal class PriorityValue<T> : IValue<T>, IValueSink internal class PriorityValue<T> : IValue<T>, IValueSink
{ {
private readonly IAvaloniaObject _owner;
private readonly IValueSink _sink; private readonly IValueSink _sink;
private readonly List<IPriorityValueEntry<T>> _entries = new List<IPriorityValueEntry<T>>(); private readonly List<IPriorityValueEntry<T>> _entries = new List<IPriorityValueEntry<T>>();
private Optional<T> _localValue; private Optional<T> _localValue;
public PriorityValue( public PriorityValue(
IAvaloniaObject owner,
StyledPropertyBase<T> property, StyledPropertyBase<T> property,
IValueSink sink) IValueSink sink)
{ {
_owner = owner;
Property = property; Property = property;
_sink = sink; _sink = sink;
} }
public PriorityValue( public PriorityValue(
IAvaloniaObject owner,
StyledPropertyBase<T> property, StyledPropertyBase<T> property,
IValueSink sink, IValueSink sink,
IPriorityValueEntry<T> existing) IPriorityValueEntry<T> existing)
: this(owner, property, sink) : this(property, sink)
{ {
existing.Reparent(this); existing.Reparent(this);
_entries.Add(existing); _entries.Add(existing);
@ -41,11 +37,10 @@ namespace Avalonia.PropertyStore
} }
public PriorityValue( public PriorityValue(
IAvaloniaObject owner,
StyledPropertyBase<T> property, StyledPropertyBase<T> property,
IValueSink sink, IValueSink sink,
LocalValueEntry<T> existing) LocalValueEntry<T> existing)
: this(owner, property, sink) : this(property, sink)
{ {
_localValue = existing.Value; _localValue = existing.Value;
Value = _localValue; Value = _localValue;

8
src/Avalonia.Base/ValueStore.cs

@ -174,7 +174,7 @@ namespace Avalonia
{ {
if (slot is IPriorityValueEntry<T> e) if (slot is IPriorityValueEntry<T> e)
{ {
var priorityValue = new PriorityValue<T>(_owner, property, this, e); var priorityValue = new PriorityValue<T>(property, this, e);
_values.SetValue(property, priorityValue); _values.SetValue(property, priorityValue);
priorityValue.SetValue(value, priority); priorityValue.SetValue(value, priority);
} }
@ -192,7 +192,7 @@ namespace Avalonia
} }
else else
{ {
var priorityValue = new PriorityValue<T>(_owner, property, this, l); var priorityValue = new PriorityValue<T>(property, this, l);
_values.SetValue(property, priorityValue); _values.SetValue(property, priorityValue);
} }
} }
@ -212,7 +212,7 @@ namespace Avalonia
if (slot is IPriorityValueEntry<T> e) if (slot is IPriorityValueEntry<T> e)
{ {
priorityValue = new PriorityValue<T>(_owner, property, this, e); priorityValue = new PriorityValue<T>(property, this, e);
} }
else if (slot is PriorityValue<T> p) else if (slot is PriorityValue<T> p)
{ {
@ -220,7 +220,7 @@ namespace Avalonia
} }
else if (slot is LocalValueEntry<T> l) else if (slot is LocalValueEntry<T> l)
{ {
priorityValue = new PriorityValue<T>(_owner, property, this, l); priorityValue = new PriorityValue<T>(property, this, l);
} }
else else
{ {

21
tests/Avalonia.Base.UnitTests/PriorityValueTests.cs

@ -21,7 +21,6 @@ namespace Avalonia.Base.UnitTests
public void Constructor_Should_Set_Value_Based_On_Initial_Entry() public void Constructor_Should_Set_Value_Based_On_Initial_Entry()
{ {
var target = new PriorityValue<string>( var target = new PriorityValue<string>(
Owner,
TestProperty, TestProperty,
NullSink, NullSink,
new ConstantValueEntry<string>(TestProperty, "1", BindingPriority.StyleTrigger)); new ConstantValueEntry<string>(TestProperty, "1", BindingPriority.StyleTrigger));
@ -34,7 +33,6 @@ namespace Avalonia.Base.UnitTests
public void SetValue_LocalValue_Should_Not_Add_Entries() public void SetValue_LocalValue_Should_Not_Add_Entries()
{ {
var target = new PriorityValue<string>( var target = new PriorityValue<string>(
Owner,
TestProperty, TestProperty,
NullSink); NullSink);
@ -48,7 +46,6 @@ namespace Avalonia.Base.UnitTests
public void SetValue_Non_LocalValue_Should_Add_Entries() public void SetValue_Non_LocalValue_Should_Add_Entries()
{ {
var target = new PriorityValue<string>( var target = new PriorityValue<string>(
Owner,
TestProperty, TestProperty,
NullSink); NullSink);
@ -66,7 +63,7 @@ namespace Avalonia.Base.UnitTests
[Fact] [Fact]
public void Binding_With_Same_Priority_Should_Be_Appended() public void Binding_With_Same_Priority_Should_Be_Appended()
{ {
var target = new PriorityValue<string>(Owner, TestProperty, NullSink); var target = new PriorityValue<string>(TestProperty, NullSink);
var source1 = new Source("1"); var source1 = new Source("1");
var source2 = new Source("2"); var source2 = new Source("2");
@ -86,7 +83,7 @@ namespace Avalonia.Base.UnitTests
[Fact] [Fact]
public void Binding_With_Higher_Priority_Should_Be_Appended() public void Binding_With_Higher_Priority_Should_Be_Appended()
{ {
var target = new PriorityValue<string>(Owner, TestProperty, NullSink); var target = new PriorityValue<string>(TestProperty, NullSink);
var source1 = new Source("1"); var source1 = new Source("1");
var source2 = new Source("2"); var source2 = new Source("2");
@ -106,7 +103,7 @@ namespace Avalonia.Base.UnitTests
[Fact] [Fact]
public void Binding_With_Lower_Priority_Should_Be_Prepended() public void Binding_With_Lower_Priority_Should_Be_Prepended()
{ {
var target = new PriorityValue<string>(Owner, TestProperty, NullSink); var target = new PriorityValue<string>(TestProperty, NullSink);
var source1 = new Source("1"); var source1 = new Source("1");
var source2 = new Source("2"); var source2 = new Source("2");
@ -126,7 +123,7 @@ namespace Avalonia.Base.UnitTests
[Fact] [Fact]
public void Second_Binding_With_Lower_Priority_Should_Be_Inserted_In_Middle() public void Second_Binding_With_Lower_Priority_Should_Be_Inserted_In_Middle()
{ {
var target = new PriorityValue<string>(Owner, TestProperty, NullSink); var target = new PriorityValue<string>(TestProperty, NullSink);
var source1 = new Source("1"); var source1 = new Source("1");
var source2 = new Source("2"); var source2 = new Source("2");
var source3 = new Source("3"); var source3 = new Source("3");
@ -148,7 +145,7 @@ namespace Avalonia.Base.UnitTests
[Fact] [Fact]
public void Competed_Binding_Should_Be_Removed() public void Competed_Binding_Should_Be_Removed()
{ {
var target = new PriorityValue<string>(Owner, TestProperty, NullSink); var target = new PriorityValue<string>(TestProperty, NullSink);
var source1 = new Source("1"); var source1 = new Source("1");
var source2 = new Source("2"); var source2 = new Source("2");
var source3 = new Source("3"); var source3 = new Source("3");
@ -171,7 +168,7 @@ namespace Avalonia.Base.UnitTests
[Fact] [Fact]
public void Value_Should_Come_From_Last_Entry() public void Value_Should_Come_From_Last_Entry()
{ {
var target = new PriorityValue<string>(Owner, TestProperty, NullSink); var target = new PriorityValue<string>(TestProperty, NullSink);
var source1 = new Source("1"); var source1 = new Source("1");
var source2 = new Source("2"); var source2 = new Source("2");
var source3 = new Source("3"); var source3 = new Source("3");
@ -186,7 +183,7 @@ namespace Avalonia.Base.UnitTests
[Fact] [Fact]
public void LocalValue_Should_Override_LocalValue_Binding() public void LocalValue_Should_Override_LocalValue_Binding()
{ {
var target = new PriorityValue<string>(Owner, TestProperty, NullSink); var target = new PriorityValue<string>(TestProperty, NullSink);
var source1 = new Source("1"); var source1 = new Source("1");
target.AddBinding(source1, BindingPriority.LocalValue).Start(); target.AddBinding(source1, BindingPriority.LocalValue).Start();
@ -198,7 +195,7 @@ namespace Avalonia.Base.UnitTests
[Fact] [Fact]
public void LocalValue_Should_Override_Style_Binding() public void LocalValue_Should_Override_Style_Binding()
{ {
var target = new PriorityValue<string>(Owner, TestProperty, NullSink); var target = new PriorityValue<string>(TestProperty, NullSink);
var source1 = new Source("1"); var source1 = new Source("1");
target.AddBinding(source1, BindingPriority.Style).Start(); target.AddBinding(source1, BindingPriority.Style).Start();
@ -210,7 +207,7 @@ namespace Avalonia.Base.UnitTests
[Fact] [Fact]
public void LocalValue_Should_Not_Override_Animation_Binding() public void LocalValue_Should_Not_Override_Animation_Binding()
{ {
var target = new PriorityValue<string>(Owner, TestProperty, NullSink); var target = new PriorityValue<string>(TestProperty, NullSink);
var source1 = new Source("1"); var source1 = new Source("1");
target.AddBinding(source1, BindingPriority.Animation).Start(); target.AddBinding(source1, BindingPriority.Animation).Start();

Loading…
Cancel
Save