NameIndex
- class NameIndex
Description
A name -> elements lookup over a model, built once by
build_name_index().Two maps are held:
by_qualified_namemaps the rendered qualified name (e.g."Pkg::Sub::Name") to one element bearing it. Within one document a qualified name is unique (a duplicate is anamespace-distinguishabilityerror), but two documents may each declarepackage Dup, and then both packages renderDup: the first in document order is kept under"Dup"and the later same-named packages are not, here and infind_by_qualified_name()alike, so the two paths agree. Only the package objects are shadowed: their members keep distinct qualified names (Dup::AAfrom one document,Dup::BBfrom the other) and each is indexed. Useby_simple_nameto see every element of a name. Memberships are left out: the only memberships carrying a qualified name arealiasmemberships, whose name is a name for their target, and handing one back from a lookup by name would answer with the membership rather than the element asked for. An alias name therefore resolves to nothing here, exactly as it does infind_by_qualified_name(); to follow an alias to its target useget_by_path(). Every other named element is indexed, relationships included: adependency dep from A to B;is found as"P::dep"here and by the walk alike.by_simple_namemaps an element’s simplenameto every element bearing that name anywhere in the model (names are not unique), so its values are lists in first-seen (scan) order.
Which library elements are indexed is set by the
LibraryElementsvalue the index was built with. An element that value excludes is skipped during the scan, so it also cannot claim a name (in either map) ahead of an indexed element.Members defined in
NameIndex(2 members)Attributes
- by_qualified_name: dict[str, syside.Element] = None
- by_simple_name: dict[str, list[syside.Element]] = None
Used by