pub struct Expression<S = ()> {
pub ty: ExpressionTy<S>,
pub size: Option<usize>,
pub span: S,
}Expand description
A p-code expression: a node kind, plus the width its value has.
S is the span type. It is (usize, usize) — a byte range into the
preprocessed source — while the compiler is lowering, and () in the form
a consumer receives, which is the default span parameter.
Fields§
§ty: ExpressionTy<S>What kind of expression this is, and its operands.
size: Option<usize>Width of the value in bytes.
None means the width was not written in the source and could not be
inferred — a literal in a position that does not pin one down, most
often. A consumer that needs a width must supply one from context
rather than assume.
span: SWhere this node came from in the preprocessed source, or () once the
compiler is done with it.
Implementations§
Source§impl<S> Expression<S>
impl<S> Expression<S>
Sourcepub fn strip_span(self) -> Expression<()>
pub fn strip_span(self) -> Expression<()>
Discards source spans, giving the form a consumer receives.
Source§impl Expression
impl Expression
Sourcepub fn pretty_print(&self, spec: &impl PcodeResolver) -> String
pub fn pretty_print(&self, spec: &impl PcodeResolver) -> String
Renders this expression in a SLEIGH-like syntax, resolving identifiers
against spec. For diagnostics and tests; not a stable format.
Trait Implementations§
Source§impl<S: Clone> Clone for Expression<S>
impl<S: Clone> Clone for Expression<S>
Source§fn clone(&self) -> Expression<S>
fn clone(&self) -> Expression<S>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more