List<String> (@NotNull PsiElement start) { List<String> result = new SmartList<>(); for (PsiElement context = start; !isCodeBoundary(context); context = context.getContext()) { if (context instanceof PsiLabeledStatement) { result.add(((PsiLabeledStatement)context).getName()); } } return result; }