pub struct TransformContext {
pub known_bases: BTreeSet<String>,
pub known_symbols: BTreeSet<String>,
}Expand description
Compilation context for the AMI4CCM transform.
Spec references:
- §7.5 — derived interfaces inherit their ReplyHandler from the
ReplyHandler of the base interface (
AMI4CCM_<Base>ReplyHandler). For this, the transformer needs a map of the already-transformed bases (known_bases). - §7.5 / §7.3.1 — if the naive
AMI4CCM_<Iface>/ReplyHandlername collides with an existing identifier in the compilation unit,AMI_prefixes must be added until the name is unique (known_symbols).
Fields§
§known_bases: BTreeSet<String>Set of original interface names whose ReplyHandler has already
been generated. Consulted in transform_interface for an
interface with iface.bases = [Base]: if Base.text is
present, the new ReplyHandler inherits from
AMI4CCM_<Base>ReplyHandler instead of the generic
CCM_AMI::ReplyHandler.
known_symbols: BTreeSet<String>Set of all identifiers in the current compilation scope. Checked
against the conflict resolver before emitting the AMI4CCM
interface names (AMI_AMI4CCM_<Iface> etc.).
Implementations§
Source§impl TransformContext
impl TransformContext
Sourcepub fn mark_transformed(&mut self, iface_name: &str)
pub fn mark_transformed(&mut self, iface_name: &str)
Marks an interface name as already-transformed, so that derived interfaces inherit their ReplyHandler correctly.
Sourcepub fn add_known_symbol(&mut self, name: &str)
pub fn add_known_symbol(&mut self, name: &str)
Registers an already-existing identifier that the AMI4CCM naming resolver must check against.
Trait Implementations§
Source§impl Clone for TransformContext
impl Clone for TransformContext
Source§fn clone(&self) -> TransformContext
fn clone(&self) -> TransformContext
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for TransformContext
impl Debug for TransformContext
Source§impl Default for TransformContext
impl Default for TransformContext
Source§fn default() -> TransformContext
fn default() -> TransformContext
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for TransformContext
impl RefUnwindSafe for TransformContext
impl Send for TransformContext
impl Sync for TransformContext
impl Unpin for TransformContext
impl UnsafeUnpin for TransformContext
impl UnwindSafe for TransformContext
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more