void (@Nullable GroovyPsiElement scopeWhenAdded, InstructionImpl instruction) { if (instruction == null) return; int i = 0; if (scopeWhenAdded != null) { for (; i < myPending.size(); i++) { Pair<InstructionImpl, GroovyPsiElement> pair = myPending.get(i); final GroovyPsiElement currScope = pair.getSecond(); if (currScope == null) continue; if (!PsiTreeUtil.isAncestor(currScope, scopeWhenAdded, true)) break; } } myPending.add(i, Pair.create(instruction, scopeWhenAdded)); }