Skip to content

Commit e31a9a5

Browse files
committed
Move UnwrapUnary to ParameterTypeLocator as it is too specific
1 parent b4888b7 commit e31a9a5

File tree

2 files changed

+16
-17
lines changed

2 files changed

+16
-17
lines changed

src/NHibernate/Linq/Visitors/ParameterTypeLocator.cs

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
using Remotion.Linq.Clauses.Expressions;
1414
using Remotion.Linq.Clauses.ResultOperators;
1515
using Remotion.Linq.Parsing;
16-
using static NHibernate.Util.ExpressionsHelper;
1716

1817
namespace NHibernate.Linq.Visitors
1918
{
@@ -137,7 +136,7 @@ private static HashSet<IType> GetCandidateTypes(
137136
// or precision when having a DecimalType.
138137
foreach (var relatedExpression in parameterRelatedExpressions)
139138
{
140-
if (TryGetMappedType(sessionFactory, relatedExpression, out var candidateType, out _, out _, out _))
139+
if (ExpressionsHelper.TryGetMappedType(sessionFactory, relatedExpression, out var candidateType, out _, out _, out _))
141140
{
142141
if (candidateType.IsAssociationType && visitor.SequenceSelectorExpressions.Contains(relatedExpression))
143142
{
@@ -434,5 +433,20 @@ private bool IsDynamicMember(Expression expression)
434433
}
435434
}
436435
}
436+
437+
/// <summary>
438+
/// Unwraps <see cref="System.Linq.Expressions.UnaryExpression"/>.
439+
/// </summary>
440+
/// <param name="expression">The expression to unwrap.</param>
441+
/// <returns>The unwrapped expression.</returns>
442+
private static Expression UnwrapUnary(Expression expression)
443+
{
444+
while (expression is UnaryExpression unaryExpression)
445+
{
446+
expression = unaryExpression.Operand;
447+
}
448+
449+
return expression;
450+
}
437451
}
438452
}

src/NHibernate/Util/ExpressionsHelper.cs

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -59,21 +59,6 @@ constant.Value is CallSite site &&
5959
}
6060
#endif
6161

62-
/// <summary>
63-
/// Unwraps <see cref="UnaryExpression"/>.
64-
/// </summary>
65-
/// <param name="expression">The expression to unwrap.</param>
66-
/// <returns>The unwrapped expression.</returns>
67-
internal static Expression UnwrapUnary(Expression expression)
68-
{
69-
if (expression is UnaryExpression unaryExpression)
70-
{
71-
return UnwrapUnary(unaryExpression.Operand);
72-
}
73-
74-
return expression;
75-
}
76-
7762
/// <summary>
7863
/// Check whether the given expression represent a variable.
7964
/// </summary>

0 commit comments

Comments
 (0)