Skip to main content

DefIndex

Struct DefIndex 

Source
pub struct DefIndex {
    pub defs: Vec<Def>,
    pub member_lists: Vec<MemberLists>,
    pub qualified_name_to_def: HashMap<String, usize>,
    pub qualified_name_and_arity_to_def: HashMap<(String, usize), usize>,
    pub simple_name_to_defs: HashMap<String, Vec<usize>>,
    pub extension_index: HashMap<String, Vec<ExtCandidate>>,
    pub member_name_to_defs: HashMap<String, Vec<usize>>,
}
Expand description

Vec<Def> in first-insertion order (partial-class duplicates land in also_in, never as a second Vec entry) plus two lookup indexes over it: qualified_name_to_def (id -> index, every def incl. enum members) and simple_name_to_defs (bare name -> indexes, EVERY def EXCEPT enum members – the asymmetry described in the module header).

Fields§

§defs: Vec<Def>

The defs value.

§member_lists: Vec<MemberLists>

Parallel to defs (same indexes), NOT fields on Def: a def’s property/field lists are RESOLUTION inputs only. No graph.json reader consumes them (graph-query walks EDGES), so serializing them would multiply the def table’s size on disk and in every scout refs/scout impact read for nothing. Keeping them off Def keeps the on-disk def rows to exactly the serialized fields.

§qualified_name_to_def: HashMap<String, usize>

The qualified name to def value.

§qualified_name_and_arity_to_def: HashMap<(String, usize), usize>

The qualified name and arity to def value.

§simple_name_to_defs: HashMap<String, Vec<usize>>

The simple name to defs value.

§extension_index: HashMap<String, Vec<ExtCandidate>>

The extension tier’s own lookup: “<method_name> <this_type>” (one ASCII space) -> every candidate declaring that PAIR, as (def index, entry).

The key was the (name, this_type, arity) TRIPLE until the range amendment. Arity moved out of the key and into a per-entry range filter because an exact arity is not the language’s rule: Send(this T t, X a, Y b = null) accepts two OR three arguments, and keying on 3 alone made a call with two arguments miss it – which in turn made a DIFFERENT class’s exact-arity-2 Send look like the only candidate and win an edge it had no right to – the false-uniqueness shape.

Build order is def order – files in fragment-map order, defs in source order, extension entries in declaration order – so a bucket holding two candidates holds them in the same order on every run. The tier refuses on a 2-candidate bucket anyway; the order is pinned because it is what a later scored tier would read.

§member_name_to_defs: HashMap<String, Vec<usize>>

Member name -> every def that vouches for a member of that name, the pool the scored tier’s UNIQUENESS FALLBACK draws from when a ref’s qualifier resolves to nothing at all (x.Tally() where the extractor could vouch for no type for x). Built AFTER the main def loop, not during it, so a partial class contributes its accumulated member set once instead of appearing in a bucket per declaring file.

Insertion order is def order (fragment order, then source order), and within one def the names are collected methods -> properties -> fields -> extension-method names, first insertion winning. This order decides which candidates a <= SCORED_UNIQUENESS_CAP pool holds.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.