void (final @Nullable PsiElement pendingScope, final @Nullable Instruction instruction) { if (instruction == null) { return; } int i = 0; // another optimization! Place pending before first scope, not contained in pendingScope // the same logic is used in checkPending if (pendingScope != null) { for (; i < pending.size(); i++) { final Pair<PsiElement, Instruction> pair = pending.get(i); final PsiElement scope = pair.getFirst(); if (scope == null) { continue; } if (!PsiTreeUtil.isAncestor(scope, pendingScope, true)) { break; } } } pending.add(i, Pair.create(pendingScope, instruction)); }