void SaveReference(bool hasNamespace, Span namespaceSpan, Span nameSpan, XmlNameReferenceKind refKind, bool findDefsOnly) { var aliasSpan = hasNamespace ? namespaceSpan : new Span(0, 0); XmlNamespaceReference nsRef; if (findDefsOnly) { var alias = GetSubstring(aliasSpan); var def = xmlNamespaces.GetOrCreate(alias); nsRef = new XmlNamespaceReference(alias) { Definition = def }; } else { nsRef = GetAttributeNamespaceReference(aliasSpan); } if (hasNamespace) { var @ref = new XmlNamespaceTextViewerReference(nsRef); references.Add(new ReferenceInfo(namespaceSpan, @ref, false)); } var nameRef = new XmlNameTextViewerReference(nsRef, GetSubstring(nameSpan), refKind); references.Add(new ReferenceInfo(nameSpan, nameRef, false)); }
public XmlNameTextViewerReference(XmlNamespaceReference nsRef, string name, XmlNameReferenceKind refKind) { if (nsRef == null) { throw new ArgumentNullException(nameof(nsRef)); } if (name == null) { throw new ArgumentNullException(nameof(name)); } this.nsRef = nsRef; this.name = name; this.refKind = refKind; }
void SaveReference(NameToken name, XmlNameReferenceKind refKind, bool findDefsOnly) => SaveReference(name.HasNamespace, name.Namespace.Span, name.Name.Span, refKind, findDefsOnly);
void SaveReference(NameToken name, XmlNameReferenceKind refKind) => owner.SaveReference(name.HasNamespace, name.Namespace.Span, name.Name.Span, refKind, findDefsOnly: false);