use of com.intellij.dupLocator.iterators.ArrayBackedNodeIterator in project intellij-community by JetBrains.
the class XmlMatchingVisitor method visitXmlTag.
@Override
public void visitXmlTag(XmlTag tag) {
final XmlTag another = (XmlTag) myMatchingVisitor.getElement();
final boolean isTypedVar = myMatchingVisitor.getMatchContext().getPattern().isTypedVar(tag.getName());
myMatchingVisitor.setResult((matches(tag.getName(), another.getName()) || isTypedVar) && myMatchingVisitor.matchInAnyOrder(tag.getAttributes(), another.getAttributes()));
if (myMatchingVisitor.getResult()) {
final XmlTagChild[] contentChildren = tag.getValue().getChildren();
if (contentChildren.length > 0) {
PsiElement[] patternNodes = contentChildren;
PsiElement[] matchedNodes = another.getValue().getChildren();
if (contentChildren.length != 1) {
patternNodes = filterOutWhitespace(patternNodes);
matchedNodes = filterOutWhitespace(matchedNodes);
}
final boolean result = myMatchingVisitor.matchSequentially(new ArrayBackedNodeIterator(patternNodes), new ArrayBackedNodeIterator(matchedNodes));
myMatchingVisitor.setResult(result);
}
}
if (myMatchingVisitor.getResult() && isTypedVar) {
final PsiElement[] children = another.getChildren();
if (children.length > 1) {
MatchingHandler handler = myMatchingVisitor.getMatchContext().getPattern().getHandler(tag.getName());
myMatchingVisitor.setResult(((SubstitutionHandler) handler).handle(children[1], myMatchingVisitor.getMatchContext()));
}
}
}
Aggregations