Skip to content

Commit

Permalink
Cleanup guessed parameters handling in hql (#3255)
Browse files Browse the repository at this point in the history
Partial revert of no longer needed logic from #2964 (obsoleted by #2723)
  • Loading branch information
bahusoid authored Mar 16, 2023
1 parent 7bd43f5 commit d419ab3
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 19 deletions.
17 changes: 0 additions & 17 deletions src/NHibernate/Hql/Ast/ANTLR/HqlSqlWalker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ public partial class HqlSqlWalker
private readonly LiteralProcessor _literalProcessor;

private readonly IDictionary<string, string> _tokenReplacements;
private readonly IDictionary<IParameterSpecification, IType> _guessedParameterTypes = new Dictionary<IParameterSpecification, IType>();

private JoinType _impliedJoinType;

Expand Down Expand Up @@ -93,21 +92,6 @@ public override void ReportError(RecognitionException e)
_parseErrorHandler.ReportError(e);
}

internal IStatement Transform()
{
var tree = (IStatement) statement().Tree;
// Use the guessed type in case we weren't been able to detect the type
foreach (var parameter in _parameters)
{
if (parameter.ExpectedType == null && _guessedParameterTypes.TryGetValue(parameter, out var guessedType))
{
parameter.ExpectedType = guessedType;
}
}

return tree;
}

/*
protected override void Mismatch(IIntStream input, int ttype, BitSet follow)
{
Expand Down Expand Up @@ -1176,7 +1160,6 @@ IASTNode GenerateNamedParameter(IASTNode delimiterNode, IASTNode nameNode)
// when the parameter is used as an argument.
if (isGuessedType)
{
_guessedParameterTypes[paramSpec] = type;
parameter.GuessedType = type;
}
else
Expand Down
3 changes: 1 addition & 2 deletions src/NHibernate/Hql/Ast/ANTLR/QueryTranslatorImpl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -651,8 +651,7 @@ public IStatement Translate()

try
{
// Transform the tree.
_resultAst = hqlSqlWalker.Transform();
_resultAst = (IStatement) hqlSqlWalker.statement().Tree;
}
finally
{
Expand Down

0 comments on commit d419ab3

Please sign in to comment.