textContains(char c) method optimization

This commit is contained in:
Olesya Smirnova
2005-01-27 14:35:55 +03:00
parent a14545b770
commit bb5cf0e0ab
@@ -155,7 +155,12 @@ public class CompositeElement extends TreeElement implements Cloneable {
}
public boolean textContains(char c) {
return getText().indexOf(c) >= 0;
synchronized (PsiLock.LOCK) {
for (ASTNode child = getFirstChildNode(); child != null; child = child.getTreeNext()) {
if (child.textContains(c)) return true;
}
return false;
}
}
public final PsiElement findChildByRoleAsPsiElement(int role) {