Skip to content

Commit 43543b9

Browse files
committed
fix EvilBeaver#1582: общий интерфейс для сравнимых
1 parent 3845405 commit 43543b9

File tree

6 files changed

+19
-6
lines changed

6 files changed

+19
-6
lines changed

src/OneScript.Core/Values/BslBooleanValue.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ This Source Code Form is subject to the terms of the
1212

1313
namespace OneScript.Values
1414
{
15-
public sealed class BslBooleanValue : BslPrimitiveValue
15+
public sealed class BslBooleanValue : BslPrimitiveValue, IBslComparable
1616
{
1717
public static readonly BslBooleanValue True = new BslBooleanValue(true);
1818
public static readonly BslBooleanValue False = new BslBooleanValue(false);

src/OneScript.Core/Values/BslDateValue.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ This Source Code Form is subject to the terms of the
1212

1313
namespace OneScript.Values
1414
{
15-
public sealed class BslDateValue : BslPrimitiveValue
15+
public sealed class BslDateValue : BslPrimitiveValue, IBslComparable
1616
{
1717
private readonly DateTime _value;
1818

src/OneScript.Core/Values/BslNumericValue.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ This Source Code Form is subject to the terms of the
1414

1515
namespace OneScript.Values
1616
{
17-
public sealed class BslNumericValue : BslPrimitiveValue, IEquatable<BslNumericValue>
17+
public sealed class BslNumericValue : BslPrimitiveValue, IEquatable<BslNumericValue>, IBslComparable
1818
{
1919
private static readonly BslNumericValue[] _popularValues = new BslNumericValue[10];
2020
static BslNumericValue()

src/OneScript.Core/Values/BslStringValue.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ This Source Code Form is subject to the terms of the
1010

1111
namespace OneScript.Values
1212
{
13-
public sealed class BslStringValue : BslPrimitiveValue
13+
public sealed class BslStringValue : BslPrimitiveValue, IBslComparable
1414
{
1515
private readonly string _value;
1616

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/*----------------------------------------------------------
2+
This Source Code Form is subject to the terms of the
3+
Mozilla Public License, v.2.0. If a copy of the MPL
4+
was not distributed with this file, You can obtain one
5+
at http://mozilla.org/MPL/2.0/.
6+
----------------------------------------------------------*/
7+
8+
namespace OneScript.Values
9+
{
10+
public interface IBslComparable
11+
{
12+
}
13+
}

src/ScriptEngine/Machine/GenericIValueComparer.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@ public int Compare(IValue x, IValue y)
6666
{
6767
if (ReferenceEquals(x, y))
6868
return 0;
69-
70-
if (x is IComparable && x.SystemType == y.SystemType )
69+
70+
if (x is IBslComparable && x.SystemType == y.SystemType )
7171
return x.CompareTo(y);
7272
else
7373
return _comparer(x,y);

0 commit comments

Comments
 (0)