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

Cleanup guessed parameters handling in hql #3255

Merged
merged 3 commits into from
Mar 16, 2023
Merged
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
17 changes: 0 additions & 17 deletions src/NHibernate/Hql/Ast/ANTLR/HqlSqlWalker.cs
Original file line number Diff line number Diff line change
@@ -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;

@@ -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)
{
@@ -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
3 changes: 1 addition & 2 deletions src/NHibernate/Hql/Ast/ANTLR/QueryTranslatorImpl.cs
Original file line number Diff line number Diff line change
@@ -651,8 +651,7 @@ public IStatement Translate()

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