Skip to main content

ExtraCallerContext

Struct ExtraCallerContext 

Source
pub struct ExtraCallerContext<'a> {
    pub extra_callers: &'a [ExtraCallerConfig],
    pub dictionary_mode_map: &'a BTreeMap<String, String>,
    pub import_mode: ImportKind,
    pub use_dynamic_helpers: bool,
}
Expand description

Everything the optimize transform needs to rewrite an extra-caller call site, gathered so no adapter-specific decision is taken in optimize.rs.

A build with no extraCallers configured never constructs one — the optimize transform holds Option<ExtraCallerContext> and skips every branch guarded by it, so the base intlayer rewrite is untouched by the adapters.

Fields§

§extra_callers: &'a [ExtraCallerConfig]

Descriptors injected by the compat packages’ bundler plugins.

§dictionary_mode_map: &'a BTreeMap<String, String>

Per-dictionary import mode overrides.

§import_mode: ImportKind

The file’s global import mode.

§use_dynamic_helpers: bool

File-level dynamic decision: one import specifier serves every call, so a global dynamic/fetch mode or any per-dictionary override flips all rewritten compat calls to the dynamic helper.

Implementations§

Source§

impl<'a> ExtraCallerContext<'a>

Source

pub fn import_kind(&self, dictionary_key: &str) -> ImportKind

Import kind an extra-caller call site resolves to for dictionary_key.

Source

pub fn rewrite_call( &self, call: &mut CallExpr, extra_index: usize, imports: &mut InjectedImports, )

Rewrites an extra-caller call site: the namespace is replaced by (or prefixed with) a pre-imported dictionary, plus the dictionary key and nested key prefix the helper needs.

Source

pub fn owns_import_source(&self, package_specifier: &str) -> bool

Whether package_specifier exports at least one extra caller, so the optimize transform knows the import is worth inspecting even though it is not a native intlayer package.

Source

pub fn rewrite_import_specifier( &self, named: &mut ImportNamedSpecifier, package_specifier: &str, caller_map: &CallerMap, )

Re-points one import specifier at the dictionary-accepting replacement its descriptor declares, keeping the local alias so call sites read unchanged. Specifiers whose local name is not a registered extra caller — dropped by the pre-pass because a call site was unresolvable — keep their original import.

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> ErasedDestructor for T
where T: 'static,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> Send for T
where T: ?Sized,

Source§

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

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, !>

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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more