Java: PrintAst: Improve the ranking or callables

We now look not only at how many parameters each callable has, but what
its full signature is. This allows us to give a consistent order to
    Test(Throwable) { ... }
    Test(String) { ... }
This commit is contained in:
Ian Lynagh
2023-03-14 17:49:54 +00:00
parent a9e5b34ad6
commit 13c2ef8c20

View File

@@ -537,17 +537,13 @@ final class ClassInterfaceNode extends ElementNode {
or
childIndex >= 0 and
result.(ElementNode).getElement() =
rank[childIndex](Element e, string file, int line, int column, string childStr, int argCount |
rank[childIndex](Element e, string file, int line, int column, string childStr, string sig |
e = this.getADeclaration() and
locationSortKeys(e, file, line, column) and
childStr = e.toString() and
(
if e instanceof Callable
then argCount = e.(Callable).getNumberOfParameters()
else argCount = 0
)
(if e instanceof Callable then sig = e.(Callable).getStringSignature() else sig = "")
|
e order by file, line, column, childStr, argCount
e order by file, line, column, childStr, sig
)
}
}