Skip to main content

write_subscript_receiver

Function write_subscript_receiver 

Source
fn write_subscript_receiver<W: Write, T: AstInfo>(
    f: &mut AstFormatter<W>,
    expr: &Expr<T>,
)
Expand description

Write expr as the receiver of a […] subscript. An unparenthesized Identifier(["map"]) reparses as Token::Keyword(MAP) followed by [, which dispatches to parse_map (the map-literal grammar) instead of a regular subscript. Parenthesize identifiers whose last component is a context-sensitive keyword so the round trip stays an identifier subscript.