private bool TryNameCompare(QilNodeType relOp, QilNode ndFirst, QilNode ndSecond) {
Debug.Assert(relOp == QilNodeType.Eq || relOp == QilNodeType.Ne);
if (ndFirst.NodeType == QilNodeType.NameOf) {
switch (ndSecond.NodeType) {
case QilNodeType.NameOf:
case QilNodeType.LiteralQName: {
this.helper.LoadQueryRuntime();
// Push left navigator onto the stack
NestedVisitEnsureStack((ndFirst as QilUnary).Child);
// Push the local name and namespace uri of the right argument onto the stack
if (ndSecond.NodeType == QilNodeType.LiteralQName) {
QilName ndName = ndSecond as QilName;
this.helper.LoadInteger(this.helper.StaticData.DeclareName(ndName.LocalName));
this.helper.LoadInteger(this.helper.StaticData.DeclareName(ndName.NamespaceUri));
// push runtime.IsQNameEqual(navigator, localName, namespaceUri)
this.helper.Call(XmlILMethods.QNameEqualLit);
}
else {
// Generate code to locate the navigator argument of NameOf operator
Debug.Assert(ndSecond.NodeType == QilNodeType.NameOf);
NestedVisitEnsureStack(ndSecond);
// push runtime.IsQNameEqual(nav1, nav2)
this.helper.Call(XmlILMethods.QNameEqualNav);
}
// Branch based on boolean result or push boolean value
ZeroCompare((relOp == QilNodeType.Eq) ? QilNodeType.Ne : QilNodeType.Eq, true);
return true;
}
}
}
// Caller must perform comparison
return false;
}