private void retargetOutgoingEdges(@NotNull PsiElement scopeAncestor,
                                     @NotNull BiFunction<PsiElement, Instruction, PsiElement> newScopeProvider) {
    myBuilder.processPending((oldScope, instruction) -> {
      if (oldScope != null && PsiTreeUtil.isAncestor(scopeAncestor, oldScope, false)) {
        myBuilder.addPendingEdge(newScopeProvider.apply(oldScope, instruction), instruction);
      }
      else {
        myBuilder.addPendingEdge(oldScope, instruction);
      }
    });
  }
private void retargetOutgoingEdges(@NotNull PsiElement scopeAncestor,
                                     @NotNull BiFunction<PsiElement, Instruction, PsiElement> newScopeProvider)