Skip to main content

qualify_shadowed_calls

Function qualify_shadowed_calls 

Source
pub(crate) fn qualify_shadowed_calls<'t>(
    text: &'t str,
    formals: &BTreeSet<String>,
) -> Cow<'t, str>
Expand description

Write base:: before every call in text to a BASE_CALLEES function that shares its name with one of formals.

A call is a name followed by optional spaces and (. Strings, raw strings, comments (roxygen blocks included) and backtick names are left as they are, as is a name after ::, :::, $ or @. A replacement call (class(x) <- v) is qualified too: R resolves base::class(x) <- v through base::"class<-". The match_arg choices placeholder, which the wrapper writer replaces with c(<choices>), counts as a call to c.

Returns text borrowed when nothing is qualified.