Skip to content

Commit 3bbb542

Browse files
committed
small refact
1 parent 252818d commit 3bbb542

File tree

1 file changed

+11
-13
lines changed

1 file changed

+11
-13
lines changed

src/NHibernate/Hql/Ast/ANTLR/AstPolymorphicProcessor.cs

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -30,20 +30,18 @@ private IASTNode[] Process()
3030
// Find all the polymorphic query sources
3131
_nodeMapping = new PolymorphicQuerySourceDetector(_factory).Process(_ast);
3232

33-
if (_nodeMapping.Count > 0)
34-
{
35-
if (_nodeMapping.All(x => x.Value.Length == 0))
36-
throw new QuerySyntaxException(
37-
_nodeMapping.Keys.Count == 1
38-
? _nodeMapping.First().Key + " is not mapped"
39-
: string.Join(", ", _nodeMapping.Keys) + " are not mapped");
33+
if (_nodeMapping.Count == 0)
34+
return new[] {_ast};
4035

41-
return DuplicateTree();
42-
}
43-
else
44-
{
45-
return new[] { _ast };
46-
}
36+
var parsers = DuplicateTree();
37+
38+
if (parsers.Length == 0)
39+
throw new QuerySyntaxException(
40+
_nodeMapping.Keys.Count == 1
41+
? _nodeMapping.First().Key + " is not mapped"
42+
: string.Join(", ", _nodeMapping.Keys) + " are not mapped");
43+
44+
return parsers;
4745
}
4846

4947
private IASTNode[] DuplicateTree()

0 commit comments

Comments
 (0)