TODO Interim fix:

For now don't allow the neighborhood to go all the way out to the outermostEnclosingFunction, because that causes bugs.

After this change, `enclosingFunctionBodyEndpointNeighborhood` doesn't match `enclosingFunctionBody` even when the function is small, which is undesired behavior. `enclosingFunctionBody` includes the arguments to the function whereas `enclosingFunctionBodyEndpointNeighborhood` does not. We should find a way to fix this.
This commit is contained in:
Tiferet Gazit
2021-11-22 20:10:24 +00:00
committed by GitHub
parent a507d6dc1d
commit e2ffba2e47

View File

@@ -208,7 +208,7 @@ module NeighborhoodBodies {
*/
Raw::AstNode getNeighborhoodAstNode(Raw::AstNode node, DescendantsThreshold maxNumDescendants) {
if
node = getOutermostEnclosingFunction(node) or
node.getParentNode() = getOutermostEnclosingFunction(node) or
getNumDescendents(node.getParentNode()) > maxNumDescendants.getMaxNumDescendants()
then result = node
else result = getNeighborhoodAstNode(node.getParentNode(), maxNumDescendants)