protected override QilNode Visit(QilNode nd) {
if (nd != null) {
if (this[XmlILOptimization.EliminateNamespaceDecl]) {
// Eliminate redundant namespaces in the tree. Don't perform the scan on an ElementCtor which
// has already been marked as having a redundant namespace.
switch (nd.NodeType) {
case QilNodeType.QilExpression:
// Perform namespace analysis on root expression (xmlns="" is in-scope for this expression)
this.nmspAnalyzer.Analyze(((QilExpression) nd).Root, true);
break;
case QilNodeType.ElementCtor:
if (!XmlILConstructInfo.Read(nd).IsNamespaceInScope)
this.nmspAnalyzer.Analyze(nd, false);
break;
case QilNodeType.DocumentCtor:
this.nmspAnalyzer.Analyze(nd, true);
break;
}
}
}
// Continue visitation
return base.Visit(nd);
}