pub struct SourceMap { /* private fields */ }
Expand description

Mapping from entity names to source locations.

Implementations§

source§

impl SourceMap

Read-only interface which is exposed outside the parser crate.

source

pub fn contains_value(&self, v: Value) -> bool

Look up a value entity.

source

pub fn contains_block(&self, block: Block) -> bool

Look up a block entity.

source

pub fn contains_ss(&self, ss: StackSlot) -> bool

Look up a stack slot entity.

source

pub fn contains_dss(&self, dss: DynamicStackSlot) -> bool

Look up a dynamic stack slot entity.

source

pub fn contains_gv(&self, gv: GlobalValue) -> bool

Look up a global value entity.

source

pub fn contains_table(&self, table: Table) -> bool

Look up a table entity.

source

pub fn contains_sig(&self, sig: SigRef) -> bool

Look up a signature entity.

source

pub fn contains_fn(&self, fn_: FuncRef) -> bool

Look up a function entity.

source

pub fn contains_jt(&self, jt: JumpTable) -> bool

Look up a jump table entity.

source

pub fn contains_constant(&self, c: Constant) -> bool

Look up a constant entity.

source

pub fn lookup_str(&self, name: &str) -> Option<AnyEntity>

Look up an entity by source name. Returns the entity reference corresponding to name, if it exists.

source

pub fn location(&self, entity: AnyEntity) -> Option<Location>

Get the source location where an entity was defined.

source§

impl SourceMap

source

pub fn new() -> Self

Create a new empty SourceMap.

source

pub fn def_value(&mut self, entity: Value, loc: Location) -> ParseResult<()>

Define the value entity.

source

pub fn def_block(&mut self, entity: Block, loc: Location) -> ParseResult<()>

Define the block entity.

source

pub fn def_ss(&mut self, entity: StackSlot, loc: Location) -> ParseResult<()>

Define the stack slot entity.

source

pub fn def_dss( &mut self, entity: DynamicStackSlot, loc: Location ) -> ParseResult<()>

Define the dynamic stack slot entity.

source

pub fn def_dt(&mut self, entity: DynamicType, loc: Location) -> ParseResult<()>

Define the dynamic type entity.

source

pub fn def_gv(&mut self, entity: GlobalValue, loc: Location) -> ParseResult<()>

Define the global value entity.

source

pub fn def_mt(&mut self, entity: MemoryType, loc: Location) -> ParseResult<()>

Define the memory type entity.

source

pub fn def_table(&mut self, entity: Table, loc: Location) -> ParseResult<()>

Define the table entity.

source

pub fn def_sig(&mut self, entity: SigRef, loc: Location) -> ParseResult<()>

Define the signature entity.

source

pub fn def_fn(&mut self, entity: FuncRef, loc: Location) -> ParseResult<()>

Define the external function entity.

source

pub fn def_jt(&mut self, entity: JumpTable, loc: Location) -> ParseResult<()>

Define the jump table entity.

source

pub fn def_constant( &mut self, entity: Constant, loc: Location ) -> ParseResult<()>

Define the jump table entity.

source

pub fn def_entity( &mut self, entity: AnyEntity, loc: Location ) -> ParseResult<()>

Define an entity. This can be used for instructions whose numbers never appear in source, or implicitly defined signatures.

Trait Implementations§

source§

impl Debug for SourceMap

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for SourceMap

source§

fn default() -> SourceMap

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere 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, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

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.