Skip to main content

find_keyword_span_before_name

Function find_keyword_span_before_name 

Source
pub fn find_keyword_span_before_name(
    tokens: &[Token],
    keyword: TokenType,
    variable_name: &str,
    interner: &Interner,
) -> Option<Span>
Expand description

Find the span of the keyword statement (Give, Zone, …) that CAUSED an error on variable_name. Used for diagnostic related-information.

The variable must sit in OBJECT position — the token immediately after the keyword — so Give y to x never counts as the Give that moved x (there, x is the recipient). When before_offset is given, the LAST matching statement before that use site wins: the most recent move is the cause, not the first one in the file.